pub fn is_c4_free(graph: &Graph) -> IgraphResult<bool>Expand description
Check whether a graph is C_4-free (no induced 4-cycle).
An induced C_4 is a set of 4 vertices {a, b, c, d} with edges
{ab, bc, cd, da} and no diagonals (ac, bd both absent).
Returns false for directed graphs.
ยงExamples
use rust_igraph::{Graph, is_c4_free};
// Triangle is `C_4`-free
let mut g = Graph::with_vertices(3);
g.add_edge(0, 1).unwrap();
g.add_edge(1, 2).unwrap();
g.add_edge(2, 0).unwrap();
assert!(is_c4_free(&g).unwrap());
// 4-cycle is NOT `C_4`-free
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();
g.add_edge(3, 0).unwrap();
assert!(!is_c4_free(&g).unwrap());