Generate binary random graphs based on stochastic blockmodel
Generate binary random graphs based on stochastic blockmodel
Given a (K×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.
gmodel.block(W, n, rep =1, noloop =TRUE)
Arguments
W: a (K×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.
Returns
a named list containing
G: depending on rep value,
- **(rep=1)**: an $(n\times n)$ observation, or
- **(rep>1)**: a length-`rep` list where each element is an observation is an $(n\times n)$ realization from the model.
P: an (n×n) probability matrix of generating each edge.