• retagged by
3,669 views

7 Answers

Best answer
4 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 2 votes
Final Answer

A) 15
B) 2 10 13
1 1 vote

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
0 0 votes

you have to give the information when there is a tie then which path do we take , old path remains or new path taken .

in case of old path remains then ans will be direct A to B (15 )

and if new path then  i think A => 2 => 13 =>  B or A => 6 => 7 => 2  => B

0 0 votes
The Ans is 15 Obviously (all distances are same).

But What will be the path ..... ??

See Using Initialize_single_source algo you will give source as 0 and others as infinity.

Now Run dijsktra Algo all vertices will be updates with the weights so B will be updated 15 irrrespective there are 2 ,6, and 5 path there are being changed to intermediates vertices

 And ultimately when you reach B from others path

you follow

 

d[v]>  d[u]+ w(u,v) (condition is strictly increasing)

 

but since d[v]=15 from A--->B edge so no other path was able to change it(due to strictly increasing path)
Position:
Show:

Related questions

3 3 votes
1 answers 1 answer
1.9k
1.9k views
PEKKA asked Dec 14, 2016
1,852 views
What will be the change is Time Complexity OF Dijikstra Algorithm If Following Data Structures are used ?Priority Queue : Binary Heap & Graph : MatrixPriority Queue : B...
2 2 votes
1 1 answer
4.1k
4.1k views
Hardik Maheshwari asked Jul 5, 2018
4,064 views
I read that the space complexity of Dijasktra is $O(V^2)$ . (http://igraph.wikidot.com/algorithm-space-time-complexity)But how ????
6 6 votes
1 answers 1 answer
3.8k
3.8k views
vaishali jhalani asked Nov 5, 2016
3,761 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)?