[GraphHopper] getting the list of sorted shortest path

Peter K peathal at yahoo.de
Fri Jul 19 08:54:15 UTC 2013


Returning such a list isn't that easy. How do you define "second
shortest" path etc? At least several routes won't makes sense - you'll
get routes with senseless detours in it etc

> Could a trick like changing the weight of an edge and redo the query
could do the trick?

Not sure. Changing edge weights in the contracted graph is not that easy.

What you could do is to listen for new events under algo.updateShortest
(or algo.checkFinishCondition) and collect the found paths (and sort them):
https://github.com/graphhopper/graphhopper/blob/19310dc5a3f0b65df687d8157c2901b1fe115b4e/core/src/main/java/com/graphhopper/routing/DijkstraBidirectionRef.java#L185

Regards,
Peter.

> thanks Peter,
>
> is it because it is not implemented or because it's a core restriction
> from contraction hierarchies?
> Could a trick like changing the weight of an edge and redo the query
> could do the trick?
>
>
> On Fri, Jul 19, 2013 at 10:30 AM, Peter K <peathal at yahoo.de
> <mailto:peathal at yahoo.de>> wrote:
>
>     Hi Alexandre,
>
>     >1) So first, am i doing things right? I had to define a bijection
>     because my vertices have id starting from 300000 and it seems that
>     graphhopper creates all the intermediary vertices.
>
>     Look good to me. Is everything working? Would be nice to have suche a
>     snippet as a gist or in the wiki. Yes, graph and edge ids are starting
>     from 0
>
>     > 2) Second, how would it be possible to retrieve a list (or even a
>     > stream) of the shortest paths between two nodes: the first being the
>     > shortest, second shortest etc...
>
>     It is not possible yet to get such a list with graphhopper. See this
>     question: http://stackoverflow.com/q/12773525/194609
>
>     Regards,
>     Peter.
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/graphhopper/attachments/20130719/a9dc1dc2/attachment.html>


More information about the GraphHopper mailing list