Prim's Algorithm

What is Prim's Algorithm?

Prim's Algorithm is a greedy algorithm that finds the Minimum Spanning Tree (MST) for a weighted, undirected, and connected graph. It works by repeatedly selecting the lowest-weight edge that connects the existing tree to a new vertex. In short, it chooses the cheapest available edge that expands the tree.

How Does Prim's Algorithm Work?

Diagram showing an example of how Prim's Algorithm builds a minimum spanning tree

Learn More

Learn more about Prim's Algorithm here