-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
feat: Added Stable Matching Algorithm #806
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #806 +/- ##
==========================================
+ Coverage 95.31% 95.36% +0.05%
==========================================
Files 310 311 +1
Lines 22430 22673 +243
==========================================
+ Hits 21380 21623 +243
Misses 1050 1050 ☔ View full report in Codecov by Sentry. |
vil02
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add the missing tests. We are aiming to 100% coverage.
done it reached 100% convergence |
|
@sozelfist could you take a look? Do you have some reasonable idea how to refactor |
Sure, I will propose decomposing the |
|
Btw, why don't we write tests using macros? It makes the test more compact and we can suggest adding some edge tests. |
|
What do you think about the refactor, @vil02 and @BKarthik7? |
I understood the refactor and is nice but if a newbie wants to understand the code i thought the original version was more readable it's just my opinion I am open to hear your point of view too. I implemented the changes and pushed it. |
|
The original version might be easier for beginners due to its linear structure, but the refactored version is better in terms of maintainability and best practices. |
|
@sozelfist |
|
I just proposed the refactored version of your code. Maybe @vil02 would have something to propose. |
You can consider this one for tests |
vil02
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can leave it as it is.
feat: Added Stable Matching Algorithm
Description
This commit introduces the Stable Matching Algorithm, commonly known as the Gale-Shapley Algorithm, to the codebase. It solves the problem of matching two sets (e.g., men and women) based on preference lists, ensuring that the final matching is stable—meaning no two individuals would rather be paired with each other than with their current partners.
Type of change
Checklist:
cargo clippy --all -- -D warningsjust before my last commit and fixed any issue that was found.cargo fmtjust before my last commit.cargo testjust before my last commit and all tests passed.mod.rsfile within its own folder, and in any parent folder(s).DIRECTORY.mdwith the correct link.COUNTRIBUTING.mdand my code follows its guidelines.