-
Notifications
You must be signed in to change notification settings - Fork 84
Open
Description
Prim's Algorithm is a greedy algorithm used to find the Minimum Spanning Tree (MST) for a connected, undirected graph with weighted edges. The algorithm starts from a chosen vertex and builds the MST by adding edges with the minimum possible weight that connect vertices not yet in the tree. The process continues until all vertices are included in the MST.
Tasks:
- Implement Prim's Algorithm using a priority queue (min-heap) for efficient selection of minimum-weight edges.
- Ensure the algorithm can handle both dense and sparse graphs.
- Validate the implementation with various test cases, including edge cases like:
- Small graphs (e.g., 2 or 3 vertices)
- Large graphs
- Graphs with duplicate edge weights
Metadata
Metadata
Assignees
Labels
No labels