Learn R Programming

FusedPCA (version 0.2)

generate: generate adjacency matrix of stochastic blockmodel, degree-corrected block model or cockroach graph model.

Description

To generate an adjacency matrix of stochastic blockmodel, degree-corrected block model or cockroach graph model.

Usage

gen.sbm(n, theta.in, theta.bw, K, seed) gen.dcbm(n, theta.in, theta.bw, theta, K, seed) gen.cr(n1)

Arguments

n1
input integer -- one quarter of the number of nodes in the graph.
n
input integer -- the number of nodes in EACH community.
theta.in
input real number, which is the probability of a within community edge.
theta.bw
input real number, which is the probability of a between community edge.
theta
input vector, of dimension number of nodes in ALL communities, with each entry equal to the individual effect of each node.
K
input integer -- the number of communities.
seed
input integer -- the random seed you can set.

Value

an adjacency matrix.

References

Yang Feng, Richard J. Samworth and Yi Yu, Community Detection via Fused Principal Component Analysis, manuscript. Holland, P.W., Laskey, K.B. and Leinhardt, S., 1983. Stochastic block models: first steps. Social Networks 5, 109-137. Karrer, B. and Newman, M.E.J., 2011. Stochastic blockmodels and community structure in networks. Physical Review E 83, 016107.

Examples

Run this code
A1 = gen.sbm(n = 10, theta.in = 0.3, theta.bw = 0.1, K = 2, seed = 2)
A2 = gen.dcbm(n = 10, theta.in = 0.3, theta.bw = 0.1, 
theta = seq(from = 0.1, to = 0.5, length.out = 20), K = 2, seed = 2)
A3 = gen.cr(n1 = 10)

Run the code above in your browser using DataLab