Skip to content

Prim's Algoritm #123

@Krushit-Babariya

Description

@Krushit-Babariya

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:
    1. Small graphs (e.g., 2 or 3 vertices)
    2. Large graphs
    3. Graphs with duplicate edge weights

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions