use of org.neo4j.graphdb.traversal.Traverser in project neo4j by neo4j.
the class DepthPitfallGraphTest method canPreFilterNodes.
private void canPreFilterNodes(TraversalDescription description) {
Traverser traverser = description.uniqueness(Uniqueness.NONE).evaluator(atDepth(2)).traverse(node("1"));
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 neo4j by neo4j.
the class DepthPitfallGraphTest method canPruneTraversalAtSpecificDepth.
private void canPruneTraversalAtSpecificDepth(TraversalDescription description) {
Traverser traverser = description.uniqueness(Uniqueness.NONE).evaluator(toDepth(1)).traverse(node("1"));
expectNodes(traverser, "1", "2", "3", "4", "5");
}
use of org.neo4j.graphdb.traversal.Traverser in project neo4j by neo4j.
the class DepthPitfallGraphTest method testNodesAreReturnedOnceWhenSufficientRecentlyUnique.
private void testNodesAreReturnedOnceWhenSufficientRecentlyUnique(TraversalDescription description) {
Traverser traverser = description.uniqueness(Uniqueness.NODE_RECENT, 6).traverse(node("1"));
expectNodes(traverser, "1", "2", "3", "4", "5", "6");
}
use of org.neo4j.graphdb.traversal.Traverser in project neo4j by neo4j.
the class SmallestGraphEverTest method execute.
private void execute(TraversalDescription traversal, Uniqueness uniqueness) {
try (Transaction transaction = beginTx()) {
Traverser traverser = traversal.uniqueness(uniqueness).traverse(node("1"));
assertFalse("empty traversal", Iterables.count(traverser) == 0);
}
}
use of org.neo4j.graphdb.traversal.Traverser in project neo4j-mobile-android by neo4j-contrib.
the class ExperimentalAStar 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 = traversalDescription.order(new SelectorFactory(end)).filter(filter).traverse(start);
return new Iterable<WeightedPath>() {
public Iterator<WeightedPath> iterator() {
return new StopAfterWeightIterator(traverser.iterator(), costEvaluator);
}
};
}
Aggregations