Skip to main content

is_valid_matching

Function is_valid_matching 

Source
pub fn is_valid_matching(
    graph: &Graph,
    edge_indices: &[usize],
) -> IgraphResult<bool>
Expand description

Check whether a matching is valid.

A valid matching has no two edges sharing an endpoint.

ยงExamples

use rust_igraph::{Graph, greedy_matching, is_valid_matching};

let g = Graph::from_edges(&[(0,1),(1,2),(2,3)], false, Some(4)).unwrap();
let m = greedy_matching(&g).unwrap();
assert!(is_valid_matching(&g, &m).unwrap());