Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Consider Dijkstras algorithm: Initialization Same as MST-Prim, but also define a set S which is the complement of Q Computing loop while Q is nonempty

image text in transcribed

Consider Dijkstras algorithm:

Initialization

Same as MST-Prim, but also define a set S which is the complement of Q

Computing loop

while Q is nonempty

do u Extract-Min(Q)

S S image text in transcribed{u}

for each vimage text in transcribedAdj[u]

do Relax(u, v, w)

A) For the directed graph indicated by the sketch on the top, on exactly which iteration of the while loop is the shortest path distance from the top left vertex with the heavy line to the black vertex at location (5, 2)? Also, compute the shortest path distance to every vertex in the array.

(Assume that the sequence of arrows shown persists throughout all the vertices, and that each horizontal edge weight is set to exactly negative 2, each vertical edge weight is set to exactly 1, and each diagonal edge has weight 3. Break ties for Extract-Min lexicographically, for example, (2, 3) would come before (2, 5), if both had the same distance from the source estimate. We are asking at which point the estimate for the distance is the true minimum distance. This is different from asking at which iteration is the black node extracted. And, one last thing, you know that Dijkstras doesnt always work if there are negative weight edges in the graph. If it does work in this case, explain why. If is fails, show where.)

B)Now considering the same graph, but without the arrows, yet with the same edge weights. On which iteration of the while loop in Prims algorithm would the solid black vertex be extracted? Assume in the initialization that the upper left vertex is the root.

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

International Baccalaureate Computer Science HL And SL Option A Databases Part I Basic Concepts

Authors: H Sarah Shakibi PhD

1st Edition

1542457084, 978-1542457088

More Books

Students also viewed these Databases questions

Question

5. Understand how cultural values influence conflict behavior.

Answered: 1 week ago

Question

e. What do you know about your ethnic background?

Answered: 1 week ago