0% found this document useful (0 votes)
10 views

Social Network Analytics Session5 Betweenness

Uploaded by

Avinash Dubey
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views

Social Network Analytics Session5 Betweenness

Uploaded by

Avinash Dubey
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 43

Social Network Analytics – Session 5

Social Network Analytics – Session 5

06-11-2024 Presented by Dr. Purva Grover 1


Social Network Analytics – Session 5

Degree Centrality
❑Centrality of the simplest kind.
❑In a sense, captures the popularity of a player within a network.
❑Quantifies the direct influence of a node on its local neighbourhood.
❑Particularly useful for marketing scenarios, wherein the detected
influential user can promote a product/service across her followers
❑The degree centrality 𝐶𝑑 𝑣 of a node 𝑣 in a network 𝐺(𝑉, 𝐸) is
defined as:
deg(𝑣)
𝐶𝑑 𝑣 =
𝑁−1

06-11-2024 Presented by Dr. Purva Grover 2


Social Network Analytics – Session 5

Find the degree centrality for all the nodes?


Node Degree Centrality

1 3 1 2/4 0.5
2 3/4 0.75
3 4/4 1
4 2/4 0.5

5 5 3/4 0.75

Node 3 is most central according to degree centrality measure.


06-11-2024 Presented by Dr. Purva Grover 3
Social Network Analytics – Session 5

Find the degree centrality for all the nodes in the network?
Node Degree Centrality Standardized Score
6 1
1 2
4 3
3 4
5 5
6
2 7
7

___________is most central according to degree centrality measure.


06-11-2024 Presented by Dr. Purva Grover 4
Social Network Analytics – Session 5

Find the degree centrality for all the nodes in the network?
Node Degree Centrality Standardized Score
6 1 =1/6 0.167
1 2 =1/6 0.167
4 3 =3/6 0.5
3 4 =2/6 0.33
5 5 =3/6 0.5
6 =2/6 0.33
2 7 =2/6 0.33
7

The degree centrality 𝐶𝑑 𝑣 of a node 𝑣 in a network 𝐺(𝑉, 𝐸) is defined as:


deg(𝑣) deg(𝑣)
𝐶𝑑 𝑣 = =
𝑁−1 6

06-11-2024 Presented by Dr. Purva Grover 5


Social Network Analytics – Session 5

Find the degree centrality for all the nodes in the network?
Node Degree Centrality Standardized Score
6 1 =1/6 0.16
1 2 =1/6 0.16
4 3 =3/6 0.5
3 4 =2/6 0.33
5 5 =3/6 0.5
6 =2/6 0.33
2 7 =2/6 0.33
7

The degree centrality 𝐶𝑑 𝑣 of a node 𝑣 in a network 𝐺(𝑉, 𝐸) is defined as:


deg(𝑣) deg(𝑣)
𝐶𝑑 𝑣 = =
𝑁−1 6
3 & 5, is most central according to degree centrality measure.
06-11-2024 Presented by Dr. Purva Grover 6
Social Network Analytics – Session 5

Find the closeness centrality for all the nodes in the network?
Node Closeness Centrality
6 1
1 2
4 3
3 4
5 5
6
2 7
7

_______is most central according to closeness centrality measure.


06-11-2024 Presented by Dr. Purva Grover 7
Social Network Analytics – Session 5

Find the closeness centrality for all the nodes in the network?
Node Closeness Centrality
1 7−1 6
6 𝐶 1 = = = 0.375
1 2 + 1 + 2 + 3 + 4 + 4 16
2 7−1 6
4 𝐶 2 = = = 0.375
2 + 1 + 2 + 3 + 4 + 4 16
3 3
𝐶 3 =
7−1
=
6
= 0. 545
5 1 + 1 + 1 + 2 + 3 + 3 11
4
5
2
7
The closeness centrality 𝐶(𝑣) of a node 𝑣 in a network 𝐺(𝑉, 𝐸) is defined as
𝑉 −1
𝐶 𝑣 =
σ𝑢∈𝑉∖{𝑣} 𝑑(𝑢, 𝑣)
Where 𝑑(𝑢, 𝑣) denotes the distance of node 𝑢 from node 𝑣
06-11-2024 Presented by Dr. Purva Grover 8
Social Network Analytics – Session 5

