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
11
## Generate a graph of 100 nodes with a fixed number of edges
graph1 = gmodel.ER(100,mode='num',par=100)
image(graph1)

## Generate 3 graphs with a global with probability 0.5
graph2 = gmodel.ER(100,par=0.5,rep=3)

par(mfrow=c(1,3))
image(graph2[[1]])
image(graph2[[2]])
image(graph2[[3]])

graphon documentation built on Sept. 21, 2018, 6:26 p.m.