pub fn is_trivially_perfect(graph: &Graph) -> IgraphResult<bool>Expand description
Check whether a graph is trivially perfect.
A trivially perfect graph (quasi-threshold graph) has no induced
P_4 or C_4. Equivalently, every connected induced subgraph
has a universal vertex.
Returns false for directed graphs.
ยงExamples
use rust_igraph::{Graph, is_trivially_perfect};
// Star `K_{1,3}` is trivially perfect
let mut g = Graph::with_vertices(4);
g.add_edge(0, 1).unwrap();
g.add_edge(0, 2).unwrap();
g.add_edge(0, 3).unwrap();
assert!(is_trivially_perfect(&g).unwrap());
// `P_4` (path of 4 vertices) is NOT trivially perfect
let mut g = Graph::with_vertices(4);
g.add_edge(0, 1).unwrap();
g.add_edge(1, 2).unwrap();
g.add_edge(2, 3).unwrap();
assert!(!is_trivially_perfect(&g).unwrap());