Fix the minimum spanning tree algorithm.

Tinc uses Kruskal's algorithm to calculate a MST. However, this was broken in
commit 6e80da3370249caa1082c23c3ef55f338d1e9e74. Revert back to the working
algorithm from tinc 1.0.

Thanks to Cheng LI for spotting the problem.