Compute the average clustering coefficient for the graph G.
The clustering coefficient for the graph is the average,
where is the number of nodes in .
Parameters : | G : graph nodes : container of nodes, optional (default=all nodes in G)
weight : string or None, optional (default=None)
count_zeros : bool (default=False)
|
---|---|
Returns : | avg : float
|
Notes
This is a space saving routine; it might be faster to use the clustering function to get a list and then take the average.
Self loops are ignored.
References
[R141] | Generalizations of the clustering coefficient to weighted complex networks by J. Saramäki, M. Kivelä, J.-P. Onnela, K. Kaski, and J. Kertész, Physical Review E, 75 027105 (2007). http://jponnela.com/web_documents/a9.pdf |
[R142] | Marcus Kaiser, Mean clustering coefficients: the role of isolated nodes and leafs on clustering measures for small-world networks. http://arxiv.org/abs/0802.2512 |
Examples
>>> G=nx.complete_graph(5)
>>> print(nx.average_clustering(G))
1.0