Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The Floyd-Warshall algorithm for computing all-pairs shortest paths computes a table of values dist(i, j, k), giving the length of the shortest path from i

The Floyd-Warshall algorithm for computing all-pairs shortest paths computes a table of values dist(i, j, k), giving the length of the shortest path from i to j that does not include any intermediate vertices numbered higher than k.

The pseudocode for the Floyd-Warshall algorithm:

image text in transcribed

Now refer to this graph:

image text in transcribed

(a) Give the value of dist(1, 5, 3) for the above graph.

(b) When the Floyd-Warshall algorithm computes the value of dist(1, 5, 4) which previously computed dist(i, j, k) table entries does it access?

for i=1 to n: for j l to : dist(i, j,0)=00 dist(i j. 0)ij) for i 1 to n: for all ij)EE for k=1 to n: for j l to n: dist(i, j. k)=min/dist[i, k k11+dist(k, j, k-1), dist(i, j, k-1))

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Design For Mere Mortals

Authors: Michael J Hernandez

4th Edition

978-0136788041

More Books

Students also viewed these Databases questions

Question

What does cross- referencing mean in the posting process?

Answered: 1 week ago