Borůvka’s algorithm

Connect towns by road for the lowest total building cost. While groups of towns are still separate, each group can choose its cheapest road to a neighbour.

Each component chooses its cheapest outgoing edge. Join distinct components using these choices, then start a new round. Disconnected groups remain separate trees.

There are O(log V) productive rounds. Each scans the edges and looks up component representatives.