In graph theory, a clustering coefficient is a measure of the degree to which nodes in a graph tend to cluster together. Evidence suggests that in most real-world networks, and in particular social networks, nodes tend to create tightly knit groups characterized by a relatively high density of ties; this likelihood tends to be greater than the average probability of a tie randomly established between two nodes (Holland and Leinhardt, 1971; Watts and Strogatz, 1998).
Two versions of this measure exist: the global and the local. The global version was designed to give an overall indication of the clustering in the network, whereas the local gives an indication of the embeddedness of single nodes.
Global clustering coefficient:
The global clustering coefficient is based on triplets of nodes. A triplet consists of three connected nodes. A triangle therefore includes three closed triplets, one centered on each of the nodes (n.b. this means the three triplets in a triangle come from overlapping selections of nodes). The global clustering coefficient is the number of closed triplets (or 3 x triangles) over the total number of triplets (both open and closed). The first attempt to measure it was made by Luce and Perry (1949). This measure gives an indication of the clustering in the whole network (global), and can be applied to both undirected and directed networks.
Local clustering coefficient:
A graph
We define
An undirected graph has the property that
Let
It is simple to show that the two preceding definitions are the same, since
Example local clustering coefficient on an undirected graph. The local clustering coefficient of the green node is computed as the proportion of connections among its neighbours. Here is the code to implement the above clustering coefficient in a graph. It is a part of the networkx library and can be directly accessed using it.
Note: The above code is valid for undirected networks and not for the directed networks. The code below has been run on IDLE(Python IDE of windows). You would need to download the networkx library before you run this code. The part inside the curly braces represent the output. It is almost similar as Ipython(for Ubuntu users).
>>> import networkx as nx
>>> G = nx.erdos_renyi_graph( 10 , 0.4 )
>>> cc = nx.average_clustering(G)
>>> cc #Output of Global CC 0.08333333333333333 >>> c = nx.clustering(G)
>>> c # Output of local CC { 0 : 0.0 , 1 : 0.3333333333333333 , 2 : 0.0 , 3 : 0.0 , 4 : 0.0 , 5 : 0.0 , 6 : 0.0 ,
7 : 0.3333333333333333 , 8 : 0.0 , 9 : 0.16666666666666666 }
|
The above two values give us the global clustering coefficient of a network as well as local clustering coefficient of a network. Next into this series, we will talk about another centrality measure for any given network.