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

Community Detection in Social Networks

1. The document summarizes key concepts from the book "Mining of Massive Datasets" by Jure Leskovec, Anand Rajaraman, and Jeff Ullman. 2. It discusses algorithms for finding communities or clusters in networks, including the Girvan-Newman algorithm which removes edges with highest betweenness to partition a network hierarchically. 3. It also covers the concept of modularity, a measure of how well a network is partitioned into communities, and how it can be used to select the optimal number of clusters.

Uploaded by

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

Community Detection in Social Networks

1. The document summarizes key concepts from the book "Mining of Massive Datasets" by Jure Leskovec, Anand Rajaraman, and Jeff Ullman. 2. It discusses algorithms for finding communities or clusters in networks, including the Girvan-Newman algorithm which removes edges with highest betweenness to partition a network hierarchically. 3. It also covers the concept of modularity, a measure of how well a network is partitioned into communities, and how it can be used to select the optimal number of clusters.

Uploaded by

Arun Manick
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 64

Note to other teachers and users of these slides: We would be delighted if you found this our

material useful in giving your own lectures. Feel free to use these slides verbatim, or to modify
them to fit your own needs. If you make use of a significant portion of these slides in your own
lecture, please include this message, or a link to our web site: http://www.mmds.org

Mining of Massive Datasets


Jure Leskovec, Anand Rajaraman, Jeff Ullman
Stanford University

http://www.mmds.org

We often think of networks being organized


into modules, cluster, communities:

J. Leskovec, A. Rajaraman, J. Ullman: Mining of Massive Datasets, http://www.mmds.org

J. Leskovec, A. Rajaraman, J. Ullman: Mining of Massive Datasets, http://www.mmds.org

Find micro-markets by partitioning the


query-to-advertiser graph:

query

advertiser

[Andersen, Lang: Communities from seed sets, 2006]


J. Leskovec, A. Rajaraman, J. Ullman: Mining of Massive Datasets, http://www.mmds.org

Clusters in Movies-to-Actors graph:

[Andersen, Lang: Communities from seed sets, 2006]


J. Leskovec, A. Rajaraman, J. Ullman: Mining of Massive Datasets, http://www.mmds.org

Discovering social circles, circles of trust:

[McAuley, Leskovec: Discovering social circles in ego networks, 2012]


J. Leskovec, A. Rajaraman, J. Ullman: Mining of Massive Datasets, http://www.mmds.org

How to find communities?

We will work with undirected (unweighted) networks


J. Leskovec, A. Rajaraman, J. Ullman: Mining of Massive Datasets, http://www.mmds.org




Edge betweenness: Number of


shortest paths passing over the edge
Intuition:

Edge strengths (call volume)


in a real network

b=16

b=7.5

Edge betweenness
in a real network

J. Leskovec, A. Rajaraman, J. Ullman: Mining of Massive Datasets, http://www.mmds.org

[Girvan-Newman 02]

Divisive hierarchical clustering based on the


notion of edge betweenness:
Number of shortest paths passing through the edge

Girvan-Newman Algorithm:
 Undirected unweighted networks

 Repeat until no edges are left:


 Calculate betweenness of edges
 Remove edges with highest betweenness

 Connected components are communities


 Gives a hierarchical decomposition of the network
J. Leskovec, A. Rajaraman, J. Ullman: Mining of Massive Datasets, http://www.mmds.org

12
33

49

Need to re-compute
betweenness at
every step

J. Leskovec, A. Rajaraman, J. Ullman: Mining of Massive Datasets, http://www.mmds.org

10

Step 1:

Step 3:

Step 2:

Hierarchical network decomposition:

J. Leskovec, A. Rajaraman, J. Ullman: Mining of Massive Datasets, http://www.mmds.org

11

Communities in physics collaborations


J. Leskovec, A. Rajaraman, J. Ullman: Mining of Massive Datasets, http://www.mmds.org

12

Zacharys Karate club:


Hierarchical decomposition

J. Leskovec, A. Rajaraman, J. Ullman: Mining of Massive Datasets, http://www.mmds.org

13

1.
2.

How to compute betweenness?


How to select the number of
clusters?

J. Leskovec, A. Rajaraman, J. Ullman: Mining of Massive Datasets, http://www.mmds.org

