Kruskal's Minimum Spanning Tree

Sort all edges by weight, then greedily add each edge if it doesn't form a cycle. Union-Find detects cycles in near O(1). The result spans all nodes with minimum total weight.

Press "Run Kruskal's" to start
Total MST weight: —