Skip to main content

is_edge_cover

Function is_edge_cover 

Source
pub fn is_edge_cover(graph: &Graph, cover: &[u32]) -> bool
Expand description

Check whether a set of edge IDs forms a valid edge cover.

An edge cover is valid if every vertex in the graph is incident to at least one edge in the set.

ยงExamples

use rust_igraph::{Graph, is_edge_cover};

let mut g = Graph::with_vertices(4);
g.add_edge(0, 1).unwrap(); // edge 0
g.add_edge(1, 2).unwrap(); // edge 1
g.add_edge(2, 3).unwrap(); // edge 2

assert!(is_edge_cover(&g, &[0, 2]));   // covers all 4 vertices
assert!(!is_edge_cover(&g, &[1]));      // vertices 0, 3 uncovered