Maximum bipartite matching#276
Conversation
randomir
left a comment
There was a problem hiding this comment.
The implementation looks correct (when compared to the pseudo-code on Wikipedia), apart from a couple of pruning condition checks missing in your implementation, in the BFS and the DFS functions -- resulting in a greater runtime complexity in the worst case.
But my main question is what's the benefit of your implementation over the existing one in NetworkX, hopcroft_karp_matching()?
| returned; which one depends on iteration order. | ||
|
|
||
| Raises: | ||
| KeyError: If ``edges`` references a ``y`` that is not in ``Y``. |
There was a problem hiding this comment.
What if it references x not in X?
There was a problem hiding this comment.
Removed this and made it explicit that edges must have x in X and y in Y. dbda40f
Co-authored-by: Radomir Stevanovic <radomir.stevanovic@gmail.com>
|
Re. the missing pruning step, thank you for flagging it. I added it in dbda40f Re. your main question, great point. |
Code for finding maximum bipartite matching via the Hopcroft-Karp algorithm.
AI use: I used AI to generate the code, checked the code myself.