01 2.1 Clustering Coefficient
01 2.1 Clustering Coefficient
ANALYSIS IN PYTHON
Triadic Closure
# of pairs of Cʹ s friends =
APPLIED SOCIAL NETWORK
ANALYSIS IN PYTHON
ʹ 𝑑" (𝑑" − 1)
# of pairs of C s friends =
2
APPLIED SOCIAL NETWORK
ANALYSIS IN PYTHON
ʹ 𝑑" (𝑑" − 1) 12
# of pairs of C s friends = = = 6
2 2
APPLIED SOCIAL NETWORK
ANALYSIS IN PYTHON
ʹ 𝑑" (𝑑" − 1) 12
# of pairs of C s friends = = = 6
2 2
# of pairs of Cʹ s friends who are friends =
APPLIED SOCIAL NETWORK
ANALYSIS IN PYTHON
ʹ 𝑑" (𝑑" − 1) 12
# of pairs of C s friends = = = 6
2 2
# of pairs of Cʹ s friends who are friends = 2
APPLIED SOCIAL NETWORK
ANALYSIS IN PYTHON
ʹ 𝑑" (𝑑" − 1) 12
# of pairs of C s friends = = = 6
2 2
# of pairs of Cʹ s friends who are friends = 2
2 1
Local clustering coefficent of C = =
6 3
APPLIED SOCIAL NETWORK
ANALYSIS IN PYTHON
𝑑. = 3
ʹ 𝑑. (𝑑. − 1) 6
# of pairs of F s friends = = = 3
2 2
# of pairs of Fʹ s friends who are friends = 1
1
Local clustering coefficent of F =
3
APPLIED SOCIAL NETWORK
ANALYSIS IN PYTHON
G = nx.Graph()
G.add_edges_from([('A', 'K'), ('A', 'B'), ('A', 'C'), ('B', 'C'), ('B', 'K'),
('C', 'E'), ('C', 'F'), ('D', 'E'), ('E', 'F'), ('E', 'H'), ('F', 'G'), ('I', 'J')])
In: nx.average_clustering(G)
Out: 0.28787878787878785
APPLIED SOCIAL NETWORK
ANALYSIS IN PYTHON
Open triads:
APPLIED SOCIAL NETWORK
ANALYSIS IN PYTHON
In: nx.transitivity(G)
Out: 0.409090909091
APPLIED SOCIAL NETWORK
ANALYSIS IN PYTHON
Summary
Clustering coefficient measures the degree to which nodes in a network
tend to “cluster” or form triangles.
Local Clustering Coefficient Global Clustering Coefficient
Fraction of pairs of the node’s Average Local Transitivity
friends that are friends with each Clustering Coefficient
other. Ratio of number of
triangles and number of
nx.average_clustering(G) “open triads”.
2 1
LCC of C = =
6 3
Puts larger weight on
high degree nodes.
nx.transitivity(G)