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()?
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. |
| The augmenting-path search (``dfs``) is recursive with depth bounded | ||
| by the length of the augmenting path, so extremely large or | ||
| pathological graphs (deep augmenting paths) could approach Python's | ||
| recursion limit. For typical matching problem sizes this isn't a |
There was a problem hiding this comment.
Could you please elaborate what does "typical" mean here?
Perhaps worth mentioning that in the docs? |
Co-authored-by: Radomir Stevanovic <radomir.stevanovic@gmail.com>
|
Reverted formatting where applicable and added a note comparing with |
Code for finding maximum bipartite matching via the Hopcroft-Karp algorithm.
AI use: I used AI to generate the code, checked the code myself.