TheAlgorithms / Python

All Algorithms implemented in Python
https://thealgorithms.github.io/Python/
MIT License
192.99k stars 45.46k forks source link

Add Edmonds' Blossom Algorithm for Maximum Matching in Graphs #12043

Open TarunVishwakarma1 opened 1 week ago

TarunVishwakarma1 commented 1 week ago

Feature description

Description

I would like to propose adding an implementation of Edmonds' Blossom Algorithm to our codebase. This algorithm efficiently finds the maximum matching in general graphs, including those with odd-length cycles, by contracting blossoms and searching for augmenting paths.

Rationale

The current implementation of graph algorithms in our codebase lacks a robust solution for finding maximum matchings in arbitrary graphs. Implementing Edmonds' Blossom Algorithm would provide a powerful tool for users who need to solve matching problems, such as:

Graph Theory Applications: Providing solutions to problems involving bipartite and non-bipartite graphs. Real-World Applications: Solving problems in job assignments, network flows, and matching problems in social networks. Potential Impact Adding this feature would:

Enhance Functionality: Expand our library’s capabilities for graph algorithms, making it more versatile for users. Improve Performance: Offer an efficient solution for maximum matching, especially in dense graphs or graphs with odd cycles. Encourage Adoption: Attract users who require advanced graph algorithms, potentially increasing the library's user base. Additional Information Dependencies: Review any dependencies required for implementing the algorithm, such as data structures or external libraries. Testing: Develop unit tests and examples demonstrating the algorithm's performance and use cases. Documentation: Ensure comprehensive documentation is provided, including usage examples and performance benchmarks.

Proposed Implementation

Language: Java (or specify another language as needed) Algorithm: Edmonds' Blossom Algorithm Basic structure: Define the algorithm in a dedicated class (e.g., EdmondsBlossomAlgorithm). Implement methods for finding maximum matchings, updating matches, and handling blossoms. Include comments and documentation for clarity.

Conclusion

Implementing the Edmonds' Blossom Algorithm will significantly improve our graph algorithm toolkit and provide users with a powerful resource for solving complex matching problems. I believe this addition aligns with our project goals and enhances our offerings.

TarunVishwakarma1 commented 1 week ago

Working on this. Please add hacktober fest label in this. Thanks

TarunVishwakarma1 commented 1 week ago

The first 2 PR's were giving errors and had to re-fork the repo, So deleted the pr and created fresh new PR