Home > Net >  modify current algorithm - APSP
modify current algorithm - APSP

Time:12-27

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

CodePudding user response:

On 7th line instead of

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

you just should put

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