Why it matters

Kruskal is standard MST algorithm. Understanding shapes graph problems.

Advertisement

The architecture

Sort edges by weight.

For each: union endpoints if different components.

V-1 edges = MST.

Kruskal MSTSort edgesby weightUnion-Findpath compressionAdd if disjointV-1 edgesPath compression + union by rank give near-O(1) amortized union-find
Kruskal.
Advertisement

How it works end to end

DSU: path compression + union by rank.

Nearly linear union operations.

Sorted edges: O(E log E).