Skip to main content

clique_number

Function clique_number 

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

Returns the clique number of the graph (size of the largest clique).

A clique is a complete subgraph. The clique number is the vertex count of the largest clique. For a graph with no edges, the clique number is 1 (each vertex is a clique of size 1). For an empty graph (no vertices), returns 0.

Edge directions are ignored for directed graphs.

ยงExamples

use rust_igraph::{Graph, clique_number};

// K4 (complete graph on 4 vertices)
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_eq!(clique_number(&g).unwrap(), 4);