pub fn full_bipartite(
n1: u32,
n2: u32,
directed: bool,
mode: BipartiteMode,
) -> IgraphResult<FullBipartite>Expand description
Build the complete bipartite graph K_{n1, n2}.
n1 vertices in partition 1, n2 vertices in partition 2.
The result graph has n1 + n2 vertices and n1 × n2 edges
(or 2 × n1 × n2 arcs when directed mutual).
§Errors
IgraphError::InvalidArgument— vertex countn1 + n2overflowsu32, or the edge count overflowsusize.
§Examples
use rust_igraph::{full_bipartite, BipartiteMode};
// K_{2,3} undirected: 5 vertices, 6 edges.
let r = full_bipartite(2, 3, false, BipartiteMode::All).unwrap();
assert_eq!(r.graph.vcount(), 5);
assert_eq!(r.graph.ecount(), 6);
assert_eq!(r.types, vec![false, false, true, true, true]);
// K_{2,3} directed out: 5 vertices, 6 arcs.
let d = full_bipartite(2, 3, true, BipartiteMode::Out).unwrap();
assert_eq!(d.graph.ecount(), 6);
assert!(d.graph.is_directed());
// K_{2,3} directed mutual: 12 arcs.
let m = full_bipartite(2, 3, true, BipartiteMode::All).unwrap();
assert_eq!(m.graph.ecount(), 12);