SOCIAL
MEDIA
MINING
Network
Measures
Dear instructors/users of these slides:
Please feel free to include these slides in your
own material, or modify them as you see fit. If
you decide to incorporate these slides into your
presentations, please include the following note:
R. Zafarani, M. A. Abbasi, and H. Liu, Social Media
Mining: An Introduction, Cambridge University Press,
2014.
Free book and slides at
http://socialmediamining.info/
or include a link to the website:
http://socialmediamining.info/
Social Media http://socialmediamining.info/ Measures
Networkand
Measures
Metrics 2
Klout
It is
difficult to
measure
influence!
Social Media http://socialmediamining.info/ Measures
Networkand
Measures
Metrics 3
Why Do We Need Measures?
• Who are the central figures (influential individuals) in
the network?
– Centrality
• What interaction patterns are common in friends?
– Reciprocity and Transitivity
– Balance and Status
• Who are the like-minded users and how can we find
these similar individuals?
– Similarity
• To answer these and similar questions, one first needs
to define measures for quantifying centrality, level of
interactions, and similarity, among others.
Social Media http://socialmediamining.info/ Measures
Networkand
Measures
Metrics 4
Centrality
Centrality defines how important a node is within a
network
Social Media http://socialmediamining.info/ Measures
Networkand
Measures
Metrics 5
Centrality in terms of
those who you are
connected to
Social Media http://socialmediamining.info/ Measures
Networkand
Measures
Metrics 6
Degree Centrality
• Degree centrality: ranks nodes with more
connections higher in terms of centrality
• is the degree (number of friends) for node
– i.e., the number of length-1 paths (can be
generalized)
In this graph, degree
centrality for node is =8 and
for all others is
Social Media http://socialmediamining.info/ Measures
Networkand
Measures
Metrics 7
Degree Centrality in Directed Graphs
• In directed graphs, we can either use the
in-degree, the out-degree, or the
combination as the degree centrality
value:
• In practice, mostly in-degree is used.
is the number of outgoing links for n
Social Media http://socialmediamining.info/ Measures
Networkand
Measures
Metrics 8
Normalized Degree Centrality
• Normalized by the maximum
possible degree
• Normalized by the maximum
degree
• Normalized by the degree
sum
Social Media http://socialmediamining.info/ Measures
Networkand
Measures
Metrics 9
Degree Centrality (Directed Graph)Example
Wrt out degree
B C F
Out- Centralit
Node In-Degree Degree y Rank
A 1 3 1/2 1
B 1 2 1/3 3
D C 2 3 1/2 1
D 3 1 1/6 5
A E 2 1 1/6 5
F 2 2 1/3 3
G 2 1 1/6 5
E G
Normalized by the maximum possible degree
Social Media http://socialmediamining.info/ Measures
Networkand
Measures
Metrics 10
Degree Centrality (Directed Graph)Example
Wrt in degree
B C F
Out- Centralit
Node In-Degree Degree y Rank
A 1 3 1/6 6
B 1 2 1/6 6
D C 2 3 1/3 2
D 3 1 1/2 1
A E 2 1 1/3 2
F 2 2 1/3 2
G 2 1 1/3 2
E G
Normalized by the maximum possible degree
Social Media http://socialmediamining.info/ Measures
Networkand
Measures
Metrics 11
Degree Centrality (undirected Graph)
Example
B C F
Node Degree Centrality Rank
A 4 2/3 2
B 3 1/2 5
C 5 5/6 1
D
D 4 2/3 2
A E 3 1/2 5
F 4 2/3 2
G 3 1/2 5
E G
Social Media http://socialmediamining.info/ Measures
Networkand
Measures
Metrics 12
Eigenvector Centrality
• Having more friends does not
by itself guarantee that
someone is more important
– Having more important friends
provides a stronger signal Phillip Bonacich
• Eigenvector centrality generalizes degree
centrality by incorporating the
importance of the neighbors (undirected)
• For directed graphs, we can use incoming
or outgoing edges
Social Media http://socialmediamining.info/ Measures
Networkand
Measures
Metrics 13
Formulation
• Let’s assume the eigenvector centrality of a node
is (unknown)
• We would like to be higher when important
neighbors (node with higher ) point to us
– Incoming or outgoing neighbors?
– For incoming neighbors
• We can assume that ’s centrality is the
summation of its neighbors’ centralities
• Is this summation bounded?
•:We havefixed
some to normalize!
constant
Social Media http://socialmediamining.info/ Measures
Networkand
Measures
Metrics 14
Eigenvector Centrality (Matrix Formulation)
• Let
• This means that is an eigenvector of
adjacency matrix (or when undirected) and
is the corresponding eigenvalue
• We will choose the eigenvalue-eigenvector
pair which is largest
Social Media http://socialmediamining.info/ Measures
Networkand
Measures
Metrics 15
Eigenvector Centrality, cont.
So, to compute eigenvector centrality of ,
1. We compute the eigenvalues of
2. Select the largest eigenvalue
3. The corresponding eigenvector of is .
4. Based on the Perron-Frobenius theorem, all the
components of will be positive
5. The components of are the eigenvector centralities for
the graph.
Social Media http://socialmediamining.info/ Measures
Networkand
Measures
Metrics 18
Eigenvector Centrality: Example 1
Eigenvalues are
Corresponding eigenvector (assuming has norm 1)
Largest Eigenvalue
Central Node
Social Media http://socialmediamining.info/ Measures
Networkand
Measures
Metrics 19
Eigenvector Centrality: Example 2
= (2.68, -1.74, -1.27, 0.33, 0.00
Eigenvalues Vector
max = 2.68
Social Media http://socialmediamining.info/ Measures
Networkand
Measures
Metrics 20
Katz Centrality
• A major problem with eigenvector
centrality arises when it deals with
directed graphs
• Centrality only passes over outgoing
edges and in special cases such as
when a node is in a directed acyclic
graph centrality becomes zero Elihu Katz
– The node can have many edge
connected to it
• To resolve this problem we add bias term to the
centrality values for all nodes
Eigenvector Centrality
Social Media http://socialmediamining.info/ Measures
Networkand
Measures
Metrics 21
Katz Centrality, cont.
Controlling term Bias term
Rewriting equation in a vector form
vector of all 1’s
Katz centrality:
Social Media http://socialmediamining.info/ Measures
Networkand
Measures
Metrics 22
Katz Centrality, cont.
• When =0, the eigenvector centrality is removed
and all nodes get the same centrality value
– As gets larger the effect of is reduced
• For the matrix to be invertible, we must have
–
– By rearranging we get
– This is basically the characteristic equation, The largest
eigenvalue is easier
– The characteristic equation first becomes zero
to compute (power
when the largest eigenvalue equals -1 method)
In practice we select , where is the largest eigenvalue of
Social Media http://socialmediamining.info/ Measures
Networkand
Measures
Metrics 23
Katz Centrality Example
• The Eigenvalues are -1.68, -1.0, -1.0, 0.35,
3.32
• We assume α=0.25 < 1/3.32 and
Most
important
nodes!
Social Media http://socialmediamining.info/ Measures
Networkand
Measures
Metrics 24
PageRank
• Problem with Katz Centrality:
– In directed graphs, once a node becomes an
authority (high centrality), it passes all its centrality
along all of its out-links
• This is less desirable since not everyone known
by a well-known person is well-known
• Solution?
– We can divide the value of passed centrality by the
number of outgoing links, i.e., out-degree of that
node
– Each connected neighbor gets a fraction of the
source node’s centrality
Social Media http://socialmediamining.info/ Measures
Networkand
Measures
Metrics 25
PageRank, cont.
What if
the
degree is
zero?
Similar to Katz Centrality, in practice, , where is the
largest eigenvalue of . In undirected graphs, the
largest eigenvalue of is = 1; therefore, .
Social Media http://socialmediamining.info/ Measures
Networkand
Measures
Metrics 26
PageRank Example
• We assume α=0.95 < 1 and and
Social Media http://socialmediamining.info/ Measures
Networkand
Measures
Metrics 27
PageRank Example – Alternative Approach
[Markov Chains]
”You don't understand
anything until you
learn it more than
one way”
Using Marvin Minsky (1927-2016)
Power
Method
0?
Ste A B C D E F G
p
0 1/7 1/7 1/7 1/7 1/7 1/7 1/7
1 B/2 C/3 A/3 + A/3 + C/3 + A/3 + C/3 + F/2 +
G F/2 D B/2 E
0.071 0.048 0.190 0.167 0.190 0.119 0.214
Social Media http://socialmediamining.info/ Measures
Networkand
Measures
Metrics 28
PageRank: Example
Step A B C D E F G Sum
1 0.143 0.143 0.143 0.143 0.143 0.143 0.143 1.000
2 0.071 0.048 0.190 0.167 0.190 0.119 0.214 1.000
3 0.024 0.063 0.238 0.147 0.190 0.087 0.250 1.000
4 0.032 0.079 0.258 0.131 0.155 0.111 0.234 1.000
5 0.040 0.086 0.245 0.152 0.142 0.126 0.210 1.000
6 0.043 0.082 0.224 0.158 0.165 0.125 0.204 1.000
7 0.041 0.075 0.219 0.151 0.172 0.115 0.228 1.000
8 0.037 0.073 0.241 0.144 0.165 0.110 0.230 1.000
9 0.036 0.080 0.242 0.148 0.157 0.117 0.220 1.000
10 0.040 0.081 0.232 0.151 0.160 0.121 0.215 1.000
11 0.040 0.077 0.228 0.151 0.165 0.118 0.220 1.000
12 0.039 0.076 0.234 0.148 0.165 0.115 0.223 1.000
13 0.038 0.078 0.236 0.148 0.161 0.116 0.222 1.000
14 0.039 0.079 0.235 0.149 0.161 0.118 0.219 1.000
15 0.039 0.078 0.232 0.150 0.162 0.118 0.220 1.000
Rank 7 6 1 4 3 5 2
Social Media http://socialmediamining.info/ Measures
Networkand
Measures
Metrics 29
Effect of PageRank
PageRank
Node Rank
A 7
B 6
C 1
D 4
E 3
F 5
G 2
Social Media http://socialmediamining.info/ Measures
Networkand
Measures
Metrics 30