1

I have a single set and I need to generate pairs of two elements among this set. The assignments are all weighted. The matching shall be either constricted or perfect, depends on the results. I guess, I need a weighted matching in general graphs and, as far as I see, Edmonds's algorithm is the correct address. Is that right?

I already implemented Kuhn-Munkres algorithm but I recognized very late that this is only working on bi-partite graphs. Is there maybe a (easy) way to adjust the Kuhn-Munkres algorithm to Edmond's? Otherwise I would go for the Edmond's algorithm.

halfer
  • 19,824
  • 17
  • 99
  • 186
Ben
  • 1,432
  • 4
  • 20
  • 43
  • 1
    If you want to save some time, have a look at NetworkX - it already has an implementation of Edmond's algorithm : http://networkx.readthedocs.io/en/latest/reference/generated/networkx.algorithms.matching.max_weight_matching.html – Peter de Rivaz May 21 '17 at 21:35
  • Duplicate your set and use the Hungarian algorithm on both sets with the weight of a self connection as high as possible. I haven't tried it myself, but I think it should work. – Yay295 May 22 '17 at 00:57
  • @Yay295 Thanks for the advice! I already tried to double the set but this does not work.By assigning them a high weight avoids a self connection, that's correct. But problem is that elements are picked more than once because each element comes twice and the algorithm does not know that e.g. "A1" is also "B1". But I tried to implement researchgate.net/publication/… where they sate one has to "mirror" the edges - but I think the approach is wrong bc the algorithm fails often. – Ben May 22 '17 at 09:58
  • @PeterdeRivaz Thanks for the information! Is there something comparable for c++? I found NetworkKit which looks like something in between but relative hard to read. I did some research on google and I guess the most simple solutions are http://edmonds-alg.sourceforge.net/ and https://lemon.cs.elte.hu/trac/lemon But in the first case I'm not sure if it is weighted and the second I do not really understand if it is ready to use or not? Can you please make a decision? Or do you have something else to use? – Ben May 22 '17 at 10:01
  • I'm afraid I've never used those libraries myself – Peter de Rivaz May 22 '17 at 10:59
  • 2
    Cross-posted: https://cs.stackexchange.com/q/75751/755, https://stackoverflow.com/q/44101959/781723. Please [do not post the same question on multiple sites](https://meta.stackexchange.com/q/64068). Each community should have an honest shot at answering without anybody's time being wasted. – D.W. May 22 '17 at 16:28
  • @D.W. As far as I understand these two plattforms are different: The one concentrates on the theory and the other on the implementation. On stackexchange I would like to discuss the theory part (above all my adjustment for a single set) and here, if that other attempt fails, which way I have to go. So, yes, the same background/issue but two different questions. PS: Ok, the difference is only visible at the comment section :) – Ben May 22 '17 at 17:26
  • 1
    @Ben, yup, I am familiar with the difference between the two sites. That doesn't change the fact that cross-posting is prohibited. You can follow the link I gave you to learn more. You have copy-pasted your question word-for-word identical on both sites. If you want to ask about the theory part on one site, and the practice part on another site, at a minimum I would think that would require the two questions to be different, so we know what specifically you are asking. – D.W. May 22 '17 at 17:29
  • We want questions to be self-contained, so people can understand what you're asking without reading the comments. Comments can disappear at any time. So any important information should be incorporated into the question using the 'edit' button under the question, and then you can flag those comments as 'obsolete' so they'll be deleted. This helps keep quality high. Make sure to edit the question so it reads well for someone who encounters it for the first time; you don't need to mark what has changed. Thank you! – D.W. May 22 '17 at 17:29
  • Ok, can understand that. But it was not 100% word for word :) But anyhow I guess this topic here is solved. Thanks! – Ben May 24 '17 at 09:39

0 Answers0