Question: Negative cost edges. Suppose that we have a graph with negative cost edges, but no negative cost cycles. Does the following algorithm work to find
Negative cost edges.
Suppose that we have a graph with negative cost edges, but no negative cost cycles. Does the following algorithm work to find the shortest path?
First find the edge with the most negative weight. Call this weight W. Modify the original graph G by adding W to every edge's weight. Call the new graph G'. Since there are no negative weight edges in G', we can use Dijkstra's algorithm on G' and report the shortest path found as the shortest path in G. Explain whether this algorithm works or does not work
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
