Warning
This documents an unmaintained version of NetworkX. Please upgrade to a maintained version and see the current NetworkX documentation.
average_clustering¶
-
average_clustering(G, trials=1000)[source]¶ Estimates the average clustering coefficient of G.
The local clustering of each node in
is the fraction of triangles
that actually exist over all possible triangles in its neighborhood.
The average clustering coefficient of a graph
is the mean of
local clusterings.This function finds an approximate average clustering coefficient for G by repeating
times (defined in
) the following
experiment: choose a node at random, choose two of its neighbors
at random, and check if they are connected. The approximate
coefficient is the fraction of triangles found over the number
of trials [1].Parameters: - G (NetworkX graph) –
- trials (integer) – Number of trials to perform (default 1000).
Returns: c – Approximated average clustering coefficient.
Return type: References
[1] Schank, Thomas, and Dorothea Wagner. Approximating clustering coefficient and transitivity. Universität Karlsruhe, Fakultät für Informatik, 2004. http://www.emis.ams.org/journals/JGAA/accepted/2005/SchankWagner2005.9.2.pdf