Skip to main content

is_gem_free

Function is_gem_free 

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

Check whether a graph is gem-free.

The gem (fan F_{1,3}) is P_4 plus a vertex adjacent to all four path vertices. A gem-free graph has no induced gem.

Returns false for directed graphs.

ยงExamples

use rust_igraph::{Graph, is_gem_free};

// Triangle is gem-free (too few vertices for a gem)
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_gem_free(&g).unwrap());