Skip to content

[REQUEST] Add [Prim's Algorithm] in python #13400

@laiba-Ashfaq

Description

@laiba-Ashfaq

Feature description

Algorithm Name
Prim's Algorithm

Programming Language
C++

Category
Greedy Algorithms

Difficulty Level
Easy (Beginner friendly)

Algorithm Description
Prim's algorithm builds a Minimum Spanning Tree by starting with a single vertex and "growing" the tree outwards one edge at a time. It begins at an arbitrary starting node and, at each step, adds the cheapest possible edge that connects a vertex already in the tree to a vertex outside of it. This process is repeated until all vertices in the graph have been included in the tree. Imagine you're building a road network to connect several towns; Prim's is like starting in one town, then always building the shortest possible road that leads to a new, previously unconnected town, continuing this process until all towns are linked by the cheapest possible network of roads.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementThis PR modified some existing files

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions