Python, Graph, Algorithms.
with weight 2, D and E with weight 1, and E and C with weight 5. If we start Dijkstra’s algorithm at vertex A, we first set the distance to A as 0 and the distance to all other vertices as infinity. Then, we visit A and update the distances to its adjacent vertices B and D as 6 and 1, respectively.