stir_PA {netcom} | R Documentation |
Stirs a Preferential Attachment Network
Description
Stirs an already existing network by rewiring a node according to the Preferential Attachment mechanism.
Usage
stir_PA(
matrix,
x,
power,
directed = TRUE,
retcon = FALSE,
sum_v_max = "max",
nascent_help = TRUE
)
Arguments
matrix |
Existing network to experience growth. |
x |
The ID of the node to be rewired (stirred). |
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. |
directed |
Binary variable determining if the network is directed, resulting in off-diagonal asymmetry in the adjacency matrix. |
retcon |
Binary variable determining if already existing nodes can attach to new nodes. Defaults to FALSE. |
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. |
Details
Rewires 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 <- stir_PA(matrix = new_network_prep, x = size + 1, power = 2.15)