Press Step or Auto Play to animate.
Green edges = MST so far. Gray = candidate edges sorted by weight (Kruskal) or not yet visited (Prim). Edge weight shown as label.
Kruskal's and Prim's algorithms animated on a random weighted graph. Toggle algorithms and watch them differ.