Sampling from a hierarchical stochastic block model of networks.
Arguments
- n
Integer scalar, the number of vertices.
- m
Integer scalar, the number of vertices per block.
n / mmust be integer. Alternatively, an integer vector of block sizes, if not all the blocks have equal sizes.- rho
Numeric vector, the fraction of vertices per cluster, within a block. Must sum up to 1, and
rho * mmust be integer for all elements of rho. Alternatively a list of rho vectors, one for each block, if they are not the same for all blocks.- C
A square, symmetric numeric matrix, the Bernoulli rates for the clusters within a block. Its size must mach the size of the
rhovector. Alternatively, a list of square matrices, if the Bernoulli rates differ in different blocks.- p
Numeric scalar, the Bernoulli rate of connections between vertices in different blocks.
See also
Random graph models (games):
bipartite_gnm(),
erdos.renyi.game(),
sample_(),
sample_bipartite(),
sample_chung_lu(),
sample_correlated_gnp(),
sample_correlated_gnp_pair(),
sample_degseq(),
sample_dot_product(),
sample_fitness(),
sample_fitness_pl(),
sample_forestfire(),
sample_gnm(),
sample_gnp(),
sample_grg(),
sample_growing(),
sample_islands(),
sample_k_regular(),
sample_last_cit(),
sample_pa(),
sample_pa_age(),
sample_pref(),
sample_sbm(),
sample_smallworld(),
sample_traits_callaway(),
sample_tree()
Author
Gabor Csardi csardi.gabor@gmail.com
Examples
## Ten blocks with three clusters each
C <- matrix(c(
1, 3 / 4, 0,
3 / 4, 0, 3 / 4,
0, 3 / 4, 3 / 4
), nrow = 3)
g <- sample_hierarchical_sbm(100, 10, rho = c(3, 3, 4) / 10, C = C, p = 1 / 20)
g
#> ── <igraph> Hierarchical stochastic block model ───────────────────── 8cfd957 ──
#> ℹ undirected
#> ℹ 100 vertices · 455 edges
#>
#> ── Attributes ──────────────────────────────────────────────────────────────────
#> → graph: name <chr>, m <dbl>, rho <dbl>, C <dbl>, p <dbl>
#>
#> ── Edges ───────────────────────────────────────────────────────────────────────
#> [1] 1 ─ 2 1 ─ 3 2 ─ 3 3 ─ 4 1 ─ 5 2 ─ 5 3 ─ 5
#> [8] 1 ─ 6 3 ─ 6 6 ─ 7 4 ─ 8 5 ─ 8 6 ─ 8 5 ─ 9
#> [15] 7 ─ 10 8 ─ 10 9 ─ 10 11 ─ 12 11 ─ 13 12 ─ 13 11 ─ 14
#> [22] 12 ─ 14 13 ─ 14 11 ─ 15 12 ─ 15 12 ─ 16 13 ─ 16 14 ─ 17
#> [29] 16 ─ 17 14 ─ 18 15 ─ 18 16 ─ 18 14 ─ 19 15 ─ 19 16 ─ 19
#> [36] 15 ─ 20 16 ─ 20 17 ─ 18 18 ─ 19 17 ─ 20 18 ─ 20 19 ─ 20
#> [43] 21 ─ 22 21 ─ 23 22 ─ 23 21 ─ 24 22 ─ 24 21 ─ 25 22 ─ 25
#> [50] 21 ─ 26 22 ─ 26 23 ─ 26 25 ─ 27 26 ─ 27 24 ─ 28 25 ─ 28
#> [57] 26 ─ 28 25 ─ 29 26 ─ 29 24 ─ 30 25 ─ 30 27 ─ 28 27 ─ 29
#> [64] 28 ─ 30 31 ─ 32 31 ─ 33 32 ─ 33 31 ─ 34 32 ─ 34 31 ─ 35
#> + ... omitted several edges
library("Matrix")
image(g[])
