Solution (source code)

= Solution

For a finite <connected graph> $G=(V,E)$ with undirected <edges> and <edge weights> $w$, a <spanning tree> is a connected, acyclic subgraph containing all <vertices>. It has $|V|-1$ <edges>. A <minimum spanning tree> is one minimizing the sum of its <edge weights>:
$$
\boxed{T\in\operatorname*{arg\,min}_{\substack{F\subseteq E\\(V,F)\text{ is a tree}}}\sum_{e\in F}w(e).}
$$
It minimizes total weight, rather than the distance of every route from a chosen root. Equal <edge weights> may permit more than one <minimum spanning tree>; negative weights do not invalidate the definition.