Algorithm
Prim's Algorithm:
- Initialize a set to keep track of vertices included in the Minimum Spanning Tree (MST).
- Start with an arbitrary vertex and add it to the MST set.
- While the MST set does not include all vertices:
- Find the edge with the smallest weight that connects a vertex in the MST set to a vertex outside the MST set.
- Add the selected edge and the vertex to the MST set.
- Repeat until all vertices are included in the MST set.
Example:

Fig. 1: Step-by-Step Process of Prim's Algorithm
Note: Prim's Algorithm is suitable for connected, undirected graphs and ensures a minimum spanning tree.