gs.sims.sbm: Stochastic-Block Model Graphs

Description Usage Arguments Value Examples

Description

A function to simulate graphs from the Stochastic Block Model (SBM).

Usage

1
2
3
gs.sims.sbm(n, v, priors = c(0.5, 0.5), C = list(list(seq(1, floor(v/2)),
  seq(floor(v/2) + 1, v)), list(seq(1, floor(v/2)), seq(floor(v/2) + 1, v))),
  P = list(matrix(rep(0.5, 4), nrow = 2), matrix(rep(0.5, 4), nrow = 2)))

Arguments

n

the number of graphs.

v

the number of vertices.

priors

the composition of the graphs in each class as a length K vector. Defaults to c(0.5, 0.5). Note that K=length(priors) is the number of classes of graphs, and sum(priors) will be normalized to 1.

C

the community membership of each vertex in each class as a length K list of length(r) lists, where r is the number of communities for class i. Note that K=length(C) is the number of classes of graphs, union(C[[i]][[j]]) over all j communities for class i should be 1:v, and intersect(C[[i]][[j]]) for class i over all j communities should be empty. Defaults to list(list(seq(1, floor(n/2)), seq(floor(n/2)+1, n)), list(seq(1, floor(n/2)),seq(floor(n/2)+1, n))).

P

the matrix of probabilities, where P[[i]][k, l] corresponds to the probability of an edge for class i between communities C[[i]][[k]] and C[[i]][[l]]. Defaults to list(matrix(rep(0.5, 4), nrow=2), matrix(rep(0.5, 4), nrow=2)).

Value

An object of class "Simulation" containing the following:

graphs

[[n]][v, v] the n graphs with v vertices as a list of adjacency matrices.

Y

[n] the class labels for each of the n graphs.

Examples

1
2
library(graphstats)
data <- gs.sims.sbm(100, 10)  # simulate 100 graphs with 10 vertices from the default model

neurodata/graphstats documentation built on May 14, 2019, 5:19 p.m.