pub fn stochastic_block_model<R: Rng>(
block_sizes: &[usize],
block_matrix: &[Vec<f64>],
rng: &mut R,
) -> Result<Graph<usize, f64>>
Expand description
Generates a graph using the Stochastic Block Model (SBM)
The SBM generates a graph where nodes are divided into communities (blocks) and edge probabilities depend on which communities the nodes belong to.
§Arguments
block_sizes
- Vector specifying the size of each block/communityblock_matrix
- Probability matrix where entry (i,j) is the probability of an edge between nodes in block i and block jrng
- Random number generator
§Returns
Result<Graph<usize, f64>>
- The generated graph with node IDs 0..n-1 where nodes 0..block_sizes[0]-1 are in block 0, etc.