Repository navigation
Fix min_weight_matching - #8062
Merged
Merged
Conversation
rossbar
reviewed
May 23, 2025
rossbar
left a comment
Contributor
There was a problem hiding this comment.
Having read through the Wikipedia articles on maximal matchings and maximum cardinality matching, I agree that the definition should be updated.
A couple minor comments related to the test changes but the doc updates LGTM!
Co-authored-by: Ross Barnowski <[email protected]>
Contributor
Author
|
|
rossbar
approved these changes
May 29, 2025
Peiffap
approved these changes
May 30, 2025
Co-authored-by: Gilles Peiffer <[email protected]>
amcandio
pushed a commit
to amcandio/networkx
that referenced
this pull request
Jul 20, 2025
* Fix `min_weight_matching` * Apply a suggestion Co-authored-by: Ross Barnowski <[email protected]> * Tests for weight=None * 1 -> weight=None * Apply suggestions from code review Co-authored-by: Gilles Peiffer <[email protected]> --------- Co-authored-by: Ross Barnowski <[email protected]> Co-authored-by: Gilles Peiffer <[email protected]>
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.
The current
min_weight_matchingclaims to compute a minimum-weight maximal matching, but it is actually computing a minimum-weighted maximum-cardinality matching.The minimum-weight maximal matching, which it claims to solve, is NP-hard. See the paper:
Changes include:
maxcardinality(the min version does not have such a keyword parameter)