14

Want to compute
betweenness of
paths starting at
node 

Breath first search


starting from :

J. Leskovec, A. Rajaraman, J. Ullman: Mining of Massive Datasets, http://www.mmds.org

15

Count the number of shortest paths from


 to all other nodes of the network:

J. Leskovec, A. Rajaraman, J. Ullman: Mining of Massive Datasets, http://www.mmds.org

16

Compute betweenness by working up the


tree: If there are multiple paths count them
fractionally

The algorithm:
Add edge flows:
-- node flow =
1+child edges
-- split the flow up
based on the parent
value
Repeat the BFS
procedure for each
starting node 

1+1 paths to H
Split evenly
1+0.5 paths to J
Split 1:2
1 path to K.
Split evenly
J. Leskovec, A. Rajaraman, J. Ullman: Mining of Massive Datasets, http://www.mmds.org

17

Compute betweenness by working up the


tree: If there are multiple paths count them
fractionally

The algorithm:
Add edge flows:
-- node flow =
1+child edges
-- split the flow up
based on the parent
value
Repeat the BFS
procedure for each
starting node 

1+1 paths to H
Split evenly

1+0.5 paths to J
Split 1:2
1 path to K.
Split evenly
J. Leskovec, A. Rajaraman, J. Ullman: Mining of Massive Datasets, http://www.mmds.org

18

1.
2.

How to compute betweenness?


How to select the number of
clusters?

J. Leskovec, A. Rajaraman, J. Ullman: Mining of Massive Datasets, http://www.mmds.org

19




Communities: sets of
tightly connected nodes
Define: Modularity 

 A measure of how well


a network is partitioned
into communities
 Given a partitioning of the
