|
From: <mrp...@us...> - 2014-04-09 17:29:23
|
Revision: 8093
http://sourceforge.net/p/bigdata/code/8093
Author: mrpersonick
Date: 2014-04-09 17:29:19 +0000 (Wed, 09 Apr 2014)
Log Message:
-----------
capture only shortest paths instead of all paths
Modified Paths:
--------------
branches/RDR/bigdata-gas/src/java/com/bigdata/rdf/graph/analytics/PATHS.java
Modified: branches/RDR/bigdata-gas/src/java/com/bigdata/rdf/graph/analytics/PATHS.java
===================================================================
--- branches/RDR/bigdata-gas/src/java/com/bigdata/rdf/graph/analytics/PATHS.java 2014-04-09 12:35:35 UTC (rev 8092)
+++ branches/RDR/bigdata-gas/src/java/com/bigdata/rdf/graph/analytics/PATHS.java 2014-04-09 17:29:19 UTC (rev 8093)
@@ -131,20 +131,22 @@
* first visited the vertex (this helps to avoid multiple
* scheduling of a vertex).
*/
- public boolean visit(final int depth, final Value pred, final URI edge) {
+ public synchronized boolean visit(final int depth, final Value pred, final URI edge) {
+
+ boolean ret = false;
- if (pred != null) {
+ if (this.depth.compareAndSet(-1/* expect */, depth/* newValue */)) {
+ // Scheduled by this thread.
+ ret = true;
+ }
+
+ if (pred != null && this.depth() > 0 && this.depth() == depth) {
// this.predecessors.add(pred);
addPredecessor(pred, edge);
}
- if (this.depth.compareAndSet(-1/* expect */, depth/* newValue */)) {
- // Scheduled by this thread.
- return true;
- }
+ return ret;
- return false;
-
}
@Override
@@ -281,6 +283,7 @@
// final VS otherState = state.getState(e.getObject()/* v */);
// visit.
+
if (otherState.visit(state.round() + 1, u/* predecessor */, e.getPredicate())) {
/*
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|