Work out minimum spanning tree instantly with clear inputs, formula shown and shareable results.
Kruskal's algorithm sorts the edges by weight and adds each one that joins two different components, tracked with a union-find structure. A spanning tree on n vertices always has exactly n − 1 edges.
Kruskal
sort edges ascending, add an edge whenever it connects two distinct components
Tree size
a spanning tree on n vertices has n − 1 edges
Edges 2-3 (1), 1-3 (2), 4-5 (3) and 2-4 (5) total 11 across five vertices.
Yes. Any correct algorithm finds a minimum total, though the specific edges can differ when weights tie.