network into groups  :
Q s S [ (# edges within group s)
(expected # edges within group s) ]
Need a null model!
J. Leskovec, A. Rajaraman, J. Ullman: Mining of Massive Datasets, http://www.mmds.org

20

Given real  on  nodes and edges,


construct rewired network 

 Same degree distribution but


i
random connections
j
 Consider  as a multigraph
 The expected number of edges between nodes
and of degrees and equals to:

 The expected number of edges in (multigraph) G:






   


  


 

  

 

J. Leskovec, A. Rajaraman, J. Ullman: Mining of Massive Datasets, http://www.mmds.org

Note:

   2



21

Modularity of partitioning S of graph G:


 Q s S [ (# edges within group s)
(expected # edges within group s) ]
  ,  


  


Normalizing cost.: -1<Q<1

 

Aij = 1 if ij,
0 else

Modularity values take range [1,1]


 It is positive if the number of edges within
groups exceeds the expected number
 0.3-0.7<Q means significant community structure
J. Leskovec, A. Rajaraman, J. Ullman: Mining of Massive Datasets, http://www.mmds.org

22

Modularity is useful for selecting the


number of clusters:

Next time: Why not optimize Modularity directly?


J. Leskovec, A. Rajaraman, J. Ullman: Mining of Massive Datasets, http://www.mmds.org

23




Undirected graph , !:

2
3

 Divide vertices into two disjoint groups , #

Bi-partitioning task:
A

 How can we define a good partition of ?


 How can we efficiently identify such a partition?

Questions:

J. Leskovec, A. Rajaraman, J. Ullman: Mining of Massive Datasets, http://www.mmds.org

25

What makes a good partition?


 Maximize the number of within-group
connections
 Minimize the number of between-group
connections
5

1
2
3

J. Leskovec, A. Rajaraman, J. Ullman: Mining of Massive Datasets, http://www.mmds.org

26

Express partitioning objectives as a function


of the edge cut of the partition

Cut: Set of edges with only one vertex in a


group:

1
2
3

cut(A,B) = 2
4

J. Leskovec, A. Rajaraman, J. Ullman: Mining of Massive Datasets, http://www.mmds.org

27

Criterion: Minimum-cut
 Minimize weight of connections between groups

arg minA,B cut(A,B)


Degenerate case:
Optimal cut
Minimum cut

Problem:
 Only considers external cluster connections
 Does not consider internal cluster connectivity
J. Leskovec, A. Rajaraman, J. Ullman: Mining of Massive Datasets, http://www.mmds.org

28

[Shi-Malik]

Criterion: Normalized-cut [Shi-Malik, 97]


 Connectivity between groups relative to the
density of each group
$%&!: total weight of the edges with at least
one endpoint in : $%&   

 Why


use this criterion?

Produces more balanced partitions

How do we efficiently find a good partition?


 Problem: Computing optimal cut is NP-hard
J. Leskovec, A. Rajaraman, J. Ullman: Mining of Massive Datasets, http://www.mmds.org

29

 Aij =1 if  , ! is an edge, else 0

A: adjacency matrix of undirected G

 Think of it as a label/value of each node of 

x is a vector in n with components ', , '!

What is the meaning of A x?

Entry yi is a sum of labels xj of neighbors of i


J. Leskovec, A. Rajaraman, J. Ullman: Mining of Massive Datasets, http://www.mmds.org

30

 jth coordinate of A

x:

 Sum of the x-values


of neighbors of j
 Make this a new value at node j


')'

 Analyze the spectrum of matrix representing 


 Spectrum: Eigenvectors ' of a graph, ordered by
the magnitude (strength) of their corresponding
eigenvalues ) :

Spectral Graph Theory:

J. Leskovec, A. Rajaraman, J. Ullman: Mining of Massive Datasets, http://www.mmds.org

31




Suppose all nodes in  have degree *


and  is connected
What are some eigenvalues/vectors of ?
 '  ) ' What is ? What x?

 Lets try: '  , , , !


 Then:  '  *, *, , *  ) '. So: )  *
 We found eigenpair of : '  , , , !, )  *

Remember the meaning of +   ':

J. Leskovec, A. Rajaraman, J. Ullman: Mining of Massive Datasets, http://www.mmds.org

32

Details!




G is d-regular connected, A is its adjacency matrix


Claim:
 d is largest eigenvalue of A,
 d has multiplicity of 1 (there is only 1 eigenvector
associated with eigenvalue d)

Proof: Why no eigenvalue *, - *?

To obtain d we needed '  ' for every ., /


This means '  0 1,1, , 1! for some const. 0
Define:  = nodes with maximum possible value of '
Then consider some vector + which is not a multiple of
vector , , !. So not all nodes (with labels + ) are in 
 Consider some node  and a neighbor  then
node gets a value strictly less than *
 So 3 is not eigenvector! And so * is the largest eigenvalue!





J. Leskovec, A. Rajaraman, J. Ullman: Mining of Massive Datasets, http://www.mmds.org

33




What if  is not connected?

  has 2 components, each *-regular

 '  Put all s on  and 4s on # or vice versa

What are some eigenvectors?

 '  , , , 4, , 4! then 6 '  *, , *, 4, , 4


|B|
|A|
 '  4, , 4, , , ! then  '  4, , 4, *, , *!
 And so in both cases the corresponding )  *

A bit of intuition:
A

)  )7

)  )7 8 4

J. Leskovec, A. Rajaraman, J. Ullman: Mining of Massive Datasets, http://www.mmds.org

2nd largest eigval.


9:7; now has
value very close
to 9:
34

More intuition:

)  )7

)  )7 8 4

2nd largest eigval.


9:7; now has
value very close
to 9:

 If the graph is connected (right example) then we


already know that '  , ! is an eigenvector
 Since eigenvectors are orthogonal then the
components of '7 sum to 0.
 Why? Because ' '7  ' '7 < =

 So we can look at the eigenvector of the 2nd largest


eigenvalue and declare nodes with positive label in A
and negative label in B.
 But there is still lots to sort out.
J. Leskovec, A. Rajaraman, J. Ullman: Mining of Massive Datasets, http://www.mmds.org

35

Adjacency matrix (A):


 n n matrix
 A=[aij], aij=1 if edge between node i and j
5

1
2
4

Important properties:

 Symmetric matrix
 Eigenvectors are real and orthogonal
J. Leskovec, A. Rajaraman, J. Ullman: Mining of Massive Datasets, http://www.mmds.org

36

Degree matrix (D):


 n n diagonal matrix
 D=[dii], dii = degree of node i
5

1
2
4
3

J. Leskovec, A. Rajaraman, J. Ullman: Mining of Massive Datasets, http://www.mmds.org

