Dijkstra's shortest path algorithm can be used for full traversal (illustrated in the animation) where all the nodes are visited in order to determine all the distances between node

and node

. However, one can observe in the illustration that when nodes

,

and

are visited, the choice is given between following a path with weight

to

, a path of weight

to

and a path of weight

to

. In the illustration we chose a full traversal, that is, we visit

, even though we could have directly selected the shortest path with weight

from

to

.