Method to compute trophic levels using graph Laplacian using the method described in MacKay et al 2020.

compute_TL(metanetwork)

# S3 method for metanetwork
compute_TL(metanetwork)

Arguments

metanetwork

object of class 'metanetwork'

Value

an object of class 'metanetwork', with computed trophic levels stored as node attribute TL

NULL

Details

Let \(A\) be the adjacency matrix of the considered network and \(D\) its degree diagonal matrix. The Laplacian matrix of the symmetrised network is defined by: $$L = D - A - t(A)$$ With \(v = indegree(G) - outdegree(G)\) the imbalance degree vector, the trophic level \(x\) is defined as the solution of: $$Lx = v$$ For a connected network, the solution is unique up to a translation. We then fix the minimum trophic level value at 0 thus fixing trophic levels of all others species. Local networks may be disconnected due to sampling effect. In that case, we fix the minimum value on each connected component.

References

MacKay, R. S., Johnson, S., & Sansom, B. (2020). How directed is a directed network?. Royal Society open science, 7(9), 201138.

Examples

library(metanetwork)
library(igraph)

#on angola dataset
data(meta_angola)
meta_angola  = compute_TL(meta_angola)
V(meta_angola$metaweb)$TL
#>  [1] 1.5819853 1.3046314 1.8207464 2.2772862 1.9374378 1.9280135 2.5847122
#>  [8] 1.9150426 1.8696796 0.9721697 2.1079731 1.0974520 1.3157930 1.6233394
#> [15] 2.0829452 1.8709379 2.7391262 2.1144788 1.3122002 0.9820602 2.5636889
#> [22] 2.1213395 1.0005468 0.9115165 0.8937117 0.6906842 0.1142234 0.0000000