face2face.statistics.network_quantities.clustering_coefficient

face2face.statistics.network_quantities.clustering_coefficient(network)

Calculate the global Clustering Coefficient

Calculating the global Clustering Coefficient C for a given network

\[\langle L_i \rangle = p \frac{k_i(k_i - 1)}{2}\]
\[C_i = \frac{2 \langle L_i \rangle}{k_i(k_i - 1)} = p = \frac{\langle k \rangle}{N}\]
Parameters

network (networkx Graph) – A graph with a specified degree sequence. Nodes are labeled based on the imported data set.

Returns

c – Contains the Clustering Coefficient for the network.

Return type

float

References

1

Barabasi, Albert-Laszlo. (2013). Network science. Philosophical transactions. Series A, Mathematical, physical, and engineering sciences. 371. 20120375. 10.1098/rsta.2012.0375.

Examples

>>> attr_list = ["ID", "Age", "Sex"]
>>> test_df = Data(path_tij="face2face/data/Test/tij_test.dat", separator_tij="\t",
>>>                path_meta="face2face/data/Test/meta_test.dat", separator_meta="\t",
>>>                meta_attr_list=attr_list)
>>> test_network = create_network_from_data(test_df)
>>> C = clustering_coefficient(test_network)
>>> print(C)
0.2