Learn R Programming

ILSM (version 1.1.0.1)

build_toy_net: Generating an example tripartite network randomly

Description

Generate a binary tripartite network with three groups of nodes (a-, b- and c-nodes) and two subnetworks (P and Q). Subnetwork P contains links between a- and b-nodes; Subnetwork Q contains links between b- and c-nodes;b-nodes (some of which are connector nodes) are shared nodes between two subnetworks.

Usage

build_toy_net(N_a, N_b, N_c, Co, output_matrices = FALSE)

Value

Return a random binary tripartite network.

Arguments

N_a

The number of nodes in the a-node group.

N_b

The number of nodes in the b-node group.

N_c

The number of nodes in the c-node group.

Co

The probability of creating a link between any two nodes. It ranges from 0 to 1.

output_matrices

Logical. Whether to output the entire adjacency matrix of the network and subnetworks. Defaults to FALSE.

References

Pilosof, S., Porter, M., Pascual, M. et al. The multilayer nature of ecological networks. Nat Ecol Evol 1, 0101 (2017). https://doi.org/10.1038/s41559-017-0101

Examples

Run this code

set.seed(12)
Net <- build_toy_net(11,15,16,0.2)
plot(Net)

set.seed(12)
Net <- build_toy_net(11,15,16,0.2,output_matrices=TRUE)
Net

Run the code above in your browser using DataLab