3

I'm looking for a minimum weight perfect matching algorithm in Mathematica. Ideally, it should be able to handle arbitrary weighted graphs (e.g. not just bipartite, as that case is easy), although I suppose I don't care if the graph is required to be complete or to have positive edge weights. Does anybody have code for this problem that they are willing to share or know of a relatively simple way to do it with built-in Mathematica functions?

The standard poly-time method is the Blossom algorithm first developed by Jack Edmonds. It's been gradually improved over time. I think they're up to Blossom V by Vladimir Kolmogorov who has a c++ implementation. Really, I'd appreciate any poly-time Mathematica solution though.

I also know there is a Demonstrations project here that appears to do what I want, but the code places random weights on edges and is overly concerned with the graphics. That is, it is not currently user-friendly. I could try to pick through it to make it so, but thought I'd ask around here before that.

  • The source Notebook for the demonstration is here. Where did you run into problems applying this? Specifically there is a function BlossomWeightedMatchingCompleteCook; did you already try it? – Mr.Wizard Jul 21 '16 at 21:21
  • Welcome to Mathematica.SE! I suggest the following: 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Take the tour! 3) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign! – Michael E2 Jul 21 '16 at 21:37
  • 1
    @Mr.Wizard Thanks for the reply. Yeah, I did try it, but a few things are unappealing. First, the function BlossomWeightedMatchingCompleteCook takes a randomseed as the second argument, which is involved in generating random weights for edges of the graph. However, I would instead like to specify the weights as input. There are also a couple places with dubious comments (e.g. "strange : removing TODD in same way slows things down"). Finally, there are apparently extraneous things going on unrelated (I think?) to finding the matching, like with saveQ and saveData variables. – anthony mann Jul 21 '16 at 21:54

0 Answers0