Vladimir Kolmogorov published a C++ implementation of his Blossom-V algorithm for solving minimum-cost perfect matching in graphs.
That code is not under a free license, but available for evaluation and research purposes. A commercial version is available at https://xip.uclb.com/product/BlossomV. Notably, redistribution of the code is not permitted, thus this repository only includes a patch file with our changes.
We also include a CMakeLists.txt
for seamless integration into CMake based projects
that will automatically download and patch the source.
Note that the GEOM module is not compiled, it was not necessary for our uses. We'll happily accept well-tested pull requests though.
- Wrap everything in
namespace BlossomV
to avoid namespace pollution - Use
int64_t
for the cost typeREAL
instead of the originalint
.- Change some
int*
weight params that should beREAL*
for compatibility with non-intREAL
- Instantiate
MinCost
andDualMinCost
forint64_t
- Change some
add_subdirectory(path/to/blossom5-cmake)
target_link_libraries(your_target PRIVATE Blossom5::Blossom5)
By default, Blossom-V is built as static libray, but the BUILD_SHARED_LIBS
cmake option
allows creating a shared library instead.
Note: Be sure to obey the terms of the Blossom-V license!
The contents of this repository (excluding Blossom-V itself), e.g., our contributions, are available under the Unlicense -- i.e., public domain, do with it whatever you like :-) We'd be very happy about a brief email if you do use it though :-)
Author: Martin Heistermann martin.heistermann@unibe.ch