Answered step by step
Verified Expert Solution
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:
;
:
:
:
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
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