networkx 2.8.2 Pypi GitHub Homepage
Other Docs
ParametersReturns
trophic_levels(G, weight='weight')

The trophic level of a node $i$ is

$$s_i = 1 + \frac{1}{k^{in}_i} \sum_{j} a_{ij} s_j$$

where $k^{in}_i$ is the in-degree of i

$$k^{in}_i = \sum_{j} a_{ij}$$

and nodes with $k^{in}_i = 0$ have $s_i = 1$ by convention.

These are calculated using the method outlined in Levine .

Parameters

G : DiGraph

A directed networkx graph

Returns

nodes : dict

Dictionary of nodes with trophic level as the value.

Compute the trophic levels of nodes.

Examples

See :

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


GitHub : /networkx/algorithms/centrality/trophic.py#9
type: <class 'function'>
Commit: