networkx.algorithms.centrality.trophic_levels

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

Compute the trophic levels of nodes.

The trophic level of a node i is

si=1+1kinijaijsj

where kini is the in-degree of i

kini=jaij

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

These are calculated using the method outlined in Levine 1.

Parameters

G (DiGraph) – A directed networkx graph

Returns

nodes – Dictionary of nodes with trophic level as the vale.

Return type

dict

References

1

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