Question: Problem 2. (a) Give an example of a weighted directed graph G with negative-weight edges, but no negative-weight cycle, such that Dijkstra's algorithm incorrectly computes

Problem 2. (a) Give an example of a weighted directed graph G with negative-weight edges, but no negative-weight cycle, such that Dijkstra's algorithm incorrectly computes the shortest-path distances from some vertex v. Trace the execution of Dijkstra's algorithm to show where it goes awry. (b) Consider the following greedy strategy for finding a shortest path from vertex start to vertex goal in a given connected graph. 1. Initialize path to start 2. InitializeVisited Vertices to start 3. If start-goal, return path and erit. Otherwise, continue 4. Find the edge (start,v) of minimum weight such that v is adjacent to start and v is not in Visited Vertices 5. Add v to path. 6. Add v to Visited Vertices. 7. Set start equal to v and go to step 3. Does this greedy strategy always find a shortest path from start to goal? Either explain intitively why it works, or give a counter-example
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
