Skip to main content

is_biclique

Function is_biclique 

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

Check whether a graph is a complete bipartite graph (biclique).

Returns false for directed graphs. Returns true for the empty graph (vacuously). Returns true for a single vertex (trivial K_{1,0}).

Self-loops and multi-edges cause false (not simple bipartite).

ยงExamples

use rust_igraph::{Graph, is_biclique};

// K_{2,3}: complete bipartite
let mut g = Graph::with_vertices(5);
g.add_edge(0, 2).unwrap();
g.add_edge(0, 3).unwrap();
g.add_edge(0, 4).unwrap();
g.add_edge(1, 2).unwrap();
g.add_edge(1, 3).unwrap();
g.add_edge(1, 4).unwrap();
assert!(is_biclique(&g).unwrap());

// P4 is NOT a biclique (bipartite but not complete bipartite)
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_biclique(&g).unwrap());