Math — Dijkstra's Algorithm
Shortest paths from a source node.
What this template contains
- Equations
- 4
- Source
- 4 lines
Make it your own.
d[v] = \min(d[v],\ d[u] + w(u,v))
\text{greedy: pick the nearest unvisited}
\text{requires non-negative weights}
O((V + E)\log V)\ \text{with a heap}