Skip to contents

This function samples graphs from a stochastic block model by building a block adjacency matrix from the Parameters N, k, B and c and accounting for a exponential degree sequence inside each block controlled by k_coef.

Usage

sample_dcppm(N, c, k, B, k_coef = 0, directed = FALSE, loops = FALSE)

Arguments

N

Number of vertices in the graph.

c

A number between 0 and 1 controlling the

k

The average degree of a vertex.

B

The number of blocks.

k_coef

A number describing the degree variability within each block. A value of 0 means that all vertices have the same expected degree.#'

directed

Logical scalar, whether to generate a directed graph.

loops

Logical scalar, whether self-loops are allowed in the graph.

Value

An igraph graph.

Examples

## Three groups with only a few connection between groups
G <- sample_dcppm(300, c=0.9, k=10, B=3, k_coef=2)
p <- c(rep(1,100), rep(2, 200), rep(3, 300))
plot(G, vertex.label=NA, vertex.color=p)