congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
PrepareContractionHierarchies.createAlgo
Code IndexAdd Tabnine to your IDE (free)

How to use
createAlgo
method
in
com.graphhopper.routing.ch.PrepareContractionHierarchies

Best Java code snippets using com.graphhopper.routing.ch.PrepareContractionHierarchies.createAlgo (Showing top 8 results out of 315)

origin: graphhopper/graphhopper

  private RoutingAlgorithm createCHAlgo(GraphHopperStorage graph, CHGraph chGraph, boolean withSOD, AlgorithmOptions algorithmOptions) {
    PrepareContractionHierarchies ch = new PrepareContractionHierarchies(
        chGraph, algorithmOptions.getWeighting(), TraversalMode.NODE_BASED);
    if (!withSOD) {
      algorithmOptions.getHints().put("stall_on_demand", false);
    }
    return ch.createAlgo(chGraph, algorithmOptions);
  }
}
origin: graphhopper/graphhopper

void checkPath(GraphHopperStorage g, Weighting w, int expShortcuts, double expDistance, IntIndexedContainer expNodes) {
  CHGraph lg = g.getGraph(CHGraph.class, w);
  PrepareContractionHierarchies prepare = createPrepareContractionHierarchies(g, lg, w);
  prepare.doWork();
  assertEquals(w.toString(), expShortcuts, prepare.getShortcuts());
  RoutingAlgorithm algo = prepare.createAlgo(lg, new AlgorithmOptions(DIJKSTRA_BI, w, tMode));
  Path p = algo.calcPath(3, 12);
  assertEquals(w.toString(), expDistance, p.getDistance(), 1e-5);
  assertEquals(w.toString(), expNodes, p.calcNodes());
}
origin: graphhopper/graphhopper

@Test
public void testUnpackingOrder() {
  GraphHopperStorage g = createGHStorage();
  CHGraph lg = g.getGraph(CHGraph.class);
  initUnpackingGraph(g, lg, weighting);
  PrepareContractionHierarchies prepare = createPrepareContractionHierarchies(g, lg);
  RoutingAlgorithm algo = prepare.createAlgo(lg, new AlgorithmOptions(DIJKSTRA_BI, weighting, tMode));
  Path p = algo.calcPath(10, 6);
  assertEquals(7, p.getDistance(), 1e-5);
  assertEquals(IntArrayList.from(10, 0, 1, 2, 3, 4, 5, 6), p.calcNodes());
}
origin: graphhopper/graphhopper

@Test
public void testUnpackingOrder_Fastest() {
  GraphHopperStorage g = createGHStorage();
  CHGraph lg = g.getGraph(CHGraph.class);
  Weighting w = new FastestWeighting(carEncoder);
  initUnpackingGraph(g, lg, w);
  PrepareContractionHierarchies prepare = createPrepareContractionHierarchies(g, lg);
  RoutingAlgorithm algo = prepare.createAlgo(lg, new AlgorithmOptions(DIJKSTRA_BI, weighting, tMode));
  Path p = algo.calcPath(10, 6);
  assertEquals(7, p.getDistance(), 1e-1);
  assertEquals(IntArrayList.from(10, 0, 1, 2, 3, 4, 5, 6), p.calcNodes());
}
origin: graphhopper/graphhopper

@Test
public void testRoundaboutUnpacking() {
  GraphHopperStorage g = createGHStorage();
  CHGraph lg = g.getGraph(CHGraph.class);
  initRoundaboutGraph(g);
  int oldCount = g.getAllEdges().length();
  PrepareContractionHierarchies prepare = createPrepareContractionHierarchies(g, lg);
  prepare.doWork();
  assertEquals(oldCount, g.getEdges());
  assertEquals(oldCount + 23, lg.getEdges());
  RoutingAlgorithm algo = prepare.createAlgo(lg, new AlgorithmOptions(DIJKSTRA_BI, weighting, tMode));
  Path p = algo.calcPath(4, 7);
  assertEquals(IntArrayList.from(4, 5, 6, 7), p.calcNodes());
}
origin: graphhopper/graphhopper

