sample_hierarchical_sbm: Sample the hierarchical stochastic block model

View source: R/games.R

sample_hierarchical_sbmR Documentation

Sample the hierarchical stochastic block model

Description

Sampling from a hierarchical stochastic block model of networks.

Usage

sample_hierarchical_sbm(n, m, rho, C, p)

hierarchical_sbm(...)

Arguments

n

Integer scalar, the number of vertices.

m

Integer scalar, the number of vertices per block. n / m must 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 * m must 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 rho vector. 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.

...

Passed to sample_hierarchical_sbm().

Details

The function generates a random graph according to the hierarchical stochastic block model.

Value

An igraph graph.

Author(s)

Gabor Csardi csardi.gabor@gmail.com

See Also

sbm.game()

Random graph models (games) erdos.renyi.game(), sample_bipartite(), sample_correlated_gnp_pair(), sample_correlated_gnp(), sample_degseq(), sample_dot_product(), sample_fitness_pl(), sample_fitness(), sample_forestfire(), sample_gnm(), sample_gnp(), sample_grg(), sample_growing(), sample_islands(), sample_k_regular(), sample_last_cit(), sample_pa_age(), sample_pa(), sample_pref(), sample_sbm(), sample_smallworld(), sample_traits_callaway(), sample_tree(), sample_()

Random graph models (games) erdos.renyi.game(), sample_bipartite(), sample_correlated_gnp_pair(), sample_correlated_gnp(), sample_degseq(), sample_dot_product(), sample_fitness_pl(), sample_fitness(), sample_forestfire(), sample_gnm(), sample_gnp(), sample_grg(), sample_growing(), sample_islands(), sample_k_regular(), sample_last_cit(), sample_pa_age(), sample_pa(), sample_pref(), sample_sbm(), sample_smallworld(), sample_traits_callaway(), sample_tree(), sample_()

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
if (require(Matrix)) {
  image(g[])
}

igraph documentation built on Aug. 10, 2023, 9:08 a.m.