← Kruskal Algorithm | Prim Algorithm | Shortest Path →
Exit Slides

Summary

prim_algorithm builds a minimum_spanning_tree of a connected_weighted_undirected_graph. Start from any starting_vertex, add the lightest edge that connects a new vertex to the tree. Repeat until all vertices are included. It uses a priority_queue keyed by edge_weight for efficiency. The result is edges with minimum total weight. Typical time_complexity is O(E_log_V) with a binary heap; for dense graphs, it can be O(V_squared).
Slide 1 / 4