If you are allowed to precompute linear in |V|
amount of data on graph then there are a family of algorithms which have sublinear query times for shortest paths in a graph.
Some of them are used in Bing Maps for extremely fast shortest routes calculations.
The basic idea is to precompute for each vertex forward labels L_f(v)
and backward labels L_b(v)
which poses a cover property. Each label is a pair of a vertex and the distance to it, e.g. L_f(v) = { (u, dist(v, u)) }
and L_r(v) = { (u, dist(u, v)) }
. And the cover property asserts that for any vertices s and t L_f(s)
'Union' L_r(t)
contains at least one vertex on the shortest path from s to t.
Is there an open source implementation of one of those algorithms (C++, C#, F#, D, Go, Java)?
Bellman-Ford algorithm is used to find all pairs shortest distances in a graph and it is dynamic programming technique.
Dijkstra's algorithm is one of the most popular algorithms for solving many single-source shortest path problems having non-negative edge weight in the graphs i.e., it is to find the shortest distance between two vertices on a graph.
The single-source shortest-path problem requires that we find the shortest path from a single vertex to all other vertices in a graph. The all-pairs shortest-path problem requires that we find the shortest path between all pairs of vertices in a graph.
I have not found any code that implements those algorithms but you could look at the Karlsruhe homepage where you can find code for Contraction Hierarchies, which form the basis of the (original) Hub Labeling. You could use that to create your own implementation of HL but you should know they filed a patent for it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With