networkx.algorithms.matching.min_weight_matching

min_weight_matching(G, maxcardinality=False, weight='weight')[source]

Use reciprocal edge weights to find max reciprocal weight matching.

This method replaces the weights with their reciprocal and then runs max_weight_matching(). Read the documentation of max_weight_matching for more information.

Parameters
GNetworkX graph

Undirected graph

maxcardinality: bool, optional (default=False)

If maxcardinality is True, compute the maximum-cardinality matching with minimum weight among all maximum-cardinality matchings.

weight: string, optional (default=’weight’)

Edge data key corresponding to the edge weight. If key not found, uses 1 as weight.

Returns
matchingset

A minimal weight matching of the graph.