pub fn hsbm_list_game(
n: u32,
m_list: &[u32],
rho_list: &[Vec<f64>],
c_list: &[Vec<Vec<f64>>],
p: f64,
seed: u64,
) -> IgraphResult<Graph>Expand description
Generate a graph from the per-macro Hierarchical Stochastic Block Model: every macro-block carries its own size, its own micro-block proportions, and its own internal preference matrix.
n— total vertex count. Must equalm_list.iter().sum().m_list— length-Kvector of macro-block sizes. Each entry must be at least 1.rho_list— length-Klist; entrybis the micro-block proportion vector for macro-blockb. Eachrho_list[b]must sum to 1 within√DBL_EPSILON, and everyrho_list[b][j] * m_list[b]must be (within tolerance) an integer.c_list— length-Klist; entrybis thek_b × k_bsymmetric Bernoulli pref matrix for macro-blockb. Entries in[0, 1].p— Bernoulli rate for every edge crossing two distinct macro-blocks. Must lie in[0, 1].seed— initialises an internalSplitMix64PRNG.
The returned graph is always undirected, simple. Vertex ordering
follows the macro-block order: macro b occupies
[sum_{i<b} m_list[i], sum_{i<=b} m_list[i]).
§Errors
Returns IgraphError::InvalidArgument when any of the constraints
above is violated, including length mismatches between m_list,
rho_list, and c_list.
§Examples
use rust_igraph::hsbm_list_game;
// 3 macro-blocks of size 4, 6, 10. Each runs its own inner SBM.
let m_list = vec![4u32, 6, 10];
let rho_list = vec![
vec![1.0], // single cluster
vec![0.5, 0.5], // two equal clusters of 3
vec![0.5, 0.5], // two equal clusters of 5
];
let c_list = vec![
vec![vec![0.5]],
vec![vec![0.4, 0.1], vec![0.1, 0.4]],
vec![vec![0.3, 0.05], vec![0.05, 0.3]],
];
let g = hsbm_list_game(20, &m_list, &rho_list, &c_list, 0.02, 7).unwrap();
assert_eq!(g.vcount(), 20);