grow_PA: Grow a Preferential Attachment Network

View source: R/grow_PA.R

grow_PAR Documentation

Grow a Preferential Attachment Network

Description

Grows an already existing network by adding a node according to the Preferential Attachment mechanism. Nodes can only attach to previously grown nodes.

Usage

grow_PA(
  matrix,
  x,
  power,
  sum_v_max = "sum",
  nascent_help = TRUE,
  retcon = FALSE,
  directed = TRUE
)

Arguments

matrix

Existing network to experience growth.

x

The ID of the node to be grown.

power

Power of attachment, which determines how much new nodes prefer to attach to nodes that have many edges compared to few. Needs to be positive.

sum_v_max

Degree distributions must be normalized, either by their "max" or "sum". Defaults to "max".

nascent_help

Should a single edge be added to the degree distribution of all nodes so that nodes with a zero in-degree can still have a chance of being attached to by new nodes. Defaults to TRUE.

retcon

Binary variable determining if already existing nodes can attach to new nodes. Defaults to FALSE.

directed

Binary variable determining if the network is directed, resulting in off-diagonal asymmetry in the adjacency matrix. Defaults to TRUE.

Details

Adds a node in a network according to the Preferential Attachment mechanism.

Value

An adjacency matrix.

References

Barabási, A. L., & Albert, R. (1999). Emergence of scaling in random networks. science, 286(5439), 509-512.

Examples

# Import netcom
library(netcom)

size <- 10
existing_network <- matrix(sample(c(0,1), size = size^2, replace = TRUE), nrow = size, ncol = size)
new_network_prep <- matrix(0, nrow = size + 1, ncol = size + 1)
new_network_prep[1:size, 1:size] = existing_network
new_network <- grow_PA(matrix = new_network_prep, x = size + 1, power = 2.15)


langendorfr/netcom documentation built on July 23, 2022, 5:19 p.m.