Python, Data Engineering, Algorithms, Computer Science, Data Science.
graph visited = [] unvisited = list(graph.keys()) # Step #2 - Initialize the shortest distance shortest_distance = {} for node in unvisited: if node != start_node: shortest_distance[node] = np.inf else: shortest_distance[node] = 0 print(shortest_distance) # Step #3 - Find the shortest path