Graph Algorithms Prim Minimum Spanning Tree Algorithm Prim's algorithm is a greedy algorithm that finds a minimum spanning tree for a weighted undirected graph. It finds a subset of the edges that forms a tree that includes every vertex,