@Test
public void testDirectedGraph2() {
  GraphHopperStorage g = createGHStorage();
  CHGraph lg = g.getGraph(CHGraph.class);
  initDirected2(g);
  int oldCount = GHUtility.count(g.getAllEdges());
  assertEquals(19, oldCount);
  PrepareContractionHierarchies prepare = createPrepareContractionHierarchies(g, lg);
  prepare.doWork();
  // PrepareTowerNodesShortcutsTest.printEdges(g);
  assertEquals(oldCount, g.getAllEdges().length());
  assertEquals(oldCount, GHUtility.count(g.getAllEdges()));
  long numShortcuts = 9;
  assertEquals(numShortcuts, prepare.getShortcuts());
  assertEquals(oldCount + numShortcuts, lg.getEdges());
  assertEquals(oldCount + numShortcuts, GHUtility.count(lg.getAllEdges()));
  RoutingAlgorithm algo = prepare.createAlgo(lg, new AlgorithmOptions(DIJKSTRA_BI, weighting, tMode));
  Path p = algo.calcPath(0, 10);
  assertEquals(10, p.getDistance(), 1e-6);
  assertEquals(IntArrayList.from(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10), p.calcNodes());
}
origin: graphhopper/graphhopper

@Test
public void testDirectedGraph() {
  GraphHopperStorage g = createGHStorage();
  CHGraph lg = g.getGraph(CHGraph.class);
  g.edge(5, 4, 3, false);
  g.edge(4, 5, 10, false);
  g.edge(2, 4, 1, false);
  g.edge(5, 2, 1, false);
  g.edge(3, 5, 1, false);
  g.edge(4, 3, 1, false);
  g.freeze();
  int oldCount = GHUtility.count(lg.getAllEdges());
  assertEquals(6, oldCount);
  PrepareContractionHierarchies prepare = createPrepareContractionHierarchies(g, lg);
  prepare.doWork();
  assertEquals(2, prepare.getShortcuts());
  assertEquals(oldCount + 2, GHUtility.count(lg.getAllEdges()));
  RoutingAlgorithm algo = prepare.createAlgo(lg, new AlgorithmOptions(DIJKSTRA_BI, weighting, tMode));
  Path p = algo.calcPath(4, 2);
  assertEquals(3, p.getDistance(), 1e-6);
  assertEquals(IntArrayList.from(4, 3, 5, 2), p.calcNodes());
}
origin: graphhopper/graphhopper

Path p = new PrepareContractionHierarchies(
    g2, weighting, TraversalMode.NODE_BASED).
    createAlgo(g2, opts).calcPath(0, 7);
com.graphhopper.routing.chPrepareContractionHierarchiescreateAlgo

Popular methods of PrepareContractionHierarchies

  • getWeighting
  • <init>
  • doWork
  • calculatePriority
    Calculates the priority of adjNode v without changing the graph. Warning: the calculated priority mu
  • close
  • contractNodes
  • getTimesAsString
  • initFromGraph
  • prepareNodes
  • addShortcuts
    Introduces the necessary shortcuts for adjNode v in the graph.
  • findShortcuts
    Finds shortcuts, does not change the underlying graph.
  • fromGraphHopperStorage
  • findShortcuts,
  • fromGraphHopperStorage,
  • getCoords,
  • getOrigEdgeCount,
  • setLazyUpdates,
  • setLogMessages,
  • setNeighborUpdates,
  • setOrigEdgeCount,
  • setPeriodicUpdates,
  • createAStarBidirection

Popular in Java

  • Making http post requests using okhttp
  • getApplicationContext (Context)
  • scheduleAtFixedRate (ScheduledExecutorService)
  • getResourceAsStream (ClassLoader)
  • Point (java.awt)
    A point representing a location in (x,y) coordinate space, specified in integer precision.
  • PrintWriter (java.io)
    Wraps either an existing OutputStream or an existing Writerand provides convenience methods for prin
  • Map (java.util)
    A Map is a data structure consisting of a set of keys and values in which each key is mapped to a si
  • SSLHandshakeException (javax.net.ssl)
    The exception that is thrown when a handshake could not be completed successfully.
  • JComboBox (javax.swing)
  • Loader (org.hibernate.loader)
    Abstract superclass of object loading (and querying) strategies. This class implements useful common
  • Top PhpStorm plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now