pub fn is_matching(
graph: &Graph,
types: Option<&[bool]>,
matching: &[Option<u32>],
) -> IgraphResult<bool>Expand description
Check whether matching is a valid matching for graph.
A matching vector has length vcount; entry i is Some(j) when vertex
i is matched to j, or None if unmatched. The function verifies:
- Length equals
vcount. - Matched pairs are mutual (
matching[i] == Some(j)⟹matching[j] == Some(i)). - Every matched pair is connected by an edge (ignoring direction).
- If
typesis provided, matched vertices have different types.
use rust_igraph::{create, is_matching};
let g = create(&[(0, 1), (1, 2)], 3, false).unwrap();
let m = vec![Some(1), Some(0), None];
assert!(is_matching(&g, None, &m).unwrap());