Please do b 1. [Single-Source Shortest Path, 20 Points] a. Graph G represents a
ID: 3716495 • Letter: P
Question
Please do b
1. [Single-Source Shortest Path, 20 Points] a. Graph G represents a computer network, where vertices represent switches and edges represent communication lines joining pairs of switches. Each edge has an associated bandwidth. The bandwidth of a path is defined as the bandwidth of the lowest bandwidth edge in the path. Give an algorithm that, given a graph and two switches a and b, outputs the maximum bandwidth of a path between a and b. What is the runtime of your algorithm?
b. G(V,E) is a weighted, directed graph with no negative-weight cycles. We define m as the maximum number of edges on any shortest path from the source s to a destination v. Describe a modification to the Bellman-Ford algorithm that allows it to terminate in m+1 passes, even if m is not known in advance.
Explanation / Answer
Solution:
The changes will be:
Correctness:
The above step will find and terminate the Bellman ford in m+1 steps because we are already following the shortest path in Bellman ford which means m edges will be traversed on the path, all we need to make sure is that when the vertex v is encountered and then terminate after updating the shortest path.
I hope this helps if you find any problem. Please comment below. Don't forget to give a thumbs up if you liked it. :)