In graph theory and combinatorial optimization, the minimum spanning tree problem (MST problem) is the computational problem of finding a minimum spanning tree of a given connected edge-weighted undirected graph.

Definition


Definition 1 (Minimum spanning tree problem)

Input: A connected edge-weighted undirected graph with weight function .

Task: Solve

i.e. find a minimum spanning tree of .

Definition 2 (Minimum spanning tree decision problem)

Input: A connected edge-weighted undirected graph with weight function , and a bound .

Question: Does have a spanning tree with ?

Corollary 1 (Membership in P)

The minimum spanning tree decision problem (Definition 2) lies in P: given a candidate tree , checking is spanning and computing takes polynomial time, and by Corollary 1 of Minimum spanning tree a minimizer can be computed directly in polynomial time using any of the algorithms below, so the two problems are polynomial-time equivalent.

Algorithms


Each algorithm below builds a minimum spanning tree by repeatedly adding an edge justified by the cut property (Lemma 1); they differ in how that edge is chosen. Let and .

AlgorithmStrategyTime complexity
Kruskal’s algorithmConsider edges in increasing order of weight, adding each edge that does not close a cycle with the edges already chosen
Prim’s algorithmGrow a single tree from an arbitrary root, repeatedly adding a minimum-weight edge leaving the tree with a binary heap, with a Fibonacci heap
Borůvka’s algorithmIn each round, simultaneously add a minimum-weight edge leaving every current component