Implemented Edmonds Blossom Algorithm#5471
Merged
Merged
Conversation
…graphs with test cases and improved output formatting.
…a/com/thealgorithms/datastructures/graphs
# Conflicts: # DIRECTORY.md
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #5471 +/- ##
============================================
+ Coverage 52.31% 52.58% +0.27%
- Complexity 3259 3285 +26
============================================
Files 526 527 +1
Lines 15205 15312 +107
Branches 2892 2913 +21
============================================
+ Hits 7954 8052 +98
- Misses 6924 6929 +5
- Partials 327 331 +4 ☔ View full report in Codecov by Sentry. |
Contributor
Author
|
I apologize for so many file changes but there were too many issue to fix one by one. Thankfully it all works now. 😄 Thank you for understanding😄😄. |
siriak
requested changes
Oct 1, 2024
Contributor
Author
|
Sure will do |
TarunVishwakarma1
left a comment
Contributor
Author
There was a problem hiding this comment.
Removed the method. Test cases are in JUnit Tests
Contributor
Author
|
Please add Hacktober fest lable to this PR. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hey I've implemented Edmond's Blossom Algorithm in src/main/java/com.thealgorithms/datastructures/graphs/EdmondBlossomAlgorithm.java
with the test class in the test package
for enhancement #5470
This PR implements the Edmonds Blossom Algorithm, a well-known algorithm used to find maximum matchings in general graphs, including non-bipartite graphs. The algorithm is crucial in combinatorial optimization and graph theory.
Key Features:
Handles odd-length cycles (blossoms) by contracting them into single nodes, which allows the matching process to proceed in general graphs.
Finds the maximum cardinality matching in polynomial time.
Works efficiently for both directed and undirected graphs.
Algorithm Overview:
Initialization: Start with an empty matching and process the graph.
Augmenting Path Search: Search for augmenting paths using alternating paths (paths alternating between matched and unmatched edges).
Blossom Contraction: When an odd-length cycle (blossom) is encountered, it is temporarily contracted into a single node.
Expansion and Matching Update: Once an augmenting path is found, the blossoms are expanded, and the matching is updated.
Performance:
The time complexity is O(V^3), where V is the number of vertices in the graph.
This algorithm is especially useful in various applications such as network flow problems, stable marriages, and graph partitioning.
clang-format -i --style=file path/to/your/file.java