Find the closeness centrality for all the nodes in the network?
Node Closeness Centrality
1 7−1 6
6 𝐶 1 = = = 0.375
1 2 + 1 + 2 + 3 + 4 + 4 16
2 7−1 6
4 𝐶 2 = = = 0.375
2 + 1 + 2 + 3 + 4 + 4 16
3 3
𝐶 3 =
7−1
=
6
= 0. 545
5 1 + 1 + 1 + 2 + 3 + 3 11
4 7−1 6
𝐶 4 = = = 0. 600
2 + 2 + 1 + 1 + 2 + 2 10
2 5 7−1 6
7 𝐶 5 = =
3 + 3 + 2 + 1 + 1 + 1 11
= 0. 545

6 7−1 6
𝐶 6 = = = 0. 400
4 + 4 + 3 + 2 + 1 + 1 15
7 7−1 6
𝐶 7 = = = 0. 400
4 + 4 + 3 + 2 + 1 + 1 15

06-11-2024 Presented by Dr. Purva Grover 9


Social Network Analytics – Session 5

Find the closeness centrality for all the nodes in the network?
Node Closeness Centrality
1 7−1 6
6 𝐶 1 = = = 0.375
1 2 + 1 + 2 + 3 + 4 + 4 16
2 7−1 6
4 𝐶 2 = = = 0.375
2 + 1 + 2 + 3 + 4 + 4 16
3 3
𝐶 3 =
7−1
=
6
= 0. 545
5 1 + 1 + 1 + 2 + 3 + 3 11
4 7−1 6
𝐶 4 = = = 0. 600
2 + 2 + 1 + 1 + 2 + 2 10
2 5 7−1 6
7 𝐶 5 = =
3 + 3 + 2 + 1 + 1 + 1 11
= 0. 545

6 7−1 6
𝐶 6 = = = 0. 400
4 + 4 + 3 + 2 + 1 + 1 15
7 7−1 6
𝐶 7 = = = 0. 400
4 + 4 + 3 + 2 + 1 + 1 15

4 is most central according to closeness centrality measure.


06-11-2024 Presented by Dr. Purva Grover 10
Social Network Analytics – Session 5

Betweenness Centrality
❑A measure to compute how central a node is in between
paths of the network
❑A measure to compute how many (shortest) paths of the
network pass through the node
❑Useful in identifying
❑The articulation points, i.e., the points in a network
which, if removed, may disconnect the network
❑The super spreaders in analyzing disease spreading in
epidemiology
❑The suspected spies in security networks
06-11-2024 Presented by Dr. Purva Grover 11
Social Network Analytics – Session 5

Betweenness Centrality (1)


The betweenness centrality 𝐶𝐵 (𝑣) of a node 𝑣 in a network 𝐺(𝑉,
𝐸) is defined as
𝜎𝑥𝑦 (𝑣)
𝐶𝐵 𝑣 = ෍
𝜎𝑥𝑦
𝑥,𝑦∈𝑉∖{𝑣}

where 𝜎𝑥𝑦 denotes the number of shortest paths between


nodes 𝑥 and 𝑦 in the network, 𝜎𝑥𝑦 (𝑣) denotes the same
passing though 𝑣. If 𝑥 = 𝑦 , then 𝜎𝑥𝑦 = 1

06-11-2024 Presented by Dr. Purva Grover 12


Social Network Analytics – Session 5

Betweenness Centrality (2)


❑ For Graphs with a large number of nodes, the value of
betweenness centrality is very high.
❑ So, we can normalize the value by dividing with number of
node pairs (excluding the current node).
❑ For Undirected Graphs, the number of node pairs are
(1/2)*(|N|-1)*(|N|-2).

06-11-2024 Presented by Dr. Purva Grover 13


Social Network Analytics – Session 5

Find the betweenness centrality for all the nodes?

1 3

is most central according to betweenness centrality measure.


