Dijkstra's Algorithm

114 Views Asked by At

I have been practicing different routing exercises and came upon a Dijkstra question which I am unable to decide how to proceed.

Image Here

My question is which node do i pick first? Since the path is the same: $u-w= 6 $ and $u-x =6.$

Any solutions are appreciated.

Edit: Solution provided by a colleague of mine. Is this the way to go?

Solution

1

There are 1 best solutions below

1
On

The first chosen edge doesn't matter -- no matter which one is picked, the other one is picked immediately afterwards. However, if order is really really important to you, you could just assert alphabetical ordering -- tiebreaks happen by alphabetical order.