Skip to main content

maximum_matching

Function maximum_matching 

Source
pub fn maximum_matching(graph: &Graph) -> IgraphResult<Vec<usize>>
Expand description

Find the maximum matching (brute-force).

Returns edge indices of the largest matching. Only feasible for small graphs.

ยงExamples

use rust_igraph::{Graph, maximum_matching};

// Path 0-1-2-3: max matching has 2 edges
let g = Graph::from_edges(&[(0,1),(1,2),(2,3)], false, Some(4)).unwrap();
let m = maximum_matching(&g).unwrap();
assert_eq!(m.len(), 2);