Reputation: 81
Let 𝐺 = (𝑉, 𝐸) be a directed graph with edge weights and let 𝑠 be a vertex of 𝑉. All of the edge weights are integers between 1 and 20. Design an algorithm for finding the shortest paths from 𝑠. The running time of your algorithm should be asymptotically faster than Dijkstra’s running time.
I know that Dijkstra’s running time is O( e + v log v), and try to find a faster algorithm.
If all weights are 1 or only include 0 and 1, I can use BFS O(e+v) in a directed graph, but how to make a faster algorithm for edge weights are integers between 1 and 20.
Upvotes: 5
Views: 216
Reputation: 2777
i.e.
This gets transformed to this:
Upvotes: 5