edited by
142 views
3 votes
3 votes

Suppose we run Dijkstra’s single source shortest-path algorithm on the following edge weighted directed graph with vertex $a$ as the source. In what order do the nodes get included into the set of vertices for which the shortest path distances are finalized? (Assume that whenever there is a tie the vertex whose weight got finalized first is chosen first)


 

  1. $a,b,c,h,g,e,d,f$
  2. $a,b,g,h,c,f,e,d$
  3. $a,b,g,c,h,e,d,f$
  4. $a,b,c,h,g,f,e,d$
edited by

1 Answer

Best answer
1 votes
1 votes
$a$

Next smallest distance $b – 4$

New distances: $ g-8, c-12$

Next smallest distance $g-8$

New distances: $c-12, h-9$

Next smallest distance: $h-9$

New distances: $f-15, c-11$

Next smallest distance: $c-11$

New distances: $e-15, d-18, f-15$

Next smallest distance: $f-15$ ($f$ got finalized before $e)$

No more changes,

$a,b,g,h,c,f,e,d$ is the correct order as visited by the Dijikstra's algorithm.

Correct option: B.
selected by
Answer:

Related questions

5 votes
5 votes
1 answer
3
gatecse asked Sep 7, 2020
284 views
Which of the following algorithm can be used to efficiently calculate single source shortest paths in a Directed Acyclic Graph where all edge weights are equal?Dijkstra's...
4 votes
4 votes
1 answer
4