pub fn bipartite_iea_game(
n1: u32,
n2: u32,
m: u64,
directed: bool,
mode: BipartiteMode,
seed: u64,
) -> IgraphResult<BipartiteGraph>Expand description
Generate a random bipartite multigraph through independent edge assignment (IEA).
Counterpart of igraph_bipartite_iea_game() from
references/igraph/src/misc/bipartite.c:1476. Each of the m edges is
assigned, independently and uniformly at random, to one of the
max_edges(n1, n2, directed, mode) possible cross-partition vertex
pairs. Because draws are with replacement, the result may contain
parallel edges — unlike bipartite_game_gnm, which samples m
distinct edges.
This model does not sample multigraphs uniformly: a multigraph is
produced with probability proportional to (prod A_ij!)^(-1), so all
simple graphs share one probability while non-simple ones are
down-weighted by their edge multiplicities. See bipartite_game_gnm
for uniform sampling of simple bipartite graphs.
n1,n2,directed,mode,seed— seebipartite_game_gnp.m— exact edge count (no upper bound beyondu64; multi-edges are allowed, sommay exceedmax_edges).
§Errors
Returns IgraphError::InvalidArgument if n1 + n2 overflows u32,
or if m > 0 while the pair space is empty (n1 == 0 or n2 == 0).
§Examples
use rust_igraph::{bipartite_iea_game, BipartiteMode};
let bg = bipartite_iea_game(3, 4, 20, false, BipartiteMode::All, 11).unwrap();
assert_eq!(bg.graph.vcount(), 7);
assert_eq!(bg.graph.ecount(), 20); // multi-edges allowed → exactly m edges
// Every edge crosses the partition.
for eid in 0..bg.graph.ecount() {
let (u, v) = bg.graph.edge(eid as u32).unwrap();
assert_ne!(bg.types[u as usize], bg.types[v as usize]);
}