Solution (source code)

= Solution

A <spanning tree> is a connected acyclic subgraph containing every vertex of the original undirected graph. For a graph with $|V|$ vertices it has $|V|-1$ edges. A <minimum spanning tree> minimizes the sum of its <edge weights> over all spanning trees:
$$
\boxed{T\in\underset{\text{spanning trees }S}{\operatorname{argmin}}\sum_{e\in S}w(e).}
$$
Connectedness guarantees existence for a finite graph; equal weights can permit several minimizers.