1

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!!!

grooot
  • 446
  • 2
  • 10
  • 31
  • this looks more similar to [widest path](https://en.wikipedia.org/wiki/Widest_path_problem), except, as pointed out by Yevgeniy, it should use max instead of min. – Marat Dec 22 '21 at 17:38

1 Answers1

2

On 7th line instead of

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

you just should put

cost = Max(D[i, k], D[k, j])
Yevgeniy Kosmak
  • 3,561
  • 2
  • 10
  • 26