Shortest Path Algorithms. Routing Algorithms. Shortest path routing What is a shortest path? Minimum number of hops? Minimum distance? There is a weight associated with each link Weight can be a measure of congestion in the link, propagation delay etc.
Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.
Weight of path 1 = 2.5
Weight of path 2 = 3.0
and the list of vertices for whom the shortest path is known
the estimates are infinity for all vertices except the source vertex itself.
d(u) -> min(d(u), d(v) + w(v, u))
1. For every vertex v in V, d(v) =
2. d(s) = 0
3. Q = V
4. While Q is non-empty
(c ) Remove v from Q;
(d) For each vertex u in Adj(v)
d(u) -> min(d(u), d(v)) + w(v, u))
Since s is in S, and u is in Q, path p must jump from S to Q at some point.
Let the jump have end point x in S, and y in Q (possibly s = x, and u = y)
We will argue that y and u are different vertices
Since path p is the shortest path from s to u, the segment of path p between s and x, is the shortest path from s to x, and that between s and y is the shortest from s to y
Weight of the segment between s and y is d(x) + w(x, y)
Thus, p(s, y) = d(x) + w(x, y)
Also, d(y) <= d(x) + w(x, y) = p(s, y)
Follows that d(y) = p(s, y)
However, d(u) > p(s, u). So, u and y are different
Hence, d(y) = p(s, y) < p(s, u) < d(u)
Both y and u are in Q. So, u should not be chosen in this step
So, whenever a vertex u is inducted in S, d(y) = p(s, y).
Once d(u) equals p(s, u) for any vertex it can not change any further (d(u) can only decrease or remain same, and d(u) can not fall below p(s, u).
Since the algorithm terminates only when S= V, we are done!
Exercise: This computation gives shortest path weights only. Modify this algorithm to generate shortest paths as well!
2. d(s) = 0
3. For t=1 to V-1,
Let vertex y be its predecessor. Clearly p1 is a shortest path to y and it has k hops. So weight of path p1 is p(s, y)
We know the above holds for k = 0, as d(s) = p(s, s) = 0 at all times.
Let the above hold for 1,….,k. We will show that this holds for k + 1
So, by induction hypothesis, d(y) = p(s, y) after the kth iteration and at all subsequent times .
So by the estimate update procedure, d(u) <= d(y) + w(y, u) = p(s, y) + w(y, u) = weight of path p = p(s, u) after the k+1 th iteration and all subsequent times.
Again verify that as long as d(v) is finite, d(v) is length of some path to vertex v.
Hence d(u) >= p(s, u) always
Thus, d(u) = p(s, u), always after the k+1th iteration.