Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Find the minimize maximum weights in weighted graph using dynamic programming

I'm looking for an algorithm that finds the path from two vertices say s to t, in a graph that has exactly k edges if paths exist.

And if multiple paths were found, the one with the minimum maximum weights of a single edge is preferred. (not the overall weights).

eg: say K = 5

Path 1: s - a - b - c - d - t with weights 1 - 1 - 1 - 10 - 1

the maximum weight of path 1 is 10

Path 2: s - x - y - z - w - t with weights 7 - 9 - 8 - 6 - 7

the maximum weight of path 2 is 9, so this is preferred.

How exactly do I solve this problem?

like image 476
Nick Avatar asked Sep 02 '26 13:09

Nick


1 Answers

You could use a modified version of the Floyd-Warshal algorithm that only iterates for K steps and forces the path lengths (by removing the min part)

like image 119
hugomg Avatar answered Sep 05 '26 08:09

hugomg



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!