Skip to main content

is_maximal_matching

Function is_maximal_matching 

Source
pub fn is_maximal_matching(
    graph: &Graph,
    types: Option<&[bool]>,
    matching: &[Option<u32>],
) -> IgraphResult<bool>
Expand description

Check whether matching is a maximal matching for graph.

A matching is maximal if no unmatched vertex has an unmatched neighbor (respecting bipartite types if given).

use rust_igraph::{create, is_maximal_matching};

let g = create(&[(0, 1), (1, 2)], 3, false).unwrap();
// Only 0-1 matched; vertex 2 is unmatched but has no unmatched neighbor → maximal
let m = vec![Some(1), Some(0), None];
assert!(is_maximal_matching(&g, None, &m).unwrap());