Skip to main content

is_strongly_chordal

Function is_strongly_chordal 

Source
pub fn is_strongly_chordal(graph: &Graph) -> IgraphResult<bool>
Expand description

Check whether a graph is strongly chordal.

A strongly chordal graph is chordal with every even cycle having an odd chord. Uses maximum cardinality search to find a PEO, then verifies the strong elimination property.

Directed graphs are treated as undirected.

ยงExamples

use rust_igraph::{Graph, is_strongly_chordal};

// Complete graph is strongly chordal
let mut g = Graph::with_vertices(4);
for i in 0..4u32 {
    for j in (i+1)..4 {
        g.add_edge(i, j).unwrap();
    }
}
assert!(is_strongly_chordal(&g).unwrap());

// Sun graph `S_3` is chordal but NOT strongly chordal
let mut g = Graph::with_vertices(6);
// Inner triangle: 0-1-2
g.add_edge(0, 1).unwrap();
g.add_edge(1, 2).unwrap();
g.add_edge(2, 0).unwrap();
// Outer vertices 3,4,5 each adjacent to one edge of triangle
g.add_edge(3, 0).unwrap();
g.add_edge(3, 1).unwrap();
g.add_edge(4, 1).unwrap();
g.add_edge(4, 2).unwrap();
g.add_edge(5, 2).unwrap();
g.add_edge(5, 0).unwrap();
assert!(!is_strongly_chordal(&g).unwrap());