Concepts2
⚙️AlgorithmAdvanced
Johnson's Algorithm
Johnson's Algorithm computes all-pairs shortest paths on sparse graphs by first removing negative edges via reweighting, then running Dijkstra from every vertex.
#johnson's algorithm#all pairs shortest paths#apsp+12
🗂️Data StructureAdvanced
Centroid Decomposition - Distance Queries
Centroid decomposition splits a tree into levels by repeatedly removing a centroid so that each remaining component is at most half the size.
#centroid decomposition#tree distance queries#nearest red node+12