Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Problem 3. Dijkstra's Algorithm (a) Weiss, problem 9.5(a) (the problem is the same in the second and third editions). Use Dijkstra's algorithm and show the
Problem 3. Dijkstra's Algorithm (a) Weiss, problem 9.5(a) (the problem is the same in the second and third editions). Use Dijkstra's algorithm and show the results of the algorithm in the form used in lecture _a table showing for each vertex its best-known distance from the starting vertex and its predecessor vertex on the path. You can use a single table and cross-out/add values as you progress. Also write and circle the order in which the vertices are marked as visited. (b) If there is more than one minimum cost path from v to w, will Dijkstra's algorithm always find the path with the fewest edges? If not, explain in a few sentences how to modify Dijkstra's algorithm so that if there is more than one minimum path from v to w, a path with the fewest edges is chosen. (c) Give an example where Dijkstra's algorithm gives the wrong answer in the presence of a negative-cost edge but no negative-cost cycles. Explain briefly why Dijkstra's algorithm fails on your example. (d) Suppose you are given a graph that has negative-cost edges but no negative-cost cycles. Consider the following strategy to find shortest paths in this graph: uniformly add a constant k to the cost of every edge, so that all costs become non-negative, then run Dijkstra's algorithm and return that result with the edge costs reverted back to their original values (i.e., with k subtracted). Give an example where this technique fails and explain why it does so. (Hint: one simple example uses only three vertices.) Also, give a general explanation as to why this technique does not work
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started