Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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):
v={s,u,t};
E={su:3,
st:2,
ut:-2}
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 -v,
(b) add v to the cost of every edge, so that each edge is non-negative, 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 source-target 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* source-target paths have the same number of edges.
Please also explain the order when the node get popped.
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions