Transitivity
Global and Local
Clustering coefficient
in undirected networks
Transitivity
Mathematic representation:
– For a transitive relation R:
Networks:
– the transitive relation R: connected by a link
– If v1, v2 are connected and v2, v3 are connected
v1 v2 v1 v2
v1, v3 are connected
v3 v3
Transitivity
Social Networks:
– the transitive relation R: friendship
– If v1, v2 are friends and v2, v3 are friends
v1 v2 v1 v2
v1, v3 are friends
v3 v3
Transitivity is when
a “friend” of my friend is my “friend”
Transitivity
v1 v2
v3
– Perfect transitivity only occurs in networks where each
component is a fully connected graph or clique (a subgraph
in which all nodes are connected to all others)
– Generally, perfect transitivity is a useless concept in
networks as it never occurs
Transitivity
v6 v4 v1 v2
v5 v3
– Partial transitivity is much more useful
– The friend of my friend is not guaranteed to be my friend
– But is far more likely to be my friend than any other node in
the network.
– v1 is more likely to be friend of v3 than v5
Global Clustering Coefficient
Measure based on paths
We want to quantify the level of transitivity of a network
We can measure it by counting the paths of length two and
check whether the third edge exists
1 2 A path of length 2 which has the third
link is called closed path as it forms a
loop of length 3. [Closed paths are
3 also called closed triad in social
networks.]
Global Clustering Coefficient
Note that paths, also
closed paths, have a
Path of length 2 Third edge direction in undirected
213 32 network, too.
312 23 Two paths that
traverse the same links
123 31 but in opposite
321 13 direction are counted
separately.
132 21 1 2
231 12
C=6/6 3
Global Clustering Coefficient
Path of length 2 Third edge 1 2
123 -
321 -
3
C=0/2=0
Example
Path of length 2 Third edge
4 213 312 yes
5 6
214 412 no
314 413 no
123 321 yes
1 2 125 521 no
325 523 no
3 132 231 yes
145 541 no
C=6/22=3/11 254 452 no
256 652 no
456 654 no
[Note: you could divide both the numerator and the denominator by
two, by considering paths in one direction only]
Global Clustering Coefficient
Measure based on triples
If we have a path {1,2,3} (and {3,2,1}) of length 2, it is also true to
say that nodes 1 and 3 have a common neighbour: node 2.
If the triad {1,2,3} is closed, nodes 1 and 3 are themselves friends.
The clustering coefficient can be thought as the
fraction of pairs of people with a common friend
who are themselves friend.
1 2 1 2
3 3
Clustering coefficient
1 2
a friend of my friend is my pairs of people with a common
friend friend who are themselves friend.
Global Clustering Coefficient
Measure based on triplets
The clustering coefficient can be thought as the fraction of pairs of people with
a common friend who are themselves friend.
We can also define the global clustering coefficient based on the concept of
(connected) triplets of nodes.
A connected triplet consists of three nodes {v1, v2, v3}, that are connected by
the two links (v1, v2) and (v2, v3). The third link (v1, v3) can be present (closed
triplet) or not (open triplet).
1 1 2
2
3 3
Global Clustering Coefficient
Measure based on triples
Triplets (open) Triplets (closed)
{2,1,3} [with links (2,1) and (1,3)] {2,1,3} [with links (2,1) and (1,3)]
{1,2,3} [with links (1,2) and (2,3)]
{1,3,2} [with links (1,3) and (3,2)]
They are different because links
are different
1 2 1 2
3 3
Global Clustering Coefficient
Measure based on triples
The global clustering coefficient is the number of
closed triplets over the total number of triplets (both
open and closed):
number of closed triplets
total number of triplets
Global Clustering Coefficient
Measure based on triples
Triplets (open) Triplets (closed)
{2,1,3} [with links (2,1) and (1,3)] {2,1,3} [with links (2,1) and (1,3)]
{1,2,3} [with links (1,2) and (2,3)]
{1,3,2} [with links (1,3) and (3,2)]
C=0/1=0
C=3/3=1
1 2 1 2
3 3
Example
Triplets Closed?
4 213 yes
5 6
214 no
314 no
123 yes
1 2 125 no
325 no
3 132 yes
145 no
C=3/11 254 no
256 no
456 no
Global Clustering Coefficient
Measure based on triangles
A triangle consists of six paths.
213, 312, 123, 321, 132, 231
A triangle consists of three triples, one centered on each of the
nodes.
213, 123, 231
1 2
3
Global Clustering Coefficient
Measure based on triangles
The global clustering coefficient is the number of
closed paths of length 2 (or 6 x triangles) over the
total number of paths of length 2
6 ∗ number of triangles
number of paths of length 2
The global clustering coefficient is the number of
closed triplets (or 3 x triangles) over the total number
of triplets
3 ∗ number of triangles
number of triplets
Example
Path of length 2 Triangles
4 213 312 123
5 6
214 412
314 413
123 321
1 2 125 521
325 523
3 132 231
145 541
C=1*6/22=3/11 254 452
256 652
456 654
Local Clustering Coefficient
• Local clustering coefficient measures transitivity at the node
level
• It computes how strongly neighbors of a node v (nodes
adjacent to v) are themselves connected
In an undirected graph, the
denominator can be rewritten as:
Local Clustering Coefficient:
Example
• Thin lines depict connections to neighbors
• Dashed lines are the missing connections among neighbors
• Solid lines indicate connected neighbors
– When none of neighbors are connected C=0
– When all neighbors are connected C=1
Example
Node Pairs of Open or Clustering
friends closed coeff
triad
1 23 closed c=1/3
4 5 6 24 open
34 open
2 13 closed c=1/3
15 open
1 2
35 open
3 12 closed c=1/1
3 4 15 open c=0
C=6/22=3/11
5 24 open c=0/3=0
26 open
46 open
6 - - -
Example
Node Pairs of Open or Clustering
friends closed coeff
The clustering coefficient triad
distribution therefore is: 1 23 closed c=1/3
24 open
c Frequency 34 open
2 13 closed c=1/3
0 2/5 15 open
1/3 2/5 35 open
1 1/5 3 12 closed c=1/1
4 15 open c=0
The mean clustering 5 24 open c=0/3=0
coefficient is: 1/3 26 open
46 open
6 - - -
Average and Global
clustering coefficient
For the previous example, the average clustering is 1/3
while the global clustering is 3/11.
These two common measures of clustering can differ. Here
the average clustering is higher than the overall clustering,
it can also go the other way.
Moreover, it is possible to generate networks where the
two measures can produce very different numbers for the
same network.
Exercize
4
2
1 3
5
6
7
Pairs of neighbours Connected?
Exercize 213
215
yes
no
315 yes c(1)=2/3
4 123 yes c(2)=1/1
2 132 yes
134 no
1 135 yes
3
234 no
235 no
5 435 no c(3)=2/6
6
153 yes
7 156 no
157 no
356 no
357 no
657 no c(5)=1/6
Expected local and global
clustering coefficient in Erdos-Renyi
random networks
?
Expected local clustering coefficient
in Erdos-Renyi random networks
In a random graph generated by G(n; p),
the expected local clustering coefficient and the global
clustering coefficients are equal to p.
Local clustering coefficient: the probability for a
link to exist between any two neighbors of a node
The probability that two of the neighbours of a
node are connected is equal to the probability of
two randomly selected nodes getting connected: p
Does the local clustering coefficient of
a node depend on its degree in a
random network?
Does the local clustering coefficient of
a node depend on its degree in a
typical social network?
Clustering coefficient
in random network
< 𝑘𝑘 >
𝑐𝑐 = 𝑝𝑝 =
𝑁𝑁
•The clustering coefficient of random graphs is small.
•C is independent of a node’s degree k.
Comparing the average clustering
coeff. of real networks with the
prediction for random networks
< 𝑘𝑘 >
𝐶𝐶 = 𝑝𝑝 =
𝑁𝑁
C decreases with the system size N.
C is independent of a node’s
degree k.
The random network model does
not capture the clustering of real
networks.
Instead real networks have a much
higher clustering coefficient than
expected for a random network of
similar N and L.
Network Science: Random Graphs
Clustering coefficient
Random networks Social networks
The clustering coefficient of random A much higher clustering coefficient
graphs is small. than expected for a random network of
similar N and L.
For fixed degree C decreases with Independent of N
the system size N.
C is independent of a node’s High-degree nodes tend to have a
degree k. smaller clustering coefficient than low-
degree nodes.
Triadic closure in social networks
If your friends” all know each other,
you have a high clustering coefficient.
If your friends (alters) don’t know each other,
then you have a low clustering coefficient.
- Opportunity (to meet)
- Trustability (through the common friend)
- Incentive (latent stress if my friends are not friend
with each other)
Clustering Coefficient
• In real-world networks, friendships are highly
transitive, i.e., friends of an individual are
often friends with one another
– These friendships form triads -> high average
[local] clustering coefficient
• In May 2011, Facebook had an average
clustering coefficient of 0.5 for individuals
who had 2 friends.
Exercize
4 Compute the
2 global
clustering
1 3 coefficient
5
6
7
Exercize Path of length 2
213 312
Third edge
yes
215 512 no
315 513 yes
4 123 321 yes
2 132 231 yes
134 431 no
1 135 531 yes
3
234 432 no
235 532 no
5 435 534 no
6
153 351 yes
7 156 651 no
C=12/32=3/8 157 751 no
356 653 no
357 753 no
657 756 no
Triplets Closed?
Exercize 213
215
yes
no
315 yes
4 123 yes
2 132 yes
134 no
1 135 yes
3
234 no
235 no
5 435 no
6
153 yes
7 156 no
C=6/16=3/8 157 no
356 no
357 no
657 no
Exercize Number of triangles: 2
4
2 6 ∗number
of triangles
C=
number of paths of length 2
1 3
C = 6*2/32=12/32=3/8
5
6 3 ∗number
of triangles
C=
7 number of triplets
C=6/16=3/8
C = 3*2/16=6/16=3/8
Credits
Reza Zafarani, Mohammad Ali Abbasi, Huan Liu
Social Media Mining: An Introduction
A Textbook by Cambridge University Press
Chapter 3.2.1
Albert-László Barabási
Network Science
Chapter 3.9
Newman, M.E.J.
Networks: An Introduction.
Oxford University Press. 2010.
Chapter 7.9