use of org.neo4j.graphalgo.impl.shortestpath.Dijkstra in project neo4j by neo4j.
the class DijkstraMultiplePathsTest method test6.
@Test
void test6() {
try (Transaction transaction = graphDb.beginTx()) {
graph.makeEdgeChain(transaction, "a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,z", "cost", (double) 1);
graph.makeEdge(transaction, "a", "b2", "cost", (double) 4);
graph.makeEdge(transaction, "b2", "c", "cost", -2);
Dijkstra<Double> dijkstra = new Dijkstra<>(0.0, graph.getNode(transaction, "a"), graph.getNode(transaction, "z"), CommonEvaluators.doubleCostEvaluator("cost"), new DoubleAdder(), Double::compareTo, Direction.OUTGOING, MyRelTypes.R1);
List<List<Node>> paths = dijkstra.getPathsAsNodes();
assertEquals(2, paths.size());
transaction.commit();
}
}
Aggregations