Prim's Algorithm Visualization
Find Minimum Spanning Tree by growing the tree one vertex at a time using a priority queue
Add Vertex
Add Weighted Edge
Minimum Spanning Tree (Prim's)
Add vertices and weighted edges, then run Prim's algorithm!
MST Edges
No edges in MST yet
Visited Vertices
Algorithm Status
Vertices: 0
Total Edges: 0
Visited: 0
MST Edges: 0
Total Weight: 0
Legend
Unvisited Vertex
Visited Vertex
Original Edge
MST Edge
Prim's Algorithm Properties
Time Complexity
O(E log V)
Space Complexity
O(V)
Data Structure
Priority Queue
Use Cases
Network design, Approximation algorithms