Dijkstra shortest path yields unintuitive results Considering the following nodes with edge weights in red, Dijkstra's shortest path algorithm seems to return incorrect results, at least by the definition of the steps on wikipedia. By those rules, the distance from 0 to 2 will be calculated by passing through 1 instead of 3. 

The final distances (from 0) would come out to:

0 -> 0

1 -> 0.2

2 -> 1000.2

3 -> 0.5

The weights in this case are bi-directional but I don't see a way for information of the connection between 2 and 3 to ever affect the final distance between 0 and 2. Am I missing something about the limitations of this algorithm on this type of graph or are the steps listed incorrect?
In the wikipedia article you linked, the final distance is only computed when the node is visited (step 6). The tentative distance is (re)calculated each time to visit a parent of a node, and overwritten if it's smaller (step 3).

So in your example,


We visit node 0.  We set tentative(1) = 0.2, tentative(3) = 0.5
We visit node 1, since it has the smallest tentative distance. We set tentative(2) = 1000.2
We visit node 3.  Since 0.6 &lt; 1000.2, we set tentative(2) = 0.6
We visit node 2.  Its final distance is tentative(2), which is currently 0.6