37

Laplacian matrix (L):


 n n symmetric matrix
5

1
2
3

-1

-1

-1

-1

-1

-1

-1

-1

-1

-1

-1

-1

-1

-1

-1

-1

>  ?  

 '  , , ! then > '  4 and so )  )  4

What is trivial eigenpair?

Important properties:

 Eigenvalues are non-negative real numbers


 Eigenvectors are real and orthogonal
J. Leskovec, A. Rajaraman, J. Ullman: Mining of Massive Datasets, http://www.mmds.org

38

Details!

(a) All eigenvalues are @ 0


(b) B C DB  EF DEF BE BF @ 0 for every B
(c) D  G C G


 That is, D is positive semi-definite

 (c)
(b): B C DB  B C G C GB  BG

Proof:

 As it is just the square of length of GB

GB @ 0

 (b)
(a): Let ) be an eigenvalue of >. Then by (b)
B C DB @ 0 so B C DB  B C 9B  9B C B ) @ 4
 (a)
(c): is also easy! Do it yourself.
J. Leskovec, A. Rajaraman, J. Ullman: Mining of Massive Datasets, http://www.mmds.org

39

Fact: For symmetric matrix M:


T

x Mx
2 = min T
x
x x


What is the meaning of min xT L x on G?

 x I L x  :E,FK; DEF BE BF  :E,FK; LEF  MEF BE BF


  E LEE BEN 


N
B
E,F O E

E,F O 2BE BF

BFN

 2BE BF ! 

'  '

Node has degree * . So, value ' needs to be summed up * times.


But each edge  , ! has two endpoints so we need ' P'
J. Leskovec, A. Rajaraman, J. Ullman: Mining of Massive Datasets, http://www.mmds.org

40

x Mx
2 = min T
x
x x





Details!

Write B in axes of eigenvecotrs Q; , QN , , Q: of


R. So, B  :E SE QE
Then we get: TB  E SE TQE  E SE 9E QE
 4 if X
) W
So, what is 'U R'?
1 otherwise
 B C TB  E SE QE E SE 9E QE  EF SE 9F SF QE QF

 E SE 9E QE QE  ) V
 To minimize this over all unit vectors x orthogonal to:
w = min over choices of S; , S: ! so that:
SEN  1 (unit length) SE  0 (orthogonal to Q; )
 To minimize this, set V   and so ) V  )
J. Leskovec, A. Rajaraman, J. Ullman: Mining of Massive Datasets, http://www.mmds.org

41

 ' is unit vector: '  


 ' is orthogonal to 1st eigenvector , , ! thus:
'   '  4

What else do we know about x?

Remember:

= min
All labelings
of nodes . so
that BE  0

( i , j )E

( xi x j )
i

2
i

We want to assign values ' to nodes i such


that few edges cross 0.
(we want xi and xj to subtract each other)

BE

BF

Balance to minimize

J. Leskovec, A. Rajaraman, J. Ullman: Mining of Massive Datasets, http://www.mmds.org

42




Back to finding the optimal cut


Express partition (A,B) as a vector
P Z 
+  Y
 Z #
We can minimize the cut of the partition by
finding a non-trivial vector x that minimizes:

Cant solve exactly. Lets relax + and


allow it to take any real value.

3E  1 0

J. Leskovec, A. Rajaraman, J. Ullman: Mining of Massive Datasets, http://www.mmds.org

3F  P1

43

BE

)  [\] Z + : The minimum value of Z+! is


+

BF

given by the 2nd smallest eigenvalue 2 of the


