Expand description
Full multipartite graph constructor (ALGO-CN-026).
Counterpart of igraph_full_multipartite() in
references/igraph/src/constructors/full.c:154-247.
A complete (full) multipartite graph on partitions of sizes
n_0, n_1, …, n_{k-1} is the graph whose vertex set is the disjoint
union of the k partitions, with an edge between every pair of
vertices that belong to different partitions and no edge between
vertices that share a partition.
Vertices are laid out in partition-major order:
partition 0: vertices [0, n_0)
partition 1: vertices [n_0, n_0 + n_1)
…
partition k: vertices [Σ n_i (i < k), Σ n_i (i ≤ k))Edge orientation is governed by MultipartiteMode:
MultipartiteMode::Out(directed only) — emit(from, to)wherefromlives in the earlier partition (lower partition index).MultipartiteMode::In(directed only) — emit(to, from), reversing every arc.MultipartiteMode::All— for directed graphs, emit both(from, to)and(to, from)per pair (mutual). For undirected graphs this is the only meaningful setting;OutandIncollapse to the same edge multiset, so we acceptAllas the canonical choice and treatOut/Inas equivalent.
Edge counts:
- Empty partition list (
k = 0) — empty graph, no vertices. E_undirected = Σ_{i < j} n_i · n_j, equivalently½ · Σ_i n_i · (N − n_i)whereN = Σ_i n_i.- Directed
Out/Inarc count equalsE_undirected. - Directed
Allarc count equals2 · E_undirected.
The returned FullMultipartite bundles the constructed Graph
with a types vector that records the partition index of every
vertex (types[v] is the partition v lives in), matching the
optional types out-parameter of the upstream C entry point.
Degenerate cases:
partitions == &[]→ empty graph (vcount = 0,types == []).- Any individual
n_i == 0→ that partition contributes no vertices and no edges; later partitions are still numbered consecutively in the natural way. partitions == &[n](single partition) → graph withnisolated vertices, no edges,types == [0; n].
Time complexity: O(|V| + |E|).
Structs§
- Full
Multipartite - Bundled return type of
full_multipartite.
Enums§
- Multipartite
Mode - Direction policy for
full_multipartite.
Functions§
- full_
multipartite - Build the complete (full) multipartite graph on the given partitions.