[GraphHopper] Graph construction
Thomas Bürli
tbuerli at student.ethz.ch
Wed May 29 14:47:32 UTC 2013
Hi
I have some problems generating my own graph. I have two equal tests
which checks if the graph have the correct number of nodes. The first
test passes with the right number but the second one has twice as much
nodes. For each test I use a new GraphStorage instance but it seems that
the graph from the first test is reused/loaded and I don't know why.
Do I need to delete the graph or is there some kind of close/clean-up
function?
Here is the code how I generate a simple path graph.
GraphStorage graph = new GraphBuilder().create();
for (Node node : nodes) {
graph.setNode(node.getId(), latitude, longitude);
if (previousNode) {
graph.edge(previousNode.getId(), node.getId(), node.getTime() -
previousNode.getTime(), false);
}
previousNode = node;
}
And is it possible to reassign an edge? So I can insert new nodes
between existing ones.
Thanks
Thomas
More information about the GraphHopper
mailing list