二部图最大匹配
我是图表新手。我在二部图中有两个集合。我需要找到所有可能组合的唯一匹配。所以我想我使用 Hopcroft-Karp 来找到最大匹配。作为一个新手,我以为我会得到结果匹配图,但它告诉我的只是 42。啊,这真的很有帮助。我不需要知道有多少个匹配,我需要知道唯一的匹配本身。
我错过了什么吗?我如何获得匹配结果?
I am new to graphs. I have two sets in a bipartite graph. I need to find unique matching of all the possible combinations. So I thought I use Hopcroft-Karp to find maximum matching. Being a newbie I thought I would get the resulting matching graph but all it tells me is 42. Ahhh that really helps. I don't need to know how many matchings there are I need to know the unique matchings themselfs.
Am I missing something? How do I get the resulting matching?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我没有检查 Hopcroft-Karp 匹配函数生成的数据结构,只检查了重新运行值。返回值是匹配的数量。然而,Python代码中还有一个 self.pair 字典,pair字典包含“双方”的匹配,这回答了我的问题。
I diden't check the datastructures generated by the Hopcroft-Karp match function, only the retrun value. The return value is the number of matchings. However there was also a self.pair dictionary in the python code, the pair dictionary contains the matchings from "both" sides, which answers my question.