Question: ( a ) Dijkstra's algorithm assumes that there are no negative weights ( and thus no negative weight cycles ) in the graph. However, if

(a) Dijkstra's algorithm assumes that there are no negative weights (and thus no negative weight cycles) in the graph. However, if we assume a graph has negative weights but no negative weight cycles, one possible modification for Dijkstra's algorithm is simply adjusting all the weights to make them positive using the following procedure:
Adjust the weights of all edges by a constant (dependent on the value of the most negative weight) such that all edge weights are positive
Run Dijkstra's algorithm to find shortest paths (which must exist since there are no negative weight cycles)
Subtract the constant from the edges in the final paths
Provide a simple counterexample to show this modification could produce incorrect results.
( a ) Dijkstra's algorithm assumes that there are

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