Python, Data Engineering, Algorithms, Computer Science, Data Science.
1, 'E': 2} As we can see, the algorithm ends once we visit all nodes and have updated all distances from the starting node. We can now answer the question we started with, which is what is the shortest path between A and C. print("The shortest distance from A to C is: ", shortest_distance.get('C'))