trophic_incoherence#
- graph_tool.centrality.trophic_incoherence(g, weight=None, method='levine')[git][source]#
Return the trophic incoherence of a directed graph.
- Parameters:
- g
Graph Directed graph to be used, with edges pointing from prey to predator.
- weight
EdgePropertyMap(optional, default:None) Edge weights. If not given, every edge has unit weight.
- method
str(optional, default:"levine") Definition of the trophic levels and of the incoherence:
"levine"or"mackay".
- g
- Returns:
- incoherence
float The trophic incoherence.
- incoherence
See also
trophic_levelsTrophic levels of the vertices
global_reaching_centralityGlobal reaching centrality
graph_tool.structure.flow_hierarchyFlow hierarchy of a directed graph
Notes
With
method == "levine", the incoherence parameter \(q\) of Johnson et al. [johnson-trophic-2014] is returned, i.e. the standard deviation of the differences \(x_e = s_j - s_i\) of the trophic levels over the edges \(e = (i, j)\),\[q = \sqrt{\frac{\sum_e w_e(x_e - \bar x)^2}{\sum_e w_e}}, \qquad \bar x = \frac{\sum_e w_ex_e}{\sum_e w_e},\]where \(w_e\) is the weight of edge \(e\) (one, if
weightis not given); for these levels \(\bar x = 1\). Withmethod == "mackay", the trophic incoherence \(F_0 = \sum_{ij}w_{ij}(h_j - h_i - 1)^2/\sum_{ij}w_{ij}\) of MacKay et al. [mackay-how-2020] is returned, which lies in \([0, 1]\), where \(w_{ij}\) is the total weight of the edges \(i\to j\). In both cases, zero means a perfectly layered network, and zero is returned for graphs without edges (or with zero total weight). The levels are those oftrophic_levels().References
[johnson-trophic-2014]Samuel Johnson, Virginia Domínguez-García, Luca Donetti and Miguel A. Muñoz, “Trophic coherence determines food-web stability”, Proceedings of the National Academy of Sciences 111, 17923-17928 (2014), DOI: 10.1073/pnas.1409077111 [sci-hub, @tor], arXiv: 1404.7728
[mackay-how-2020]R. S. MacKay, S. Johnson and B. Sansom, “How directed is a directed network?”, Royal Society Open Science 7, 201138 (2020), DOI: 10.1098/rsos.201138 [sci-hub, @tor], arXiv: 2001.05173
Examples
>>> g = gt.Graph([(0, 2), (1, 2), (2, 3), (0, 3)]) >>> print(gt.trophic_incoherence(g)) 0.3535...