pub fn maximum_bipartite_matching(
graph: &Graph,
types: &[bool],
) -> IgraphResult<MatchingResult>Expand description
Compute a maximum cardinality matching in an unweighted bipartite graph.
Uses a push-relabel algorithm with greedy initialization and global
relabeling every n/2 steps. Returns a MatchingResult where
matching_weight == matching_size (since all edges have unit weight).
types must be a bipartite partition: types[v] is false for one side
and true for the other. The function validates that every edge connects
vertices of different types.
use rust_igraph::{create, maximum_bipartite_matching};
let g = create(&[(0, 2), (0, 3), (1, 2), (1, 3)], 4, false).unwrap();
let types = vec![false, false, true, true];
let r = maximum_bipartite_matching(&g, &types).unwrap();
assert_eq!(r.matching_size, 2);