aryagraph.algorithms.matching.min_weight_matching#

aryagraph.algorithms.matching.min_weight_matching(g: Graph, weight: str | Callable[[Hashable, Hashable, dict], float] | None = 'weight') → set[tuple[Hashable, Hashable]][source]#

Lightest matching among those of maximum cardinality.

Runs max_weight_matching() with maxcardinality=True on the weights (max_w + 1) - w (the networkx definition): every maximum cardinality matching has the same size, so maximising the transformed total minimises the original one.