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. |
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 |
|
Thank you @mahdiehmalekian for addressing all the review comments. And just to build a strong(er) case for code duplication (a code that's already tested and maintained by the networkx team) -- could you please run a quick benchmark against the nx implementation in the clique embedder hot loop -- just to get a sense if this code provides a 10% or a 10x improvement? Also, could you please a release note? |
Code for finding maximum bipartite matching via the Hopcroft-Karp algorithm.
AI use: I used AI to generate the code, checked the code myself.