Skip to main content

maximum_bipartite_matching

Function maximum_bipartite_matching 

Source
pub fn maximum_bipartite_matching(
    n_rows: usize,
    n_cols: usize,
    edges: &[(usize, usize)],
) -> Result<BipartiteMatching, ErrorsJSL>
Expand description

A maximum-cardinality matching (SciPy’s maximum_bipartite_matching) by the Hopcroft-Karp algorithm, O(E √V): each phase finds, by a breadth-first search from all free rows, the length of the shortest augmenting paths, then augments along a maximal set of vertex-disjoint paths of that length by depth-first searches. Maximum matchings are not unique; SciPy may return a different one of the same size.