Graph Algorithms

Minimum Spanning Tree (Prim's)

Find the subset of edges connecting all vertices with minimum total weight, growing the MST one edge at a time from a starting node using a priority queue.

0
Total Nodes
0
Total Edges
0
Total MST Weight
0
Nodes in MST
PRIM'S MST GRAPH

Editor Guide: Click empty space to add a node. Click and drag between nodes to connect them with a weighted undirected edge.

Execution Log

Click Load Example Map or design a graph, then run Prim's.

Presets

Legend

Node in MST
Active / Processing node
Unvisited Node

Time Complexity

Prim's time complexity is O(E log V) using a binary heap priority queue.