06-11-2024 Presented by Dr. Purva Grover 14
Social Network Analytics – Session 5
Calculating Betweenness – Step 1: Count the total number paths that can exist in the network

❑ Total number of paths = (1/2)*(|N|)*(|N|-1)


❑ For below network:
❑ Total number of paths = (1/2)*(5)*(5-1)=10

1 3

06-11-2024 Presented by Dr. Purva Grover 15


Social Network Analytics – Session 5

We will not calculate the distance of the node from itself


Node 1
From To
1 1
1 2
1 3
1 4
1 5

06-11-2024 Presented by Dr. Purva Grover 16


Social Network Analytics – Session 5

We will also not calculate the distance of the node from previous node because we
have already calculated it.
Node 1 Node 2
From To From To
1 1 2 1
1 2 2 2
1 3 2 3
1 4 2 4
1 5 2 5

06-11-2024 Presented by Dr. Purva Grover 17


Social Network Analytics – Session 5

We will also not calculate the distance of the node from previous node because we
have already calculated it.
Node 1 Node 2 Node 3 Node 4 Node 5
From To From To From To From To From To
1 1 2 1 3 1 4 1 5 1
1 2 2 2 3 2 4 2 5 2
1 3 2 3 3 3 4 3 5 3
1 4 2 4 3 4 4 4 5 4
1 5 2 5 3 5 4 5 5 5

06-11-2024 Presented by Dr. Purva Grover 18


Social Network Analytics – Session 5

Calculating the Geodesic for all the paths


From To Geodesic
1 2
1 3
1 4 1 3
1 5
2 3
2 4 5
2 5
3 4 2
3 5
4
4 5

06-11-2024 Presented by Dr. Purva Grover 19


Social Network Analytics – Session 5

Calculating the Geodesic for all the paths


From To Geodesic
1 2 (1,2)
1 3 (1,3)
1 4 (1,3,4) 1 3
1 5
2 3
2 4 5
2 5
3 4 2
3 5
4
4 5

06-11-2024 Presented by Dr. Purva Grover 20


Social Network Analytics – Session 5

Calculating the Geodesic for all the paths


From To Geodesic
1 2 (1,2)
1 3 (1,3)
1 4 (1,3,4) 1 3
1 5 (1,2,5)(1,3,5)
2 3 (2,3)
2 4 (2,3,4)(2,5,4) 5
2 5 (2,5)
3 4 (3,4) 2
3 5 (3,5)
4
4 5 (4,5)

06-11-2024 Presented by Dr. Purva Grover 21


Social Network Analytics – Session 5

Frequency of nodes occurrence on the shortest path


𝜎𝑥𝑦 (𝑣)
𝐶𝐵 𝑣 = ෍
From To Geodesic 1 2 3 4 5 𝜎𝑥𝑦
𝑥,𝑦∈𝑉∖{𝑣}
1 2 (1,2) 0 0 0 0 0
1 3 (1,3) 1 3
1 4 (1,3,4)
1 5 (1,2,5)(1,3,5)
2 3 (2,3)
5
2 4 (2,3,4)(2,5,4)
2 5 (2,5)
2
3 4 (3,4)
3 5 (3,5)
4
4 5 (4,5)

06-11-2024 Presented by Dr. Purva Grover 22


Social Network Analytics – Session 5

Frequency of nodes occurrence on the shortest path


𝜎𝑥𝑦 (𝑣)
𝐶𝐵 𝑣 = ෍
From To Geodesic 1 2 3 4 5 𝜎𝑥𝑦
𝑥,𝑦∈𝑉∖{𝑣}
1 2 (1,2) 0 0 0 0 0
1 3 (1,3) 0 0 0 0 0 1 3
1 4 (1,3,4)
1 5 (1,2,5)(1,3,5)
2 3 (2,3)
5
2 4 (2,3,4)(2,5,4)
2 5 (2,5)
2
3 4 (3,4)
3 5 (3,5)
4
4 5 (4,5)

06-11-2024 Presented by Dr. Purva Grover 23


Social Network Analytics – Session 5

