# What am I missing in this application of Dijkstra?

When running Dijkstra against the following graph:

   1   3
A -- B -- C
\      /
2 \    / 1
\  /
D


...I come up with the following:

   Current
A      B          C          D
A      1(via A)   -          2(via A)
B      1(A)       4(via B)   2(via A)
C      1(A)       4(via B)   2(via A) (5 via C ignored)

The shortest path from A to B is 1 via A.
The shortest path from A to C is 4 via B.
The shortest path from A to D is 2 via A.


...but there is a path from A to C via D that is of magnitude 3 (2 + 1).

What am I missing here?

current should be the unexplored with the lowest cost. Which means that after you explored $B$ you should have explored $D$ because $2<4$.