CPKit
v1.6.1

Prim's MST

Spanning TreeMedium

Construct a Minimum Spanning Tree greedily connecting closest neighbors.

Alt+Shift+I

Configuration Panel

Complexity Mappings

Time ComplexityO(E log V) / O(V^2)
Space ComplexityO(V) visited tracking arrays

Interactive SVG Graph Canvas

42583101234
🖱️ Middle-drag to Pan🎡 Scroll wheel to Zoom⌨️ Shift-drag snap to 20px grid

Inspector Panel

Select a vertex or edge to inspect details.

Graph Wizard

Conceptual Overview

Prim's Algorithm grows a Minimum Spanning Tree (MST) from a starting vertex by greedily adding the cheapest edge connecting visited nodes to unvisited nodes.

Algorithm Mechanism

Starts from root. Tracks adjacent minimum edge values using a min-priority queue, selecting the next cheapest transition that avoids cycle loops.

Source: CP-Algorithms reference guide