Skip to content
LaTeX (KaTeX) templates

Math — Dijkstra's Algorithm

Shortest paths from a source node.

Template previewLaTeX (KaTeX)
Rendering…

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}