@Test public void testMaxVisitedNodes() { GraphHopperStorage graph = createGHStorage(false); initBiGraph(graph); RoutingAlgorithm algo = createAlgo(graph); Path p = algo.calcPath(0, 4); assertTrue(p.isFound()); algo = createAlgo(graph); algo.setMaxVisitedNodes(3); p = algo.calcPath(0, 4); assertFalse(p.isFound()); }
@Test public void testWithBorderBlocking() { AbstractRoutingAlgorithmTester.initBiGraph(ghStorage);
@Test public void testViaEdges_BiGraph() { GraphHopperStorage graph = createGHStorage(false); initBiGraph(graph); // 0-7 to 4-3 Path p = calcPathViaQuery(graph, 0.0009, 0, 0.001, 0.001105); assertEquals(p.toString(), IntArrayList.from(new int[]{10, 7, 6, 8, 3, 9}), p.calcNodes()); assertEquals(p.toString(), 324.11, p.getDistance(), 0.01); // 0-1 to 2-3 p = calcPathViaQuery(graph, 0.001, 0.0001, 0.010, 0.0011); assertEquals(p.toString(), IntArrayList.from(new int[]{0, 7, 6, 8, 3, 9}), p.calcNodes()); assertEquals(p.toString(), 1335.35, p.getDistance(), 0.01); }
@Test public void testBidirectional() { GraphHopperStorage graph = createGHStorage(false); initBiGraph(graph); // PrepareTowerNodesShortcutsTest.printEdges((CHGraph) graph); Path p = createAlgo(graph).calcPath(0, 4); // PrepareTowerNodesShortcutsTest.printEdges((CHGraph) graph); assertEquals(p.toString(), IntArrayList.from(new int[]{0, 7, 6, 8, 3, 4}), p.calcNodes()); assertEquals(p.toString(), 335.8, p.getDistance(), .1); p = createAlgo(graph).calcPath(1, 2); // the other way around is even larger as 0-1 is already 11008.452 assertEquals(p.toString(), IntArrayList.from(new int[]{1, 2}), p.calcNodes()); assertEquals(p.toString(), 10007.7, p.getDistance(), .1); }