Problem. You are given an undirected graph G = (V,E) in which the edge weights are highly restricted.
In particular, each edge has a positive integer weight of either {1, 2, . . . ,W}, where W is a constant (independent of the number of edges or vertices). Show that it is possible to compute the single- source shortest paths in such a graph in O(n + m) time, where n = |V | and m = |E|. (Hint: Because W is a constant, a running time of O(W(n + m)) is as good as O(n + m).)
Requirement: algorithm running time needs to be in DIJKstra's running time or better.