← Networks

Minimum Spanning Tree

MST Weight  Step 0 UA
Progress
Nodes
Total Edges
MST Edges0
MST Weight
Status
Press Play or Step to start.
Legend
Unprocessed Candidate In MST Rejected
Algorithm
Nodes  22
Speed
Minimum Spanning Tree simulation animating Kruskal's and Prim's algorithms step-by-step on a random weighted graph. Kruskal's algorithm sorts all edges by weight and uses a Union-Find (DSU) structure to greedily add the lowest-cost edge that doesn't create a cycle. Prim's algorithm grows the tree from a seed node, always adding the cheapest edge connecting the current tree to an unvisited node. Edge costs are displayed on every arc.