DSA Lab
Minimum spanning tree
A minimum spanning tree joins all the nodes of a weighted, undirected graph with the smallest total edge weight and no cycles. Kruskal takes edges cheapest first; Prim grows one tree outward.
Minimum spanning tree: how it works
In this tool: kruskal and Prim. Put in your own values and watch it change. Each operation runs one step at a time and says in plain words what happened, with its calculation worked out. The code is shown in Python, C, C++ or Java with the line that just ran marked, and an Understand it panel gives the idea, why it works, the cost of each operation, common mistakes and a short quiz.
Lessons that use it
- Minimum spanning trees (Algorithms)Join every vertex at the smallest total cost: Kruskal with union-find, and Prim growing one tree.