gmodel.ER {graphon} | R Documentation |
Observations from Erdos-Renyi random graph model
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
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 |
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
Erdös P, Rényi A (1959). “On Random Graphs I.” Publicationes Mathematicae Debrecen, 6, 290.
Gilbert EN (1959). “Random Graphs.” Ann. Math. Statist., 30(4), 1141–1144.
Examples
## 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)