Skip to content

Permutations of networks

Abstract

The methods presented in this page perform network permutation, i.e. they move interactions around while also respecting a number of constraints. Permutations are used in null hypothesis testing, or can be used alongside e.g. simulated annealing to bring networks closer to a specified structure.

The functions for permutations are using an edge-swap algorithm, in which the endpoint of interactions is switched to re-wire the network without changing the degree distribution. Each call to the swap! function will modify the network, and perform a single edge swap.

Maximum iterations when doing permutations

Every permutation will try up to SpeciesInteractionNetworks.SWAP_MAXITER times (defaults to 100) to find a suitable pair of edges to swap, and then return the network unshuffled if they failed to find a suitable pair of edges to swap. This value can be changed.

Permutation constraints

Permutations are constrained, in that we can guarantee that the resulting network may have structural properties that are similar to the original network. The type of constraint we apply is determined by the PermutationConstrant enumerated type.

# SpeciesInteractionNetworks.PermutationConstraintType.

PermutationConstraint

The PermutationConstraint specifies which structural constraint is enforced. It is defined as an abstract type, and the subtypes can be passed as the second argument to swap!.

Currently supported constraints are Degree (degree distribution is maintained), Generality (number of out-going links is maintained), Vulnerability (number of in-going links is maintained), and Connectance (only the connectance is maintained). Note that in addition, species cannot become disconnected, even if the constraint is not acting on the degree / degree distribution.

source

Permutation of a network

Note that the permutations are currently limited to networks with Binary interactions.

# SpeciesInteractionNetworks.swap!Function.

swap!(N::SpeciesInteractionNetwork{<:Partiteness, <:Binary})

Performs one swap of interactions in the network. If no PermutationConstraint is given as a second argument, the degree distribution of all species will be maintained.

source

swap!(N::SpeciesInteractionNetwork{<:Partiteness, <:Binary}, ::Type{Degree})

Permutations with a constraint by degree work by picking two interacting species pairs, (r1, s1) and (r2, s2), and trying to replace them by (r1, s2) and (r2, s1).

source

swap!(N::SpeciesInteractionNetwork{<:Partiteness, <:Binary}, ::Type{Generality})

Permutations with a constraint by degree work by picking one interacting species pair, (r1, s1), and a new stem species s3, trying to replace them by (r1, s3). This function only applies if the result of this permutations does not remove the last incoming link from s1.

source

swap!(N::SpeciesInteractionNetwork{<:Partiteness, <:Binary}, ::Type{Connectance})

Permutations with a constraint by connectance will randomly (and with equal probability) perform a move that is constrained by degree, generality, or vulnerability.

source