retagged by
1,971 views

7 Answers

Best answer
4 votes
4 votes
if path of 15 is there

then it will be considered as shortest path..dikjstra algo wont update it..updation takes place only when distance is less than current distance

coming to second que

if path of 15 is not there

then  path 2-13 choosen or 2-10-3 will be choosen...

say 2-13 edge vertices are labelled as CD

and on 2-10-3 vertices are labelled as EF

(assuming alphabetic order while processing ie removind C first from priority,2-13 path will choosen)
selected by
2 votes
2 votes
Final Answer

A) 15
B) 2 10 13
1 votes
1 votes

Here all paths from A to B are of 15 weight.  But when dijkshtra's algo run,

it should give path  A --- B (direct edge).


Why only this path ?

Ans:  when we run dijikshtra, taking A as source, in first iteration we are able

         to reach B(but we are not selecting this in 1st Iteration, just updating the

        distance to B) i.e. a direct edge from A to B.

          so, it will only be updated when we get some shorter path, but it is not the case.
edited by

Related questions

2 votes
2 votes
1 answer
2
6 votes
6 votes
1 answer
3
vaishali jhalani asked Nov 5, 2016
3,030 views
What is the time complexity of Dijkstra’s algorithm if it is implemented using AVL Tree instead of Priority Queue over a graph G = (V, E)?
1 votes
1 votes
1 answer
4
Souvik33 asked Dec 19, 2022
697 views
If a -ve weight cycle is reachable from source, the Dijkstra's algorithm gets into an infinite loop TRUEFALSE