Skip to content
karussell edited this page Feb 16, 2013 · 6 revisions

Example Usage without Location2Index

// 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);
// Build the rest of the graph...
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);
Clone this wiki locally