Warning
This documents an unmaintained version of NetworkX. Please upgrade to a maintained version and see the current NetworkX documentation.
transitivity¶
-
transitivity
(G)[source]¶ Compute graph transitivity, the fraction of all possible triangles present in G.
Possible triangles are identified by the number of “triads” (two edges with a shared vertex).
The transitivity is
T=3#triangles#triads.Parameters: G : graph
Returns: out : float
Transitivity
Examples
>>> G = nx.complete_graph(5) >>> print(nx.transitivity(G)) 1.0