η(N::T, dims::Union{Nothing,Integer}=nothing) where {T <: Union{BipartiteNetwork, BipartiteProbaNetwork}}

Returns the nestedness of a margin of the network, using η. The second argument can be 1 (for nestedness of rows/top level) or 2 (for nestedness of columns/bottom level). Leaving it at nothing will measure the nestedness of the entire network.


  • Bastolla, U., Fortuna, M.A., Pascual-García, A., Ferrera, A., Luque, B., Bascompte, J., 2009. The architecture of mutualistic networks minimizes competition and increases biodiversity. Nature 458, 1018–1020.

  • Poisot, T., Cirtwill, A.R., Cazelles, K., Gravel, D., Fortin, M.-J., Stouffer, D.B., 2016. The structure of probabilistic networks. Methods in Ecology and Evolution 7, 303–312.

nodf(N::T; dims::Union{Nothing,Integer}=nothing) where {T <: Union{BipartiteNetwork,BipartiteQuantitativeNetwork}}

Returns nodf for a margin of the network. The i argument can be 1 for top-level, 2 for bottom level, and the function will throw an ArgumentError if an invalid value is used. For quantitative networks, WNODF is used.


Almeida-Neto, M., Guimarães, P.R., Loyola, R.D., Ulrich, W., 2008. A consistent metric for nestedness analysis in ecological systems: reconciling concept and measurement. Oikos 117, 1227–1239.

Almeida-Neto, M., Ulrich, W., 2011. A straightforward computational approach for measuring nestedness using quantitative matrices. Environmental Modelling & Software 26, 173–178.

ρ(N::T; range=EcologicalNetworks.ρ_ska) where {T <: UnipartiteNetwork}

Returns the spectral radius (the absolute value of the largest real part of the eigenvalues of the adjacency matrix) of any unipartite network whose interactions are positive or null. The spectral radius is measured on the mirrored version of the matrix, so that an interaction from i to j also implies an interaction from j to i.

Note that the spectral radius has been suggested as a measure of nestedness by Staniczenko et al. (2013). Phillips (2011) uses it as a measure of the ability of a system to dampen or absorb perturbations.

Maximal values

The spectral radius is sensitive to network size, and to a certain extent to the number of links. The keyword argument range will divide return a ranged version of the spectral radius, so that it is expressed relatively to its maximal value. The range argument takes a function, which requires two arguments: the network (which must be unipartite), and the value of the spectral radius.

Options that come with EcologicalNetworks.jl (where L is the number of links and S the number of nodes) are:

  1. EcologicalNetworks.ρ_phillips: divides by the square root of (2L(S-1))/S, as in Phillips (20110)
  2. EcologicalNetworks.ρ_ska: divides by the square root of L, as in Staniczenko et al. (2013) - this is the default, and has an upper bound of the square root of the number of links
  3. EcologicalNetworks.ρ_raw: returns the raw value


  • Phillips, J.D., 2011. The structure of ecological state transitions: Amplification, synchronization, and constraints in responses to environmental change. Ecological Complexity, 8, 336–346.

  • Staniczenko, P.P.A., Kopp, J.C., Allesina, S., 2013. The ghost of nestedness in ecological networks. Nat Commun 4, 1391.

ρ(N::T; varargs...) where {T <: BipartiteNetwork}

Bipartite version of the spectral radius. In practice, this casts the network into its unipartite representation, since the spectral radius only makes sense for square matrices.