trophic_levels#

trophic_levels(G, weight='weight')[source]#

Compute the trophic levels of nodes.

The trophic level of a node i is

si=1+1kiinjaijsj

where kiin is the in-degree of i

kiin=jaij

and nodes with kiin=0 have si=1 by convention.

These are calculated using the method outlined in Levine [1].

Parameters:
GDiGraph

A directed networkx graph

Returns:
nodesdict

Dictionary of nodes with trophic level as the value.

References

[1]

Stephen Levine (1980) J. theor. Biol. 83, 195-207