Python, Graph, Algorithms.
Next, we visit the unvisited vertex with the smallest distance, which is D. We update the distances to its adjacent vertices B and E as 3 and 2, respectively. We continue this process until we visit all vertices. The final distances are the shortest distances from A to all other vertices. 3.2.