Laplacian matrix L
 ^  _`a [\] b Z + : The optimal solution for y
is given by the corresponding eigenvector ',
referred as the Fiedler vector
J. Leskovec, A. Rajaraman, J. Ullman: Mining of Massive Datasets, http://www.mmds.org

44

Details!

Suppose there is a partition of G into A and B


# ghigj klmn o pm q!
where M c |e|, s.t. V 
o
then 2V @ )

 This is the approximation guarantee of the spectral


clustering. It says the cut spectral finds is at most 2
away from the optimal one of score V.

Proof:

 Let: a=|A|, b=|B| and e= # edges from A to B


 Enough to choose some ' based on A and B such
that: 9N c

rs 7rt
s rsu

c 2S

) is only smaller

(while also E BE  0)

J. Leskovec, A. Rajaraman, J. Ullman: Mining of Massive Datasets, http://www.mmds.org

45

Details!

Proof (continued):
 1) Lets set: ' 



Z
w
v 
Z
P
x


#

 Lets quickly verify that E BE  0: y 

 2) Then:

;
z

;
|

rs 7rt
s rsu

;
z

;
z

} } u
s,t 
~
} u
} u
z 7 | ~

e number of edges between A and B

 V

;
z

P{

;
|

} } u

~
} }

~

4

Which proves that the cost


achieved by spectral is better
than twice the OPT cost

J. Leskovec, A. Rajaraman, J. Ullman: Mining of Massive Datasets, http://www.mmds.org

46

Details!

V
V @ ) @
 w'

Putting it all together:

 where nzr is the maximum node degree


in the graph
 Note we only provide the 1st part: V @ )
 We did not prove ) @

V
 w'

 Overall this always certifies that ) always gives a


useful bound
J. Leskovec, A. Rajaraman, J. Ullman: Mining of Massive Datasets, http://www.mmds.org

47

How to define a good partition of a graph?


 Minimize a given graph cut criterion

How to efficiently identify such a partition?


 Approximate using information provided by the
eigenvalues and eigenvectors of a graph

Spectral Clustering

J. Leskovec, A. Rajaraman, J. Ullman: Mining of Massive Datasets, http://www.mmds.org

48

Three basic stages:


 1) Pre-processing
 Construct a matrix representation of the graph

 2) Decomposition
 Compute eigenvalues and eigenvectors of the matrix
 Map each point to a lower-dimensional representation
based on one or more eigenvectors

 3) Grouping
 Assign points to two or more clusters, based on the new
representation

J. Leskovec, A. Rajaraman, J. Ullman: Mining of Massive Datasets, http://www.mmds.org

49

1) Pre-processing:

-1

-1

-1

-1

-1

-1

-1

-1

-1

-1

-1

-1

-1

-1

-1

-1

0.0

0.4

0.3

-0.5

-0.2

-0.4

-0.5

1.0

0.4

0.6

0.4

-0.4

0.4

0.0

0.4

0.3

0.1

0.6

-0.4

0.5

0.4

-0.3

0.1

0.6

0.4

-0.5

4.0

0.4

-0.3

-0.5

-0.2

0.4

0.5

5.0

0.4

-0.6

0.4

-0.4

-0.4

0.0

 Build Laplacian
matrix L of the
graph


2)
Decomposition:
 Find eigenvalues
and eigenvectors x
of the matrix L
 Map vertices to
corresponding
components of 2

3.0
3.0

0.3

0.6

0.3

-0.3

-0.3

-0.6

X=

J. Leskovec, A. Rajaraman, J. Ullman: Mining of Massive Datasets, http://www.mmds.org

How do we now
find the clusters?
50

3) Grouping:
 Sort components of reduced 1-dimensional vector
 Identify clusters by splitting the sorted vector in two

How to choose a splitting point?


 Nave approaches:
 Split at 0 or median value

 More expensive approaches:


 Attempt to minimize normalized cut in 1-dimension
(sweep over ordering of nodes induced by the eigenvector)
Split at 0:
Cluster A: Positive points
Cluster B: Negative points

0.3

0.6

0.3

-0.3

0.3

-0.3

-0.3

0.6

-0.3

-0.6

0.3

-0.6

J. Leskovec, A. Rajaraman, J. Ullman: Mining of Massive Datasets, http://www.mmds.org

51

Value of x2

Rank in x2
J. Leskovec, A. Rajaraman, J. Ullman: Mining of Massive Datasets, http://www.mmds.org

52

Value of x2

Components of x2

Rank in x2
J. Leskovec, A. Rajaraman, J. Ullman: Mining of Massive Datasets, http://www.mmds.org

53

Components of x1

Components of x3
J. Leskovec, A. Rajaraman, J. Ullman: Mining of Massive Datasets, http://www.mmds.org

54

How do we partition a graph into k clusters?

Two basic approaches:


 Recursive bi-partitioning [Hagen et al., 92]
 Recursively apply bi-partitioning algorithm in a
hierarchical divisive manner
 Disadvantages: Inefficient, unstable

 Cluster multiple eigenvectors [Shi-Malik, 00]


 Build a reduced space from multiple eigenvectors
 Commonly used in recent papers
 A preferable approach
J. Leskovec, A. Rajaraman, J. Ullman: Mining of Massive Datasets, http://www.mmds.org

55

Approximates the optimal cut [Shi-Malik, 00]


 Can be used to approximate optimal k-way normalized
cut

Emphasizes cohesive clusters


 Increases the unevenness in the distribution of the data
 Associations between similar points are amplified,
associations between dissimilar points are attenuated
 The data begins to approximate a clustering

Well-separated space

 Transforms data to a new embedded space,


consisting of k orthogonal basis vectors


Multiple eigenvectors prevent instability due to


information loss
J. Leskovec, A. Rajaraman, J. Ullman: Mining of Massive Datasets, http://www.mmds.org

56

[Kumar et al. 99]

Searching for small communities in


the Web graph
What is the signature of a community /
discussion in a Web graph?

Use this to define topics:


What the same people on
the left talk about on the right
Remember HITS!

Dense 2-layer graph


Intuition: Many people all talking about the same things
J. Leskovec, A. Rajaraman, J. Ullman: Mining of Massive Datasets, http://www.mmds.org

58

A more well-defined problem:


Enumerate complete bipartite subgraphs Ks,t
 Where Ks,t : s nodes on the left where each links
to the same t other nodes on the right

|X| = s = 3
|Y| = t = 4

K3,4
Fully connected
J. Leskovec, A. Rajaraman, J. Ullman: Mining of Massive Datasets, http://www.mmds.org

59

[Agrawal-Srikant 99]

Market basket analysis. Setting:


 Market: Universe U of n items
 Baskets: m subsets of U: S1, S2, , Sm U
(Si is a set of items one person bought)
 Support: Frequency threshold f

Goal:
 Find all subsets T s.t. T Si of at least f sets Si
(items in T were bought together at least f times)

Whats the connection between the


itemsets and complete bipartite graphs?
J. Leskovec, A. Rajaraman, J. Ullman: Mining of Massive Datasets, http://www.mmds.org

60

[Kumar et al. 99]

Frequent itemsets = complete bipartite graphs!




How?
 View each node i as a
set Si of nodes i points to
 Ks,t = a set Y of size t
that occurs in s sets Si
 Looking for Ks,t  set of
frequency threshold to s
and look at layer t all
frequent sets of size t

b
i

Si={a,b,c,d}

d
a
j
i
k

b
c
d

Y
s minimum support (|X|=s)
t itemset size (|Y|=t)

J. Leskovec, A. Rajaraman, J. Ullman: Mining of Massive Datasets, http://www.mmds.org

61

[Kumar et al. 99]

Say we find a frequent


itemset Y={a,b,c} of supp s
So, there are s nodes that
link to all of {a,b,c}:

View each node i as a


set Si of nodes i points to
a
b
i

c
d
x

Si={a,b,c,d}

Find frequent itemsets:


s minimum support
t itemset size

We found Ks,t!
Ks,t = a set Y of size t
that occurs in s sets Si

a
z

a
x
y
z

J. Leskovec, A. Rajaraman, J. Ullman: Mining of Massive Datasets, http://www.mmds.org

b
c

Y
62

 {b,d}: support 3
 {e,f}: support 2

c
d
e


f

Itemsets:
a = {b,c,d}
b = {d}
c = {b,d,e,f}
d = {e,f}
e = {b,d}
f = {}

Support threshold s=2

And we just found 2 bipartite


subgraphs:
a

c
d

c
d

e
J. Leskovec, A. Rajaraman, J. Ullman: Mining of Massive Datasets, http://www.mmds.org

63

Example of a community from a web graph

Nodes on the right

Nodes on the left

[Kumar, Raghavan, Rajagopalan, Tomkins: Trawling the Web for emerging cyber-communities 1999]
J. Leskovec, A. Rajaraman, J. Ullman: Mining of Massive Datasets, http://www.mmds.org

64

You might also like