network.simu: Simulation of Networks with Community Structures

Description Usage Arguments Value Author(s) References Examples

View source: R/simu_function.R

Description

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).

Usage

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)

Arguments

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.

Value

net

The simulated network.

group

The membership of vertices.

Author(s)

Han Yu & Rachael Hageman Blair

References

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.

Examples

 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='')

wfg documentation built on May 2, 2019, 9:43 a.m.

Related to network.simu in wfg...