I'm trying to understand the Dijkstra Algorithm for finding the shortest path.
I've came up to this example, where the top table corresponds to the image in the bottom left corner.
Now, my problem is that I don't understand the transition from step 1 to step 2:
When we are in UX we can travel to UXV by adding the cost of X to V (which is 2) to our current cost (which is 1; the cost of UX). So the sum would be 3, but since this I bigger then the 2 we already found we don't change it. In step 1 we have two options which both have the same cost; UXY and UXV, but why does the algorithm choose to go to UXY instead of UXV?
Thanks in advance!