Set the distance from node A to itself as 0, and the distance to all other nodes as infinity. Create two sets: visited (initially empty) and unvisited (containing all nodes A, B, C, D, and E). The initial distances are: A(0), B(∞), C(∞), D(∞), E(∞).
Show more…