use of org.neo4j.graphalgo.impl.util.WeightedPathIterator in project neo4j by neo4j.
the class TraversalAStar method findPaths.
private Iterable<WeightedPath> findPaths(Node start, Node end, boolean multiplePaths) {
PathInterest interest;
if (multiplePaths) {
interest = stopAfterLowestWeight ? PathInterestFactory.allShortest() : PathInterestFactory.all();
} else {
interest = PathInterestFactory.single();
}
GraphDatabaseService db = start.getGraphDatabase();
TraversalDescription traversalDescription = db.traversalDescription().uniqueness(Uniqueness.NONE).expand(expander, initialState);
lastTraverser = traversalDescription.order(new SelectorFactory(end, interest)).evaluator(includeWhereEndNodeIs(end)).traverse(start);
return new Iterable<WeightedPath>() {
@Override
public Iterator<WeightedPath> iterator() {
return new WeightedPathIterator(lastTraverser.iterator(), costEvaluator, stopAfterLowestWeight);
}
};
}
Aggregations