compute_TL | R Documentation |
Method to compute trophic levels using graph Laplacian using the method described in MacKay et al 2020.
compute_TL(metanetwork)
## S3 method for class 'metanetwork'
compute_TL(metanetwork)
metanetwork |
object of class 'metanetwork' |
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.
an object of class 'metanetwork', with computed trophic levels stored as node attribute TL
NULL
MacKay, R. S., Johnson, S., & Sansom, B. (2020). How directed is a directed network?. Royal Society open science, 7(9), 201138.
library(metanetwork)
library(igraph)
#on angola dataset
data(meta_angola)
meta_angola = compute_TL(meta_angola)
V(meta_angola$metaweb)$TL
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.