Frequency of nodes occurrence on the shortest path


𝜎𝑥𝑦 (𝑣)
𝐶𝐵 𝑣 = ෍
From To Geodesic 1 2 3 4 5 𝜎𝑥𝑦
𝑥,𝑦∈𝑉∖{𝑣}
1 2 (1,2) 0 0 0 0 0
1 3 (1,3) 0 0 0 0 0 1 3
1 4 (1,3,4) 0 0 1/1 0 0
1 5 (1,2,5)(1,3,5)
2 3 (2,3)
5
2 4 (2,3,4)(2,5,4)
2 5 (2,5)
2
3 4 (3,4)
3 5 (3,5)
4
4 5 (4,5)

06-11-2024 Presented by Dr. Purva Grover 24


Social Network Analytics – Session 5

Frequency of nodes occurrence on the shortest path


𝜎𝑥𝑦 (𝑣)
𝐶𝐵 𝑣 = ෍
From To Geodesic 1 2 3 4 5 𝜎𝑥𝑦
𝑥,𝑦∈𝑉∖{𝑣}
1 2 (1,2) 0 0 0 0 0
1 3 (1,3) 0 0 0 0 0 1 3
1 4 (1,3,4) 0 0 1/1 0 0
1 5 (1,2,5)(1,3,5) 0 1/2 1/2 0 0
2 3 (2,3)
5
2 4 (2,3,4)(2,5,4)
2 5 (2,5)
2
3 4 (3,4)
3 5 (3,5)
4
4 5 (4,5)

06-11-2024 Presented by Dr. Purva Grover 25


Social Network Analytics – Session 5

Frequency of nodes occurrence on the shortest path


𝜎𝑥𝑦 (𝑣)
𝐶𝐵 𝑣 = ෍
From To Geodesic 1 2 3 4 5 𝜎𝑥𝑦
𝑥,𝑦∈𝑉∖{𝑣}
1 2 (1,2) 0 0 0 0 0
1 3 (1,3) 0 0 0 0 0 1 3
1 4 (1,3,4) 0 0 1/1 0 0
1 5 (1,2,5)(1,3,5) 0 1/2 1/2 0 0
2 3 (2,3) 0 0 0 0 0
5
2 4 (2,3,4)(2,5,4)
2 5 (2,5)
2
3 4 (3,4)
3 5 (3,5)
4
4 5 (4,5)

06-11-2024 Presented by Dr. Purva Grover 26


Social Network Analytics – Session 5

Frequency of nodes occurrence on the shortest path


𝜎𝑥𝑦 (𝑣)
𝐶𝐵 𝑣 = ෍
From To Geodesic 1 2 3 4 5 𝜎𝑥𝑦
𝑥,𝑦∈𝑉∖{𝑣}
1 2 (1,2) 0 0 0 0 0
1 3 (1,3) 0 0 0 0 0 1 3
1 4 (1,3,4) 0 0 1/1 0 0
1 5 (1,2,5)(1,3,5) 0 1/2 1/2 0 0
2 3 (2,3) 0 0 0 0 0
5
2 4 (2,3,4)(2,5,4) 0 0 1/2 0 1/4
2 5 (2,5)
2
3 4 (3,4)
3 5 (3,5)
4
4 5 (4,5)

06-11-2024 Presented by Dr. Purva Grover 27


Social Network Analytics – Session 5

Frequency of nodes occurrence on the shortest path


𝜎𝑥𝑦 (𝑣)
𝐶𝐵 𝑣 = ෍
From To Geodesic 1 2 3 4 5 𝜎𝑥𝑦
𝑥,𝑦∈𝑉∖{𝑣}
1 2 (1,2) 0 0 0 0 0
1 3 (1,3) 0 0 0 0 0 1 3
1 4 (1,3,4) 0 0 1/1 0 0
1 5 (1,2,5)(1,3,5) 0 1/2 1/2 0 0
2 3 (2,3) 0 0 0 0 0
5
2 4 (2,3,4)(2,5,4) 0 0 1/2 0 1/2
2 5 (2,5) 0 0 0 0 0
2
3 4 (3,4) 0 0 0 0 0
3 5 (3,5) 0 0 0 0 0
4
4 5 (4,5) 0 0 0 0 0

