Description Usage Arguments Value Author(s) References Examples
View source: R/simu_function.R
Simulation of networks under the framework by Girvan and Newman. The vertices are connected with each other randomly and independents with probability p.in (within same community) and p.out (between communities).
1 2 3 | network.simu(nv = c(32, 32, 32, 32),
p.in = c(0.323, 0.323, 0.323, 0.323),
p.out = 0.0625, p.del = 0)
|
nv |
a vector of community sizes. The number of communities equals the number of elements in this vector. |
p.in |
a vector of probability of a node to be randomly linked to other nodes in the same community. |
p.out |
the probability of a node to be randomly linked to nodes in other communities. |
p.del |
the proportion of links that are randomly deleted. |
net |
The simulated network. |
group |
The membership of vertices. |
Han Yu & Rachael Hageman Blair
Girvan, Michelle, and Mark EJ Newman. "Community structure in social and biological networks." Proceedings of the national academy of sciences 99.12 (2002): 7821-7826.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | ## simulation of a network with four communities, each with size 32
library(wfg)
nv = c(32, 32, 32, 32)
p.in = c(0.452, 0.452, 0.452, 0.452)
p.out = 0.021
p.del = 0
net.simu <- network.simu(nv=nv, p.in=p.in, p.out=p.out, p.del=p.del)
net <- net.simu$net
group <- net.simu$group
## plot simulated network with vertices colored by membership
V(net)$size <- 7
V(net)$color <- group
plot(net, vertex.label='')
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.