Not bad. May I suggest a few improvements?
- Distinguish between the algorithm (what you do) and the argument (the proof of why it works).
- Your
D
, which you say is a list, is better thought of as a map/associative-array fromNode
to[distance, Node]
, where the formerNode
is the predecessor of the latter. - Start the computation with
{start-node -> [0, nil]}
inD
. - Define the graph
G
as a mappingNode -> Set of [distance, Node]
, where thedistance
is the edge length from the former to the latter node. This makes the iterative step easier to describe precisely.
The point of Dijkstra's algorithm is that the tentative distances turn out to be final. The way to prove this is to show that - given that it is true of D
so far - it is true at the next step too. This is called the inductive hypothesis. Given that it is true of the initial D
, which it is, it is true of all the D
s thereafter, including the final one.