How do we know that Dijkstra's algorithm is the best single-source shortest paths algorithm?

223 views Asked by At

I know how Dijkstra's algorithm works and that it can be made to run in time O(m + n log n) time. How do we know that there isn't a better algorithm for single-source shortest paths than this?

1

There are 1 answers

0
templatetypedef On

Dijkstra's algorithm isn't actually necessarily the fastest algorithm for computing single-source shortest paths in a graph. For example, if you know that all the edges have integer weights and assume that a machine word is large enough to hold any of those integers, then you can use an algorithm developed by Thorup that runs in time O(m + n), which is asymptotically faster than Dijkstra's algorithm. If the edges are unweighted, or if they all have the same weight, then a simple BFS does this in time O(m + n).