Prim's Algorithm
Prim's Algorithm is a greedy algorithm for finding the Minimum Spanning Tree (MST) of a connected, weighted graph. It connects all vertices with the minimum total edge weight, making it useful in network design, clustering, and various optimization tasks.
Introduction
In graph theory, a Minimum Spanning Tree (MST) is a subset of the edges that connects all vertices in a graph with the minimum possible total edge weight and without any cycles. Prim's Algorithm builds the MST by growing a single tree and repeatedly selecting the smallest edge that connects a vertex in the tree to a vertex outside of it.