gmodel.ER: Observations from Erdos-Renyi random graph model

Description Usage Arguments Details Value References Examples

View source: R/gmodel.ER.R

Description

Erdos-Renyi random graph model is one of the most popular and fundamental examples in modeling networks. Given n nodes, gmodel.ER generates edges randomly from Bernoulli distribution with a globally specified probability.

Usage

1
gmodel.ER(n, mode = "prob", par = 0.5, rep = 1)

Arguments

n

the number of nodes to be generated

mode

'prob' (default) for edges to be drawn from Bernoulli distribution independently, or 'num' for a graph to have a fixed number of edges placed randomly

par

a real number \in [0,1] for mode='prob', or a positive integer \in [1, n*(n-1)/2] for mode='num'

rep

the number of observations to be generated.

Details

In network science, 'ER' model is often interchangeably used in where we have fixed number of edges to be placed at random. The original use of edge-generating probability is from Gilbert (1959). Therefore, we set this algorithm to be flexible in that user can create either a fixed number of edges placed at random or set global edge-generating probability and draw independent observations following Bernoulli distribution.

Value

depending on rep value, either

(rep=1)

an (n\times n) observation matrix, or

(rep>1)

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

References

\insertRef

Erdos1959graphon

\insertRef

Gilbert1959graphon

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
## generate 3 graphs with a global with probability 0.5
graph3 = gmodel.ER(100,par=0.5,rep=3)

## visualize
opar = par(no.readonly=TRUE)
par(mfrow=c(1,3), pty="s")
image(graph3[[1]], main="1st sample")
image(graph3[[2]], main="2nd sample")
image(graph3[[3]], main="3rd sample")
par(opar)

graphon documentation built on Aug. 13, 2021, 5:06 p.m.