I am studying graph theory and I need to understand Dijkstra's algorithm for finding the shortest path from a source vertex to all other vertices in a weighted graph.
I know the basic idea:
1. Set distance to source = 0, all others = $\infty$
2. Mark all vertices as unvisited
3. For the current vertex, consider all unvisited neighbors and update their distances
4. Mark current as visited, select the unvisited vertex with smallest distance
5. Repeat until all visited