Skip to contents

Sampling from the planted partition model as in Piexoto 2014.

Usage

sample_ppm(N, c, k, B, 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.

directed

Logical scalar, whether to generate a directed graph.

loops

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

Value

An igraph graph.

Details

This function samples graphs from a stochastic block model by building a block adjacency matrix from the Parameters N, k, B and c.

Examples

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