06-11-2024 Presented by Dr. Purva Grover 28


Social Network Analytics – Session 5

Frequency of nodes occurrence on the shortest path


𝜎𝑥𝑦 (𝑣)
𝐶𝐵 𝑣 = ෍
From To Geodesic 1 2 3 4 5 𝜎𝑥𝑦
𝑥,𝑦∈𝑉∖{𝑣}
1 2 (1,2) 0 0 0 0 0
1 3 (1,3) 0 0 0 0 0 1 3
1 4 (1,3,4) 0 0 1/1 0 0
1 5 (1,2,5)(1,3,5) 0 1/2 1/2 0 0
2 3 (2,3) 0 0 0 0 0
5
2 4 (2,3,4)(2,5,4) 0 0 1/2 0 1/2
2 5 (2,5) 0 0 0 0 0
2
3 4 (3,4) 0 0 0 0 0
3 5 (3,5) 0 0 0 0 0
4
4 5 (4,5) 0 0 0 0 0

0 0.5 2 0 0.5 Sum

06-11-2024 Presented by Dr. Purva Grover 29


Social Network Analytics – Session 5

Normalize value by dividing with number of node pairs


(1/2)*(|N|-1)*(|N|-2) = (1/2)*(5-1)*(5-2)=(1/2)*4*3=6

1 2 3 4 5

0 0.5 2 0 0.5

0/6 0.5/6 2/6 0/6 0.5/6

0 0.08 0.33 0 0.08 Betweenness centrality for all the nodes !

06-11-2024 Presented by Dr. Purva Grover 30


Social Network Analytics – Session 5

Find the betweenness centrality for all the nodes in the network?
Node Betweenness Standardized Score
Centrality
6
1 1
4 2
3
3
5 4
5
2 6
7 7

___________is most central according to betweenness centrality.


06-11-2024 Presented by Dr. Purva Grover 31
Social Network Analytics – Session 5
Calculating Betweenness – Step 1: Count the total number paths that can exist in the network

❑ Total number of paths = (1/2)*(|N|)*(|N|-1)


❑ For below network:
❑ Total number of paths = (1/2)*(7)*(7-1)=21
6
1
4
3
5

2
7

06-11-2024 Presented by Dr. Purva Grover 32


Social Network Analytics – Session 5

We will also not calculate the distance of the node from previous node because we
have already calculated it.
Node 1 Node 2 Node 3 Node 4 Node 5 Node 6 Node 7
From To From To From To From To From To From To From To
1 1 2 1 3 1 4 1 5 1 6 1 7 1
1 2 2 2 3 2 4 2 5 2 6 2 7 2
1 3 2 3 3 3 4 3 5 3 6 3 7 3
1 4 2 4 3 4 4 4 5 4 6 4 7 4
1 5 2 5 3 5 4 5 5 5 6 5 7 5
1 6 2 6 3 6 4 6 5 6 6 6 7 6
1 7 2 7 3 7 4 7 5 7 6 7 7 7

06-11-2024 Presented by Dr. Purva Grover 33


Social Network Analytics – Session 5

Calculating the Geodesic for all the paths


From To Geodesic
1 2 (1,3,2)
1 3 (1,3)
1 4 (1,3,4)
1 5 (1,3,4,5) 6
1 6 (1,3,4,5,6) 1
1 7 (1,3,4,5,7) 4
2 3 (2,3)
3
2 4 (2,3,4) 5
2 5 (2,3,4,5)
2 6 (2,3,4,5,6) 2
2 7 (2,3,4,5,7) 7
3 4 (3,4)
3 5 (3,4,5)
3 6 (3,4,5,6)

06-11-2024 Presented by Dr. Purva Grover 34


Social Network Analytics – Session 5

Calculating the Geodesic for all the paths


