AlgoScope

Kruskal

AlgorithmintermediateMinimum Spanning Tree

Sort the edges by weight and take each one that joins two different components, which union-find answers.

Decision · step 2 of 9Minimum Spanning Tree: Kruskal, cheapest edges first
43124265001222334455

Edge 1-2, weight 1. 1 is in component 1 and 2 in component 2, different, so take it: they merge and the total is 1.

Open in the player →or start at step 2

What you will see

SORT EDGES -> take the lightest -> CHECK COMPONENTS -> ACCEPT (merge) or REJECT (would form a cycle).

How minimum spanning tree works →

Cost

BestO(E log E)
AverageO(E log E)
WorstO(E log E)
SpaceO(V)

How you work with it here

play it through, step one change at a time, scrub to any step, run it on your own input, predict what happens next, try operations in any order.

Screen readers: Edges announce endpoints, weight and state (candidate, accepted, rejected); each step announces the decision and the reason.

Reduced motion: Accepted edges thicken with a crossfade; no travelling highlights.

Leads to

Topics that need this one first.

Taught by the same lesson

Minimum Spanning Tree covers these too, in the same run.