Kruskal's Minimum Spanning Tree
A global greedy edge order guarded by disjoint sets
Connect every vertex at minimum total cost
A minimum spanning tree connects every vertex of a connected, undirected weighted graph with exactly V - 1 edges, no cycle, and the smallest possible total weight. Kruskal's algorithm builds that tree from a forest of isolated vertices.
Accept the lightest safe edge
Sort all edges by weight. Consider them from lightest to heaviest and accept an edge only when its endpoints belong to different components. A disjoint-set structure answers that connectivity question and merges the two components after an accepted edge.
In the player, amber marks the edge under consideration, green edges belong to the growing tree, and dashed edges were rejected because they would close a cycle. The variable panel keeps the selected edge count and total weight visible throughout the scan.
Sort all 9 edges by weight; the MST is empty and every vertex starts in its own set.
Why the greedy choice is safe
The cut property says that a lightest edge crossing any cut is safe for some minimum spanning tree. Each accepted edge joins two current components, so it is a lightest crossing edge for that cut. Sorting costs O(E log E); disjoint-set operations add almost constant amortized work per edge.
Compare this global edge scan with Prim's vertex-driven growth on the same weighted graph.