clustering¶
-
clustering
(G, nodes=None, mode='dot')¶ Compute a bipartite clustering coefficient for nodes.
The bipartie clustering coefficient is a measure of local density of connections defined as [1]:
cu=∑v∈N(N(v))cuv|N(N(u))|where N(N(u)) are the second order neighbors of u in G excluding u, and cuv is the pairwise clustering coefficient between nodes u and v.
The mode selects the function for cuv which can be:
dot:
cuv=|N(u)∩N(v)||N(u)∪N(v)|min:
cuv=|N(u)∩N(v)|min(|N(u)|,|N(v)|)max:
cuv=|N(u)∩N(v)|max(|N(u)|,|N(v)|)Parameters: Returns: clustering – A dictionary keyed by node with the clustering coefficient value.
Return type: dictionary
Examples
>>> from networkx.algorithms import bipartite >>> G = nx.path_graph(4) # path graphs are bipartite >>> c = bipartite.clustering(G) >>> c[0] 0.5 >>> c = bipartite.clustering(G,mode='min') >>> c[0] 1.0
See also
robins_alexander_clustering()
,square_clustering()
,average_clustering()
References
[1] Latapy, Matthieu, Clémence Magnien, and Nathalie Del Vecchio (2008). Basic notions for the analysis of large two-mode networks. Social Networks 30(1), 31–48.