dist[] // array of cost of shortest path from s
pred[] // array of predecessor in shortest path from s
dijkstraSSSP(G,source):
| Input graph G, source node
|
| initialise dist[] to all ∞, except dist[source]=0
| initialise pred[] to all -1
| vSet=all vertices of G
| while vSet≠∅ do
| | find s∈vSet with minimum dist[s]
| | for each (s,t,w)∈edges(G) do
| | relax along (s,t,w)
| | end for
| | vSet=vSet\{s}
| end while
|