modify current algorithm - APSP

64 Views Asked by At

I have the below APSP algorithm:

enter image description here

This computes the shortest path. The length of the path is the sum of weights of edges of path.

How can i modify the above algorithm in order to compute the shortest path where length is the weight of the heaviest edge on this path.

Any help would be great!!!

1

There are 1 best solutions below

0
Yevgeniy Kosmak On BEST ANSWER

On 7th line instead of

cost = D[i, k] + D[k, j]

you just should put

cost = Max(D[i, k], D[k, j])