generate_ER: Simulating networks from the Erdos-Renyi model

Description Usage Arguments Value Author(s) References See Also Examples

View source: R/generate_ER.R

Description

This function generates networks from the Erdős–Rényi model. In this model, the preferential attachment function is a constant function, i.e. A_k = 1, and node fitnesses are all equal to 1. It is a wrapper of the more powerful function generate_net.

Usage

1
2
3
4
  generate_ER(N              = 1000, 
              num_seed       = 2   , 
              multiple_node  = 1   , 
              m              = 1)

Arguments

N

Integer. Total number of nodes in the network (including the nodes in the seed graph). Default value is 1000.

num_seed

Integer. The number of nodes of the seed graph (the initial state of the network). The seed graph is a cycle. Default value is 2.

multiple_node

Positive integer. The number of new nodes at each time-step. Default value is 1.

m

Positive integer. The number of edges of each new node. Default value is 1.

Value

The output is a PAFit_net object, which is a List contains the following four fields:

graph

a three-column matrix, where each row contains information of one edge, in the form of (from_id, to_id, time_stamp). from_id is the id of the source, to_id is the id of the destination.

type

a string indicates whether the network is "directed" or "undirected".

PA

a numeric vector contains the true PA function.

fitness

fitness values of nodes in the network. The fitnesses are all equal to 1.

Author(s)

Thong Pham thongphamthe@gmail.com

References

1. Erdös P. & Rényi A.. On random graphs. Publicationes Mathematicae Debrecen. 1959;6:290–297 (https://snap.stanford.edu/class/cs224w-readings/erdos59random.pdf).

See Also

For subsequent estimation procedures, see get_statistics.

For other functions to generate networks, see generate_net, generate_BA, generate_BB and generate_fit_only.

Examples

1
2
3
4
5
  library("PAFit")
  # generate a network from the ER model with N = 1000 nodes
  net <- generate_ER(N = 1000)
  str(net)
  plot(net)

Example output

List of 4
 $ graph  : num [1:998, 1:3] 2 3 4 5 6 7 8 9 10 11 ...
 $ fitness: Named num [1:1000] 1 1 1 1 1 1 1 1 1 1 ...
  ..- attr(*, "names")= chr [1:1000] "1" "2" "3" "4" ...
 $ PA     : num [1:13] 1 1 1 1 1 1 1 1 1 1 ...
 $ type   : chr "directed"
 - attr(*, "class")= chr "PAFit_net"

PAFit documentation built on Jan. 18, 2022, 1:10 a.m.