Mark As Completed Discussion

We now move towards the unvisited node with smallest distance, which is node C. The distances of nodes D and E are now updated to 6 and 10.

As the sum of the distance from the source node to nodes D and E is greater than the original distance, this was updated.

In the case of node D, the distance of A to C is 2, and C to D is 4. As such, the total distance from source node for D became 2 + 4 = 6.

Node E was updated in the same manner. Since C gives the shortest path so far, it is added to the shortest path. The changes are implemented as illustrated below.

Second Step