Search in sources :

Example 1 with AlternativeBidirSearch

use of com.graphhopper.routing.AlternativeRoute.AlternativeBidirSearch in project graphhopper by graphhopper.

the class AlternativeRouteTest method testDisconnectedAreas.

@Test
public void testDisconnectedAreas() {
    Graph g = createTestGraph(true, em);
    // one single disconnected node
    updateDistancesFor(g, 20, 0.00, -0.01);
    Weighting weighting = new FastestWeighting(carFE);
    AlternativeBidirSearch altDijkstra = new AlternativeBidirSearch(g, weighting, traversalMode, 1);
    Path path = altDijkstra.calcPath(1, 20);
    assertFalse(path.isFound());
    // make sure not the full graph is traversed!
    assertEquals(3, altDijkstra.getVisitedNodes());
}
Also used : AlternativeBidirSearch(com.graphhopper.routing.AlternativeRoute.AlternativeBidirSearch) Graph(com.graphhopper.storage.Graph) FastestWeighting(com.graphhopper.routing.weighting.FastestWeighting) Weighting(com.graphhopper.routing.weighting.Weighting) FastestWeighting(com.graphhopper.routing.weighting.FastestWeighting) Test(org.junit.Test)

Example 2 with AlternativeBidirSearch

use of com.graphhopper.routing.AlternativeRoute.AlternativeBidirSearch in project graphhopper by graphhopper.

the class AlternativeRouteTest method testDisconnectedAreas.

@ParameterizedTest
@ArgumentsSource(FixtureProvider.class)
public void testDisconnectedAreas(Fixture p) {
    initTestGraph(p.graph, p.carFE);
    // one single disconnected node
    updateDistancesFor(p.graph, 20, 0.00, -0.01);
    AlternativeBidirSearch altDijkstra = new AlternativeBidirSearch(p.graph, p.weighting, p.traversalMode, 1);
    Path path = altDijkstra.calcPath(1, 20);
    assertFalse(path.isFound());
    // make sure not the full graph is traversed!
    assertEquals(3, altDijkstra.getVisitedNodes());
}
Also used : AlternativeBidirSearch(com.graphhopper.routing.AlternativeRoute.AlternativeBidirSearch) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) ArgumentsSource(org.junit.jupiter.params.provider.ArgumentsSource)

Aggregations

AlternativeBidirSearch (com.graphhopper.routing.AlternativeRoute.AlternativeBidirSearch)2 FastestWeighting (com.graphhopper.routing.weighting.FastestWeighting)1 Weighting (com.graphhopper.routing.weighting.Weighting)1 Graph (com.graphhopper.storage.Graph)1 Test (org.junit.Test)1 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)1 ArgumentsSource (org.junit.jupiter.params.provider.ArgumentsSource)1