Dijkstra’s Pseudocode(actually, our pseudocode for Dijkstra’s algorithm)
Initialize the cost of each node to ?
Initialize the cost of the source to 0
While there are unknown nodes left in the graph
Select the unknown node with the lowest cost: n
Mark n as known
For each node a which is adjacent to n
a’s cost = min(a’s old cost, n’s cost + cost of (n, a))
We can get the path from thisjust as we did for mazes!