# Food-web specific measures

## Measures of trophic level

These measure work by counting the distance to a primary producer – where "primary producer" is defined as the fact of not having outgoing interactions. Primary producers have a trophic level of 1, and species that consume primary producers have trophic levels of 2, etc. This represents a species' fractional trophic level.

# EcologicalNetwork.fractional_trophic_levelFunction.

Fractional trophic level

fractional_trophic_level(N::Union{UnipartiteNetwork, UnipartiteQuantiNetwork})


As defined by Pauly & Palomares.

This function takes a unipartite network, either deterministic or quantitative, as its input. There is currently no trophic rank formulation for probabilistic networks.

The primary producers have a rank of 1, and species consuming any species of maximal level $n$ have level $n+1$.

Note that the trophic level is measured on the network with self-interactions removed.

julia> stony() |> fractional_trophic_level |> maximum
5.0

julia> stony() |> fractional_trophic_level |> minimum
1.0


Pauly, D., Palomares, M.-L., 2005. Fishing down marine food web: it is far more pervasive than we thought. Bulletin of Marine Science 76, 197–212.

Because some species higher-up the food chain eat preys at various fractional trophic levels, there is also a more integrative measure – the trophic level of a species is the weighted average of the fractional trophic level of its preys:

# EcologicalNetwork.trophic_levelFunction.

Trophic level

trophic_level(N::Union{UnipartiteNetwork, UnipartiteQuantiNetwork})


As defined by Pauly & Palomares.

This function weighs the fractional trophic level as returned by fractional_trophic_level by the proportion of the prey in the predator's diet. Specifically, this is done with:

$\text{TL}i = 1 + \sum} \left(\mathbf{f}j\times\mathbf{D}\right)$

The $\mathbf{j}$ array has the fractional trophic levels, and $mathbf{D}$ is the matrix with diet proportions. $\mathbf{D}{ij}$ is $0.0$ for all non-consumed preys. In a quantitative network, it is $\mathbf{A}/\sum\mathbf{A}{i\dot}$, and it is the same in deterministic networks although it works out to $1 / k(i)$ in the end.

As for fractional_trophic_level, this function is applied to the network without self-edges.

Pauly, D., Palomares, M.-L., 2005. Fishing down marine food web: it is far more pervasive than we thought. Bulletin of Marine Science 76, 197–212.

## Measures of trophic positions

For every species in a food web, this will return an array with its overall position:

# EcologicalNetwork.foodweb_positionFunction.

Relative food web position

foodweb_position(N::UnipartiteNetwork)


Returns the trophic positions (:top, :intermediate, or :bottom) of species in a food web. Uses a keyword argument loops to decide whether self-interactions should count – this is false by default, so the network is used without self-interactions.

Relative food web position

foodweb_position(N::UnipartiteQuantiNetwork; loops::Bool=false)


Returns the trophic position based on the adjacency matrix.