networkx.algorithms.centrality.trophic_differences

trophic_differences(G, weight='weight')[source]

Compute the trophic differences of the edges of a directed graph.

The trophic difference xij for each edge is defined in Johnson et al. 1 as:

xij=sjsi

Where si is the trophic level of node i.

Parameters

G (DiGraph) – A directed networkx graph

Returns

diffs – Dictionary of edges with trophic differences as the value.

Return type

dict

References

1

Samuel Johnson, Virginia Dominguez-Garcia, Luca Donetti, Miguel A. Munoz (2014) PNAS “Trophic coherence determines food-web stability”