Tool guide

Minimum Spanning Tree: Prim and Kruskal Compared

The Spanning tree panel answers the cheapest-wiring question: keep every node connected and pay the smallest possible total edge weight. Prim grows one tree from a root; Kruskal sweeps edges in weight order and merges components. Both report total weight, edges chosen out of the graph's edge count, the number of components and whether the result is a forest — that last row turns to Yes when the input graph is disconnected. The graph comes from the shared graph workbench.

Updated Reviewed by CalcX Editorial Team4 sources4 min read