Skip to main content

is_windmill

Function is_windmill 

Source
pub fn is_windmill(graph: &Graph) -> IgraphResult<Option<(u32, u32)>>
Expand description

Check whether a graph is a windmill graph.

A windmill graph has a single hub vertex connected to n copies of K_k (complete graphs of the same size k ≥ 2). The hub is the only vertex shared across copies.

Returns false for directed graphs and non-simple graphs. Returns true for K_1 (trivially Wd(k, 0) for any k).

On success returns Some((k, n)) where k is the clique size and n is the number of cliques. Returns None if not a windmill.

§Examples

use rust_igraph::{Graph, is_windmill};

// Friendship graph: 2 triangles sharing vertex 0
let mut g = Graph::with_vertices(5);
g.add_edge(0, 1).unwrap();
g.add_edge(0, 2).unwrap();
g.add_edge(1, 2).unwrap();
g.add_edge(0, 3).unwrap();
g.add_edge(0, 4).unwrap();
g.add_edge(3, 4).unwrap();
assert_eq!(is_windmill(&g).unwrap(), Some((3, 2)));