Question: Consider the following algorithm for computing the shortest path tree in a graph with negative edges. If there are no negative edges, just run Dijkstra's

Consider the following algorithm for computing the shortest path tree in a graph with negative edges. If there are no negative edges, just run Dijkstra's algorithm. If there are negative edges, find the smallest edge weight W and add - W to every edge weight in the graph. Now all the edges weights are positive, so use Dijkstra's algorithm. This algorithm does not work! Find an example input where it does not compute the correct
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
