コード例 #1
0
 @Test
 public void testShortestPathLimit() {
   LevelGraph g = createExampleGraph();
   DijkstraOneToMany algo = new DijkstraOneToMany(g, carEncoder);
   algo.edgeFilter(new PrepareContractionHierarchies.LevelEdgeFilterCH(g).avoidNode(0));
   int endNode = algo.limit(2).findEndNode(4, 1);
   // did not reach endNode
   assertNotEquals(1, endNode);
 }
コード例 #2
0
 @Test
 public void testShortestPathSkipNode() {
   LevelGraph g = createExampleGraph();
   double normalDist = new Dijkstra(g, carEncoder).calcPath(4, 2).distance();
   DijkstraOneToMany algo = new DijkstraOneToMany(g, carEncoder);
   algo.edgeFilter(new PrepareContractionHierarchies.LevelEdgeFilterCH(g).avoidNode(3));
   int nodeEntry = algo.limit(100).findEndNode(4, 2);
   assertTrue(algo.weight(nodeEntry) > normalDist);
 }