Consider the following greedy strategy for finding a shortest path from
vertexstartto vertexgoalin a given connected graph.
1: Initializepathtostart.
2: Initialize setvisitedto {start}.
3: Ifstart=goal, returnpathand exit. Otherwise, continue.
4: Find the edge (start,v) of minimum weight such thatvis adjacent to
startandvis not invisited.
5: Addvtopath.
6: Addvtovisited.
7: Setstartequal tovand go to step 3.
Does this greedy strategy always find a shortest path fromstarttogoal?
Either explain intuitively why it works, or give a counterexample.
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here