Overview
How does the shortest path calculation work?
A number of steps are performend before the shortest path from node a to node b is determined:
First, the algorithm checks whether the two node IDs specified exist in the graph at all.
Nodes and edges that do not pass the user's routing conditions are then removed (
graph.removeNodes()
andgraph.removeEdges()
).The distances between adjacent nodes are now determined and the graph is converted into a format that is performant for routing (if user did not use a production-ready build).
Then, after the previous removal of nodes and edges, the algorithm checks again whether the nodes are still present.
Once the graph is "cleaned up" and the start and end nodes are present...
...the shortest path is determined using the Dijkstra algorithm.
If a path is found, turn-by-turn navigation instructions are created last.
Last updated