Question: Question 5 : Shortest Paths and Negative Edges. We discussed in class that Dijkstra's algorithm requires all the edge weights to be non - negative

Question 5: Shortest Paths and Negative Edges.
We discussed in class that Dijkstra's algorithm requires all the edge weights to be non-negative in order to work. A student suggests a simple fix. Given a graph \( G \) with some negative weight edges, he suggests computing the least weight \( w_{\min }\)(which will be negative), and then adding \(\left|w_{\min }\right|\) to all the edge weights. This would make all the weights non-negative. He claims that the shortest path in this new graph also yields the shortest path in \( G \)("because the weights are just shifted", he says..).
Is there something wrong in the reasoning above? Explain with an example.
Question 5 : Shortest Paths and Negative Edges.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!