-
Notifications
You must be signed in to change notification settings - Fork 325
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
Matching #400
Matching #400
Conversation
Hi, at this moment the maintainers don't have so much time unfortunately, so there can be a lot of delay. |
That's fine, take your time. |
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.
This is really clean. Thanks!
Can you rebase over master so the failing rustfmt
test runs again ?
In addition to the comments, we might want to change the name of maximum_matching
to gabow_maximum_matching
or similar (as what happens with tarjan_scc
and kosaraju_scc
) so that future implementations using other algorithms can set different constraints without breaking the API.
@bluss do you have a preference on this?
Thanks! I will rebase. Regarding the name change, here is my perspective. I am not sure whether this algorithm should be permanent in petgraph codebase. Its time complexity Nonetheless, thanks to its simplicity, this algorithm may be actually faster than very complicated state-of-the-art on some graphs. In that case, it would make sense to provide it through |
@pnevyk's rationale for a more specific name sounds good 🙂 |
There may be a little trouble however. This paper from 2017 advertises itself as "an accessible matching algorithm with time bound But I am no expert on matching algorithms, I don't know which one should be included in petgraph. |
Oh, right. We could check which algorithm are being used by other libraries too, but that one looks nice, simple, and asymptotically optimal. For now, we can start merging this first implementation. Thanks for the work! |
* Add initial implementation of matching algorithm * Fix compilation errors on rustc 1.37.0 * Optimize and enhance the `Matching` structure * Simplify implementation of iterators in matching module * Change panics documentation to petgraph format. * Add support for stable graph * Fix formatting and matching tests without default features * Return falsy values instead of panicking in Matching methods
* Add initial implementation of matching algorithm * Fix compilation errors on rustc 1.37.0 * Optimize and enhance the `Matching` structure * Simplify implementation of iterators in matching module * Change panics documentation to petgraph format. * Add support for stable graph * Fix formatting and matching tests without default features * Return falsy values instead of panicking in Matching methods
Hi,
I implemented an algorithm for maximum matching. It was also requested in #296.
The implementation uses Gabow's algorithm, which has
O(|V|^3)
time complexity. The state-of-the-art isO(sqrt(|V|) |E|)
(a classical example is Micali-Vazirani). Wikipedia has article about an algorithm which is said to haveO(|V|^2 |E|)
time.The issue with the state-of-the-art algorithms is that they are very complex. The algorithm implemented in this PR is much simpler to implement and I consider it a good start. A nice thing about it is that it uses labeling techniques to encode structure and does not require any complex data structures for blossom shrinking and expansion. The ultimate goal (not for this PR) is to implement a
O(sqrt(|V|) |E|)
algorithm - a good candidate might be this work, which seems to be quite accessible, but I haven't read it yet.Looking forward to your thoughts and feedback.