pub fn is_complete_bipartite(graph: &Graph) -> IgraphResult<bool>Expand description
Check whether a graph is complete bipartite.
Returns true if the graph is isomorphic to K_{m,n} for some
m, n ≥ 1. Uses the bipartite check to find the two parts, then
verifies that the edge count equals m * n.
Directed graphs are treated as undirected.
§Examples
use rust_igraph::{Graph, is_complete_bipartite};
// `K_{2,3}`: 2 vertices connected to 3 vertices
let mut g = Graph::with_vertices(5);
for i in 0..2u32 {
for j in 2..5u32 {
g.add_edge(i, j).unwrap();
}
}
assert!(is_complete_bipartite(&g).unwrap());
// `C_6`: bipartite but not complete bipartite
let mut g = Graph::with_vertices(6);
for i in 0..6u32 {
g.add_edge(i, (i + 1) % 6).unwrap();
}
assert!(!is_complete_bipartite(&g).unwrap());