hiposfer / kamal

A routing engine service using Open Street Maps and GTFS as data source
GNU Lesser General Public License v3.0
11 stars 1 forks source link

allow repeating nodes on shortest path computation #53

Open carocad opened 7 years ago

carocad commented 7 years ago

Currently we use the classical DIjkstra algorithm for finding the shortest path between two nodes of a graph.

This approach works well as long as complicated turn restrictions are not allowed. In OpenTripPlanner they use something called the "Governance model" which apparently allows them to settle nodes more than once.

See last paragraph https://github.com/opentripplanner/OpenTripPlanner/wiki/GraphStructure

Turn restrictions are now handled by annotating edges to explicitly allow or disallow turns onto other edges for individual modes of travel. These restrictions are applied on the fly during the search. Note that due to turn restrictions, a shortest path can pass through an intersection more than once when a shortest path loops back on itself. This special case is handled in the state dominance function that determines when two states can coexist at a vertex.

Other references:

carocad commented 5 years ago

Turns out this is not a bug since the Dijkstra algorithm was never meant to contain loops