From To Geodesic
3 7 (3,4,5,7)
4 5 (4,5)
4 6 (4,5,6)
4 7 (4,5,7) 6
5 6 (5,6) 1
5 7 (5,7)
4
6 7 (6,7) 3
5

2
7

06-11-2024 Presented by Dr. Purva Grover 35


Social Network Analytics – Session 5

Frequency of nodes occurrence on the shortest path


From To Geodesic 1 2 3 4 5 6 7 From To Geodesic 1 2 3 4 5 6 7
1 2 (1,3,2) 0 0 1 0 0 0 0 3 7 (3,4,5,7) 0 0 0 1 1 0 0
1 3 (1,3) 0 0 0 0 0 0 0 4 5 (4,5) 0 0 0 0 0 0 0
1 4 (1,3,4) 0 0 1 0 0 0 0 4 6 (4,5,6) 0 0 0 0 1 0 0
1 5 (1,3,4,5) 0 0 1 1 0 0 0 4 7 (4,5,7) 0 0 0 0 1 0 0
1 6 (1,3,4,5,6) 0 0 1 1 1 0 0 5 6 (5,6) 0 0 0 0 0 0 0
1 7 (1,3,4,5,7) 0 0 1 1 1 0 0 5 7 (5,7) 0 0 0 0 0 0 0
2 3 (2,3) 0 0 0 0 0 0 0 6 7 (6,7) 0 0 0 0 0 0 0
2 4 (2,3,4) 0 0 1 0 0 0 0
Sum 0 0 9 9 8 0 0
2 5 (2,3,4,5) 0 0 1 1 0 0 0
2 6 (2,3,4,5,6) 0 0 1 1 1 0 0 𝜎𝑥𝑦 (𝑣)
𝐶𝐵 𝑣 = ෍
2 7 (2,3,4,5,7) 0 0 1 1 1 0 0 𝜎𝑥𝑦
𝑥,𝑦∈𝑉∖{𝑣}

3 4 (3,4) 0 0 0 0 0 0 0
3 5 (3,4,5) 0 0 0 1 0 0 0
3 6 (3,4,5,6) 0 0 0 1 1 0 0

06-11-2024 Presented by Dr. Purva Grover 36


Social Network Analytics – Session 5

Normalize value by dividing with number of node pairs


(1/2)*(|N|-1)*(|N|-2) = (1/2)*(7-1)*(7-2)=(1/2)*6*5=15

1 2 3 4 5 6 7

0 0 9 9 8 0 0

0/15 0/15 9/15 9/15 8/15 0/15 0/15

0 0 0.6 0.6 0.53 0 0

Betweenness centrality for all the nodes !


06-11-2024 Presented by Dr. Purva Grover 37
Social Network Analytics – Session 5

Find the degree centrality for all the nodes in the network?
Node Degree Centrality Standardized Score
1
2
3
4
5
6
7
8
9
10

___________is most central according to degree centrality measure.


06-11-2024 Presented by Dr. Purva Grover 38
Social Network Analytics – Session 5

Find the closeness centrality for all the nodes in the network?
Node Closeness Centrality
1
2
3
4
5
6
7
8
9
10

_______is most central according to closeness centrality measure.


06-11-2024 Presented by Dr. Purva Grover 39
Social Network Analytics – Session 5

Find the betweenness centrality for all the nodes in the network?
Node Betweenness Centrality
1
2
3
4
5
6
7
8
9
10

_______is most central according to betweenness centrality measure.


06-11-2024 Presented by Dr. Purva Grover 40
Social Network Analytics – Session 5

Finding the Centrality through Code

06-11-2024 Presented by Dr. Purva Grover 41


Social Network Analytics – Session 5
References
❑https://www.analyticsvidhya.com/blog/2018/04/introduction-to-
graph-theory-network-analysis-python-codes/
❑Newman, M. (2010). Networks: an introduction. Oxford University
Press.
❑https://www.cantorsparadise.com/measuring-network-centrality-
2a76b0045410
❑https://www.youtube.com/watch?v=0CCrq62TF7U

06-11-2024 Presented by Dr. Purva Grover 42


Social Network Analytics – Session 5

Thank you

You might also like