Minimum spanning tree (Kruskal)
Time complexity: O(E log E).
Result
Examples
How it works
Kruskal’s algorithm sorts the edges by weight and adds each one that does not close a loop. The result links every node with the smallest total weight.
When to use it
Network design: the least cable, pipe or road needed to connect every site.
Other algorithms
Pathfinding Visualizer
Sorting Algorithm Visualizer
Graph Algorithms Visualizer
- Topological sort
- Minimum spanning tree (Kruskal)