Generalized Matching Code

A command-line tool for solving generalized matching problems (a.k.a. b-matchings, or degree-constrained subgraphs) is available here. The archive contains binaries for Linux and MacOSX. There is also a precompiled MEX interface for Matlab. To get started follow these instructions. There's a README with more details if you have questions, or if things do not work as expected.

Command-line tool
tar xvfz bmatch.tgz cd bmatch make ./bmatch -h
Matlab tool
tar xvfz bmatch.tgz cd bmatch make ./matlab_bmatch help bmatch

Help file

Usage> bmatch [-arg1 value] [-arg2 value] ... Solves: optimize_Yij sum_ij W_ij Y_ij s.t. l_i <= sum_j Y_ij <= u_i, 1 <= i <= n and Wij and Yij are symmetric Arguments [with default values]: -w -weights [NULL] input file, NULL => std. input -d -degrees [NULL] input file, NULL => std. input -o -output [NULL] output file, NULL => std. output -l -const_l [-1 ] positive integer, negative => std. input -u -const_u [-1 ] positive integer, negative => std. input -s -sparse [0 ] 0 => matrix, 1 => IJW input format -m -method [1 ] selects algorithm -v -verbose [0 ] positive integer Algorithm: 1. exact maxwgt solution using goblin via subgraph complement 2. exact mincost solution using goblin 3. greedy 1/2 approximation to maxwgt solution 4. greedy 1/2 approximation to maxwgt solution with recursion 5. bipartite relaxation to maxwgt solution using belief propagation Notes: Self-loops are handled: a self-loop increases the degree of a node by 2. Weights must be positive (Wij >= 0). Edges with zero-weight (Wij==0) are not allowed to partake in the matching. If the weights, degrees or output file is not specified, then the corresponding input [output] data is entered in [written to] the display. The format should match the examples given in the data directory. Enter a blank line to terminate input of a given data. The output weight is calculated as sum_{i<=j} Wij Yij, except when beleif propagation is used, whose output is not necessarily symmetric. For BP, the output weight is 0.5 * sum_{i,j} Wij Yij. The lower bounds are ignored by methods 3-5. Bipartite relaxation assumes that the degree upper bounds can be met with equality. For Known Issues and Troubleshooting tips, see the full README.
Tutorial
Acknowledgements

Many thanks to Vlad Shchogolev, Bert Huang and Blake Shaw for their code and examples. Blake has helped to improve the robustness of the code. Vlad implemented prototypes. This tool integrates Bert's BP code directly. For a stand-alone BP implementation, please visit Bert's page.

This tool links to the impressive Goblin Graph Library and LGPL licensing issues apply. To experiment with this library, please download the source code directly from the Goblin site. I would be happy to share the source that has been modified slightly for Mac OS X.