[GraphHopper] Graph construction

Peter K peathal at yahoo.de
Wed May 29 16:09:16 UTC 2013


Hi Thomas,

> For each test I use a new GraphStorage instance but it seems that the
graph from the first test is reused/loaded

Hmmh, that is strange as you would need to explicitely load the graph
and you have to enable 'store':
GraphStorage graph = new GraphBuilder().store(true).create();
Or if you would use mmap I could explain the behaviour.

Would you mind to post the unit tests? The best would be to reduce them
to the minimal code required to reproduce your issue.

> And is it possible to reassign an edge? So I can insert new nodes
between existing ones.

you cannot delete edges at the moment. But adding new one or overwriting
properties is possible.

Regards,
Peter.

> 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
>
>
>
> _______________________________________________
> GraphHopper mailing list
> GraphHopper at openstreetmap.org
> http://lists.openstreetmap.org/listinfo/graphhopper
>


-- 
GraphHopper.com Your way is our destination!




More information about the GraphHopper mailing list