pub fn full_multipartite(
partitions: &[u32],
directed: bool,
mode: MultipartiteMode,
) -> IgraphResult<FullMultipartite>Expand description
Build the complete (full) multipartite graph on the given partitions.
partitions[i] gives the number of vertices in partition i.
The empty slice yields an empty graph and an empty types vector.
See the module documentation for the precise semantics of
MultipartiteMode and the vertex / edge layout.
§Errors
IgraphError::InvalidArgument— the total vertex countΣ partitions[i]overflowsu32, or the (intermediate) edge count overflowsusize. The overflow checks mirror the upstreamIGRAPH_SAFE_ADD/IGRAPH_SAFE_MULTguards.
§Examples
use rust_igraph::{full_multipartite, MultipartiteMode};
// Complete bipartite K_{2,3} on 5 vertices, undirected → 6 edges.
let result = full_multipartite(&[2, 3], false, MultipartiteMode::All).unwrap();
assert_eq!(result.graph.vcount(), 5);
assert_eq!(result.graph.ecount(), 6);
assert_eq!(result.types, vec![0, 0, 1, 1, 1]);
// Same partitions, directed mutual → 12 arcs.
let dir = full_multipartite(&[2, 3], true, MultipartiteMode::All).unwrap();
assert_eq!(dir.graph.ecount(), 12);