NetworkX

Previous topic

networkx.triangles

Next topic

networkx.clustering

networkx.transitivity

transitivity(G)

Compute transitivity.

Finds the fraction of all possible triangles which are in fact triangles. Possible triangles are identified by the number of “triads” (two edges with a shared vertex).

T = 3*triangles/triads

Parameters:

G : graph

A networkx graph

Returns:

out : float

Transitivity

Examples

>>> G=nx.complete_graph(5)
>>> print nx.transitivity(G)
1.0