gmodel.block: Generate binary random graphs based on stochastic blockmodel

Description Usage Arguments Value See Also Examples

View source: R/gmodel.block.R

Description

Given a (K-by-K) stochastic blockmodel W, gmodel.block generates an (n-by-n) binary random graphs. All K blocks have same number of nodes, or almost identical if n is not a multiple of K. Parameter noloop controls whether generated observations have an edge from a node to itself, called a loop.

Usage

1
gmodel.block(W, n, rep = 1, noloop = TRUE)

Arguments

W

a (K-by-K) blockmodel matrix.

n

the number of nodes for each observation.

rep

the number of observations to be generated.

noloop

a logical value; TRUE for graphs without self-loops, FALSE otherwise.

Value

a named list containing

G

depending on rep value,

(rep=1)

an (n-by-n) observation, or

(rep>1)

a length-rep list where each element is an observation is an (n-by-n) realization from the model.

P

an (n-by-n) probability matrix of generating each edge.

See Also

gmodel.P

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
## set inputs
W = matrix(c(0.9,0.2,0.2,0.7),nr=2)
n = 200

## generate 2 observations without self-loops.
out <- gmodel.block(W,n,rep=2,noloop=TRUE)

## Visualize generated graphs
par(mfrow=c(1,2))
image(out$G[[1]]); title("Observation 1")
image(out$G[[2]]); title("Observation 2")

graphon documentation built on Nov. 17, 2017, 5:28 a.m.