What information entered the process?
Labs / Computer Science
Minimum Spanning Tree
A minimum spanning tree connects every node using the least total edge weight possible. Press Play to watch the algorithm consider edges cheapest-first — green when an edge joins the tree, red when it would close a wasteful cycle. Drag nodes to reshape the graph, or switch to Connect mode to wire up your own edges.
Labs / Computer Science / Minimum Spanning Tree
Minimum Spanning Tree
A minimum spanning tree connects every node using the least total edge weight possible. Press Play to watch the algorithm consider edges cheapest-first — green when an edge joins the tree, red when it would close a wasteful cycle. Drag nodes to reshape the graph, or switch to Connect mode to wire up your own edges.
Why it matters
Why explore this?
Computer science turns clear rules into reliable processes. This model lets you step through those rules and see how each decision changes the result.
Explore
Try the model
Investigate
Questions to test
Predict first, try it in the model, then use what you observe to answer.
What to try
- Run Kruskal, then Prim on the same graph. Do they accept edges in the same order? Do they end up with the same total weight?
- Why does an edge turn red? What do its two endpoints have in common at that moment?
- Drag one node far away from the rest. Which edges does the tree drop, and which cheap new ones does it grab?
- Add a brand-new node with Connect mode. Can a single expensive edge ever be worth adding to the tree?
- Kruskal rejects more edges than Prim on the same graph. What is each algorithm doing differently to avoid cycles?
Explain
Make sense of what happened
Trace the process one step at a time. Name the rule used at each important step, then explain why the final result follows from those rules.
Check
Before you leave
Which rule changed it?
Why did the process produce this result?
If you can answer all three using evidence from the model, you understand the main idea. If not, return to Explore and change one setting at a time.