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 : Shortest Paths and Negative Edges.
We discussed in class that Dijkstra's algorithm requires all the edge weights to be nonnegative 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 wmin which will be negative and then adding leftwmin right to all the edge weights. This would make all the weights nonnegative. 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.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
