use of org.neo4j.kernel.impl.traversal.MonoDirectionalTraversalDescription in project neo4j by neo4j.
the class Dijkstra method traverser.
private Traverser traverser(Node start, final Node end, PathInterest<Double> interest) {
PathExpander dijkstraExpander;
PathEvaluator dijkstraEvaluator;
if (stateInUse) {
dijkstraExpander = expander;
dijkstraEvaluator = Evaluators.includeWhereEndNodeIs(end);
} else {
MutableDouble shortestSoFar = new MutableDouble(Double.MAX_VALUE);
dijkstraExpander = new DijkstraPathExpander(expander, shortestSoFar, epsilon, interest.stopAfterLowestCost());
dijkstraEvaluator = new DijkstraEvaluator(shortestSoFar, end, costEvaluator);
}
lastTraverser = new MonoDirectionalTraversalDescription().uniqueness(Uniqueness.NODE_PATH).expand(dijkstraExpander, stateFactory).order(new DijkstraSelectorFactory(interest, costEvaluator)).evaluator(dijkstraEvaluator).traverse(start);
return lastTraverser;
}
use of org.neo4j.kernel.impl.traversal.MonoDirectionalTraversalDescription in project neo4j by neo4j.
the class TestBestFirstSelectorFactory method shouldDoWholeTraversalInCorrectOrder.
@Test
public void shouldDoWholeTraversalInCorrectOrder() {
Node a = graph.getNode("a");
Traverser traverser = new MonoDirectionalTraversalDescription().expand(expander).order(factory).uniqueness(uniqueness).traverse(a);
ResourceIterator<Path> iterator = traverser.iterator();
int i = 0;
while (iterator.hasNext()) {
assertPath(iterator.next(), expectedResult[i]);
i++;
}
assertEquals(String.format("Not all expected paths where traversed. Missing paths are %s\n", Arrays.toString(Arrays.copyOfRange(expectedResult, i, expectedResult.length))), expectedResult.length, i);
}
use of org.neo4j.kernel.impl.traversal.MonoDirectionalTraversalDescription in project neo4j by neo4j.
the class TraversalDescriptionBuilder method from.
public TraversalDescription from(Map<String, Object> description) {
try {
TraversalDescription result = new MonoDirectionalTraversalDescription();
result = describeOrder(result, description);
result = describeUniqueness(result, description);
result = describeExpander(result, description);
result = describePruneEvaluator(result, description);
result = describeReturnFilter(result, description);
return result;
} catch (NoClassDefFoundError e) {
// the backported javax.script jar file(s) on the classpath.
throw new EvaluationException(e);
}
}
Aggregations