nocad.matching.edge_classes#
- nocad.matching.edge_classes(adj, matching=None)[source]#
Class of every edge across all maximum matchings (Liu et al. 2011).
- Returns:
- classes
dictmapping(start,end)to"critical"(ineverymaximummatching: removing it increases the number of driver nodes),
"ordinary"(in some) or"redundant"(in none: removing it never changes the driver nodes).
- classes
Notes
Orient the bipartite graph: non-matching edges \(x_j^+\to x_i^-\), matching edges \(x_i^-\to x_j^+\). An edge belongs to some maximum matching iff it is matched, or lies on an alternating cycle (its endpoints are in one strongly connected component of the oriented graph), or on an even alternating path from a free vertex (its tail is reachable from a free out-copy, or its head reaches a free in-copy). A matched edge avoids some maximum matching under the same conditions. This is the linear-time characterization of maximally matchable edges (Tassa 2012).
Examples
>>> c = edge_classes([[0, 1, 0], [0, 0, 1], [0, 0, 0]]) >>> c[(0, 1)], c[(1, 2)] ('critical', 'critical')