HomeAlgorithms & AIMinimum Spanning Tree: Network Design

Minimum Spanning Tree: Network Design

Watch Prim's and Kruskal's algorithms build a minimum-cost network live in 3D: every node gets connected with the least total cable length, with live weight and savings readouts.

Algorithms & AI3DModerate60 FPS📱 Mobile-adapted⇄ 2D version
minimum-spanning-tree-network-design ↗ Open standalone

Place a scatter of sites in 3D space and watch two classic greedy algorithms — Prim's and Kruskal's — connect every one of them with the least possible total cable length, one edge at a time. This is the exact problem an engineer solves when routing fiber, power lines, or circuit-board traces between a fixed set of points: the minimum spanning tree connects everything with zero redundant links and provably minimal total cost. Toggle between the two algorithms to see how a tree that grows outward from one node (Prim's) compares edge-by-edge with one that is assembled globally from cheapest to most expensive link (Kruskal's), track the running cable length and the percentage saved versus wiring every possible pair directly, and reveal the full candidate graph to see just how sparse the final network really is.

⚙ Under the hood

Watch Prim's and Kruskal's algorithms connect a scatter of 3D nodes with the least total cable length, with live tree-weight and cost-savings readouts.

algorithmsgraph-theoryminimum-spanning-treeprimkruskalnetwork-design

3D · Three.js / WebGL renderer · 60 FPS target · runs fully client-side, no install

What did you find?

Add reproduction steps (optional)