Question: All Pairs Shortest Path: Given a weighted directed graph G = (V, E, w), where V = {1, 2, 3, 4, 5, 6), E

All Pairs Shortest Path: Given a weighted directed graph G = (V,

 

All Pairs Shortest Path: Given a weighted directed graph G = (V, E, w), where V = {1, 2, 3, 4, 5, 6), E = {(1,5), (2,1), (2,4), (3,2), (3,6), (4,1), (4,5), (5,2), (6,2), (6,3)}, and w(1,5) = -2, w(2,1) = 1, w(2,4)= 2, w(3,2)= 4, w(3,6)= -6, w(4,1)= -3, w(4,5) = 3, w(5,2) = 5, w(6,2)=-4, w(6,3) = 6. (1) Represent the graph G graphically; (2) Run SLOW-ALL-PAIRS-SHORTEST-PATHS on the above graph and show the matrices L(k) that result for each iteration of the loop; (3) Run the Floyd-Warshall algorithm on the above graph to compute all pairs shortest paths and show the matrices D(k) that result for each iteration of the outer loop; (4) Run Johnson's algorithm on the above graph to compute all pairs shortest paths and show the values of h and computed by the algorithm.

Step by Step Solution

3.33 Rating (156 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

1 Graph Representation The graph G can be represented as follows Vertices 1 2 3 4 5 6 Edges 1 5 2 1 2 4 3 2 3 6 4 1 4 5 5 2 6 2 6 3 Weights w1 5 2 w2 1 1 w2 4 2 w3 2 4 w3 6 6 w4 1 3 w4 5 3 w5 2 5 w6 2 ... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Algorithms Questions!