Dijkstra's Shortest Path

Implement dijkstra(graph, start), returning a dictionary of shortest distances from start to every vertex, on a weighted, undirected graph.

Read the number of edges, then that many "V1 V2 weight" triples, then a start vertex and a target vertex. Print the shortest distance from start to target.

main.py
Loading editor…

Console

Run your code to see output here.