Core idea
Dijkstra keeps the shortest known distance to each vertex.
The next vertex chosen is always the unvisited one with the smallest distance.
It does not support negative edge weights.
How it works
- Set source distance to 0 and all others to infinity.
- Pick the unvisited vertex with the smallest distance.
- Relax all outgoing edges from that vertex.
- Repeat until all reachable vertices are finalized.