pub fn iea_game(
n: u32,
m: u64,
directed: bool,
loops: bool,
seed: u64,
) -> IgraphResult<Graph>Expand description
Generate a random multigraph through independent edge allocation.
n— number of vertices.m— number of edges to draw. The result graph has exactlymedges (including any multi-edges or self-loops that occur).directed— generate a directed graph. Whenfalse, the sampled ordered pair is stored as an undirected edge.loops— whentrue, the sampler may place self-loop edges(u, u). Whenfalse, the diagonal of the pair space is excluded and every edge connects two distinct vertices.seed— initialises an internalSplitMix64PRNG. Same(n, m, directed, loops, seed)always yields the same graph.
§Errors
Returns IgraphError::InvalidArgument when:
mexceeds the internalu32::MAXedge cap.m > 0andn == 0(no vertices to place edges on).m > 0,loops == false, andn < 2(no non-self pairs exist).
§Examples
use rust_igraph::iea_game;
// Directed multigraph: 100 vertices, 500 edges, self-loops allowed.
let g = iea_game(100, 500, true, true, 0xDEAD_BEEF).unwrap();
assert_eq!(g.vcount(), 100);
assert_eq!(g.ecount(), 500);
assert!(g.is_directed());