Learn R Programming

CDatanet (version 2.2.1)

simnetwork: Simulating Network Data

Description

simnetwork generates adjacency matrices based on specified probabilities.

Usage

simnetwork(dnetwork, normalise = FALSE)

Value

A list of (row-normalized) adjacency matrices.

Arguments

dnetwork

A list of sub-network matrices, where the (i, j)-th position of the m-th matrix represents the probability that individual i is connected to individual j in the m-th network.

normalise

A boolean indicating whether the returned matrices should be row-normalized (TRUE) or not (FALSE).

Examples

Run this code
# Generate a list of adjacency matrices
## Sub-network sizes
N         <- c(250, 370, 120)  
## Probability distributions
dnetwork  <- lapply(N, function(x) matrix(runif(x^2), x))
## Generate networks
G         <- simnetwork(dnetwork)

Run the code above in your browser using DataLab