Dijkstra's algorithm
In this pseudocode algorithm, the code , searches for the vertex  in the vertex set  that has the least  value.  returns the length of the edge connecting the two neighbor-nodes  and . The variable  on line 18 is the length of the path from the root node to the neighbor node  if it were to go through . If this path is shorter than the current shortest path recorded for , that current path is replaced with this  path. The  array contains a pointer to the next node on the source graph to get the shortest route to the source.