How Floyd-Warshall closes all-pairs distances

Short answer: Floyd-Warshall computes the shortest path between every pair by allowing intermediate vertices in order. After step k, dist[i][j] is the best path that uses only intermediates among the first k vertices. The triple loop is Θ(V³) time and Θ(V²) memory. Negative edges are allowed. A negative value…

How expectation-maximization alternates two steps

Short answer: Expectation-maximization fits a probabilistic model with latent variables by alternating two steps. The E-step computes the posterior of the latent variables given the current parameters. The M-step maximizes the expected complete-data log-likelihood under that posterior, which for many models is a weighted closed-form update. Each full iteration…

How Edmonds finds a minimum arborescence

Short answer: Edmonds’ branching algorithm, also called Chu-Liu/Edmonds, finds a minimum-cost spanning arborescence of a directed graph: a directed tree in which every vertex except the root has in-degree one and every vertex is reachable from the root. Each vertex selects its cheapest incoming edge. If those edges form…

How Dinic blocks a level graph

Short answer: Dinic’s algorithm repeats two steps. Breadth-first search assigns a level, the residual distance from the source, and discards every edge that does not advance exactly one level. Depth-first search then pushes a blocking flow: every residual source-sink path in that level graph is saturated. The level of…