use of org.neo4j.graphdb.traversal.Traverser in project neo4j-mobile-android by neo4j-contrib.
the class Dijkstra method findAllPaths.
public Iterable<WeightedPath> findAllPaths(Node start, final Node end) {
Predicate<Path> filter = new Predicate<Path>() {
public boolean accept(Path position) {
return position.endNode().equals(end);
}
};
final Traverser traverser = TRAVERSAL.expand(expander).order(new SelectorFactory(costEvaluator)).filter(filter).traverse(start);
return new Iterable<WeightedPath>() {
public Iterator<WeightedPath> iterator() {
return new StopAfterWeightIterator(traverser.iterator(), costEvaluator);
}
};
}
use of org.neo4j.graphdb.traversal.Traverser in project graphdb by neo4j-attic.
the class DepthPitfallGraphTest method canPreFilterNodes.
private void canPreFilterNodes(TraversalDescription description) {
Traverser traverser = description.uniqueness(Uniqueness.NONE).evaluator(Evaluators.atDepth(2)).traverse(referenceNode());
expectPaths(traverser, "1,2,6", "1,3,5", "1,4,5", "1,5,3", "1,5,4", "1,5,6");
}
use of org.neo4j.graphdb.traversal.Traverser in project graphdb by neo4j-attic.
the class DepthPitfallGraphTest method testAllUniqueNodePathsAreReturned.
private void testAllUniqueNodePathsAreReturned(TraversalDescription description) throws Exception {
Traverser traverser = description.uniqueness(Uniqueness.NODE_PATH).traverse(referenceNode());
expectPaths(traverser, NODE_UNIQUE_PATHS);
}
use of org.neo4j.graphdb.traversal.Traverser in project graphdb by neo4j-attic.
the class DepthPitfallGraphTest method testRelationshipsAreReturnedOnceWhenSufficientRecentlyUnique.
private void testRelationshipsAreReturnedOnceWhenSufficientRecentlyUnique(TraversalDescription description) throws Exception {
Traverser traverser = description.uniqueness(Uniqueness.RELATIONSHIP_RECENT, THE_WORLD_AS_WE_KNOW_IT.length).traverse(referenceNode());
expectRelationships(traverser, THE_WORLD_AS_WE_KNOW_IT);
}
use of org.neo4j.graphdb.traversal.Traverser in project graphdb by neo4j-attic.
the class DepthPitfallGraphTest method testAllUniqueRelationshipPathsAreReturned.
private void testAllUniqueRelationshipPathsAreReturned(TraversalDescription description) throws Exception {
Set<String> expected = new HashSet<String>(Arrays.asList(NODE_UNIQUE_PATHS));
expected.addAll(Arrays.asList(RELATIONSHIP_UNIQUE_EXTRA_PATHS));
Traverser traverser = description.uniqueness(Uniqueness.RELATIONSHIP_PATH).traverse(referenceNode());
expectPaths(traverser, expected);
}
Aggregations