Dijkstra’s algorithm / path is this done correctly?

220 Views Asked by At

im doing this assignment and it seems as if my teacher has made a mistake.

according to me in order to find the minimum spanning treee from a-z , you start from a and then go to :

a,f,d,c,b,e,z,g however my teacher wrote in the facit that it is a,f,d,c,b,e,g,z i just cant see how that is possible. to go from e,g,z ?

My version:

My version

original enter image description here

1

There are 1 best solutions below

0
On

This notation probably is the sequence, in which nodes are visited. Not the resulting minimal path. Always the node with the least distance gets picked next. In the state, where e, g and z are not yet picked, their respective distance is 8, 10 and 13. So e is picked, z updated to 12 and g remains. Since 10 is lower than 12, g needs to be considered before z.