forked from graphhopper/graphhopper
-
Notifications
You must be signed in to change notification settings - Fork 1
Low Level API
karussell edited this page Feb 16, 2013
·
6 revisions
// Creating and saving the graph
GraphBuilder gb = new GraphBuilder().location("some-folder").store(true);
GraphStorage graph = gb.create();
// Make a weighted edge between two nodes. False means the edge is directed.
graph.edge(fromId, toId, cost, false);
// Store to disc
graph.flush();
// Loading and using the graph
GraphStorage graph = gb.load();
Path path = new DijkstraSimple().calcPath(fromId, toId);
// Creating and saving the graph
GraphBuilder gb = new GraphBuilder().location("some-folder").store(true).levelGraph(true);
GraphStorage graph = gb.create();
// Make a weighted edge between two nodes. False means the edge is directed.
graph.edge(fromId, toId, cost, false);
// Prepare the graph for fast querying ...
new PrepareContractionHierarchies().graph(graph).doWork();
graph.flush();
// Loading and using the graph
GraphStorage graph = gb.load();
algorithm = new PrepareContractionHierarchies().graph(graph).createAlgo();
Path path = algorithm.calcPath(fromId, toId);