stir_SW: Stirs a Small-World Network

View source: R/stir_SW.R

stir_SWR Documentation

Stirs a Small-World Network

Description

Stirs an already existing network by rewiring a node according to the Small-World mechanism.

Usage

stir_SW(matrix, x, rewire, directed = TRUE)

Arguments

matrix

Existing network to experience growth.

x

The ID of the node to be grown.

rewire

Small-World parameter specifying the probability each edge is randomly rewired, allowing for the possiblity of bridges between connected communities.

directed

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

Details

Rewires a node in a network according to the Small-World mechanism.

Value

An adjacency matrix.

References

Watts, D. J., & Strogatz, S. H. (1998). Collective dynamics of ‘small-world’networks. nature, 393(6684), 440-442.

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_SW(matrix = new_network_prep, x = size + 1, rewire = 0.213)


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