Question: Give a DAG where Dijkstra fails. A: Example ( negative edge ) : v = { s , u , t } ; E =
Give a DAG where Dijkstra fails.
A: Example negative edge:
;
:
:
:
Dijkstra's algorithm doesn't work if there are negative weight edges.
One proposal for how to deal with this case is
a find the most negative edge, say with value
b add to the cost of every edge, so that each edge is nonnegative, and
c solve the shortest path algorithm in the resulting graph.
Does this work? If not, give a counterexample.
A: No; it only works if sourcetarget paths have the same number of edges.
See the example from the previous question.
Can you give me the example that this proposal works?
I dont quite understand what does it means it only works if all sourcetarget paths have the same number of edges.
Please also explain the order when the node get popped.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
