Spectral Graph Theory

Page 1

CMU SCS

Large Graph Mining: Power Tools and a Practitioner’s Guide Christos Faloutsos Gary Miller Charalampos (Babis) Tsourakakis CMU


CMU SCS

Outline • Reminders • Adjacency matrix – Intuition behind eigenvectors: Eg., Bipartite Graphs – Walks of length k

• Laplacian – Connected Components – Intuition: Adjacency vs. Laplacian – Cheeger Inequality and Sparsest Cut: • Derivation, intuition • Example

• Normalized Laplacian

KDD'09

Faloutsos, Miller, Tsourakakis

P7-2


CMU SCS

Matrix Representations of G(V,E) Associate a matrix to a graph: • Adjacency matrix Main focus • Laplacian • Normalized Laplacian

KDD'09

Faloutsos, Miller, Tsourakakis

P7-3


CMU SCS

Recall: Intuition • A as vector transformation x’

A

2 1

2 1 =

x

1 3

1 0

1 3

2 1

x’ x


CMU SCS

Intuition • By defn., eigenvectors remain parallel to themselves (‘fixed points’)

λ1

v1 0.52

3.62 * 0.85 =

A

2 1

v1

1 3

0.52 0.85


CMU SCS

Intuition • By defn., eigenvectors remain parallel to themselves (‘fixed points’) • And orthogonal to each other


CMU SCS

Keep in mind! • For the rest of slides we will be talking for square nxn matrices m1n   m11  M =  ...  mn1 mnn 

and symmetric ones, i.e,

M =M KDD'09

T

Faloutsos, Miller, Tsourakakis

P7-7


CMU SCS

Outline • Reminders • Adjacency matrix – Intuition behind eigenvectors: Eg., Bipartite Graphs – Walks of length k

• Laplacian – Connected Components – Intuition: Adjacency vs. Laplacian – Cheeger Inequality and Sparsest Cut: • Derivation, intuition • Example

• Normalized Laplacian

KDD'09

Faloutsos, Miller, Tsourakakis

P7-8


CMU SCS

Adjacency matrix Undirected

4 1

A= 2 KDD'09

3 Faloutsos, Miller, Tsourakakis

P7-9


CMU SCS

Adjacency matrix Undirected Weighted

10 4 1

0.3

4

2

3

2

KDD'09

A=

Faloutsos, Miller, Tsourakakis

P7-10


CMU SCS

Adjacency matrix Directed

4 1 2

3 KDD'09

Observation If G is undirected, A = AT

Faloutsos, Miller, Tsourakakis

P7-11


CMU SCS

Spectral Theorem Theorem [Spectral Theorem] • If M=MT, then   λ1  0     M =  x1 ... xn   O     0 λn   x2 x1

KDD'09

T

x1 ... T xn

  T T = λ x x + L + λ x x 1 1 1 n n n   

Reminder 1: xi,xj orthogonal

Faloutsos, Miller, Tsourakakis

P7-12


CMU SCS

Spectral Theorem Theorem [Spectral Theorem] • If M=MT, then   λ1  0     M =  x1 ... xn   O     0 λn   λ2

T

x1 ... T xn

  T T = λ x x + L + λ x x 1 1 1 n n n   

Reminder 2: λ1

KDD'09

xi λi

Faloutsos, Miller, Tsourakakis

i-th principal axis length of i-th principal axis P7-13


CMU SCS

Outline • Reminders • Adjacency matrix – Intuition behind eigenvectors: Eg., Bipartite Graphs – Walks of length k

• Laplacian – Connected Components – Intuition: Adjacency vs. Laplacian – Cheeger Inequality and Sparsest Cut: • Derivation, intuition • Example

• Normalized Laplacian

KDD'09

Faloutsos, Miller, Tsourakakis

P7-14


CMU SCS

Eigenvectors: • Give groups • Specifically for bi-partite graphs, we get each of the two sets of nodes • Details:


CMU SCS

Bipartite Graphs Any graph with no cycles of odd length is bipartite

K3,3 1

4

2

5

3

6

KDD'09

Q1: Can we check if a graph is bipartite via its spectrum? Q2: Can we get the partition of the vertices in the two sets of nodes?

Faloutsos, Miller, Tsourakakis

P7-16


CMU SCS

Bipartite Graphs Adjacency matrix

K3,3 1

4

2

5

3

6

where

Eigenvalues: Λ=[3,-3,0,0,0,0] KDD'09

Faloutsos, Miller, Tsourakakis

P7-17


CMU SCS

Bipartite Graphs Adjacency matrix

K3,3 1

4

2

5

3

6

where

Why 位1=-位2=3? Recall: Ax=位x, (位,x) eigenvalue-eigenvector KDD'09

Faloutsos, Miller, Tsourakakis

P7-18


CMU SCS

Bipartite Graphs 1 1 1 2

4

1

5

1 3

6

3=3x1 1 1 3 2

4

1

1

5

1

1

6

1

Value @ each node: eg., enthusiasm about a product KDD'09

Faloutsos, Miller, Tsourakakis

P7-19


CMU SCS

Bipartite Graphs 1 1 1 2

4

1

5

1 3

6

3=3x1 1

4

1

1

5

1

1

6

1

1-vector remains unchanged (just grows by ‘3’ = λ1 ) KDD'09

Faloutsos, Miller, Tsourakakis

P7-20


CMU SCS

Bipartite Graphs 1 1 1 2

4

1

5

1 3

6

3=3x1 1

4

1

1

5

1

1

6

1

Which other vector remains unchanged? KDD'09

Faloutsos, Miller, Tsourakakis

P7-21


CMU SCS

Bipartite Graphs 1 1 1 2

4

-1 -3=(-3)x1 -1 -2 -3 1

4

-1

5

-1

5

-1

1 3

6

-1

6

-1

KDD'09

Faloutsos, Miller, Tsourakakis

P7-22


CMU SCS

Bipartite Graphs • Observation u2 gives the partition of the nodes in the two sets S, V-S! 1 2 3 4 5 6

S V-S Question: Were we just “lucky”? Answer: No Theorem: λ2=-λ1 iff G bipartite. u2 gives the partition. KDD'09

Faloutsos, Miller, Tsourakakis

P7-23


CMU SCS

Outline • Reminders • Adjacency matrix – Intuition behind eigenvectors: Eg., Bipartite Graphs – Walks of length k

• Laplacian – Connected Components – Intuition: Adjacency vs. Laplacian – Cheeger Inequality and Sparsest Cut: • Derivation, intuition • Example

• Normalized Laplacian

KDD'09

Faloutsos, Miller, Tsourakakis

P7-24


CMU SCS

Walks • A walk of length r in a directed graph:

where a node can be used more than once. • Closed walk when: 4 1 2 KDD'09

Closed walk of length 3 Walk of length 2 2-1-3-2 2-1-4 3

Faloutsos, Miller, Tsourakakis

P7-25


CMU SCS

Walks Theorem: G(V,E) directed graph, adjacency matrix A. The number of walks from node u to node v in G with length r is (Ar)uv Proof: Induction on k. See Doyle-Snell, p.165

KDD'09

Faloutsos, Miller, Tsourakakis

P7-26


CMU SCS

Walks Theorem: G(V,E) directed graph, adjacency matrix A. The number of walks from node u to node v in G with length r is (Ar)uv

 A =  

KDD'09

aij1

   , A2 =     

(i,i1),..,(ir-1,j)

(i, i1),(i1,j)

(i,j)

aij2

   , .., Ar =     

Faloutsos, Miller, Tsourakakis

aijr

   

P7-27


CMU SCS

Walks 4 1 2

3 4

i=2, j=4 1 2 KDD'09

3 Faloutsos, Miller, Tsourakakis

P7-28


CMU SCS

Walks 4 1 2

3 i=3, j=3

4 1

2 KDD'09

Faloutsos, Miller, Tsourakakis

3 P7-29


CMU SCS

Walks 4 1 2

3

4

Always 0, node 4 is a sink

1 2 KDD'09

3

Faloutsos, Miller, Tsourakakis

P7-30


CMU SCS

Walks Corollary: If A is the adjacency matrix of undirected G(V,E) (no self loops), e edges and t triangles. Then the following hold: a) trace(A) = 0 b) trace(A2) = 2e 1 3 c) trace(A ) = 6t 1 2 1

2 3

KDD'09

Faloutsos, Miller, Tsourakakis

P7-31


CMU SCS

Walks Corollary: If A is the adjacency matrix of undirected G(V,E) (no self loops), e edges and t triangles. Then the following hold: a) trace(A) = 0 b) trace(A2) = 2e r may be 3 Computing A c) trace(A ) = 6t expensive!

KDD'09

Faloutsos, Miller, Tsourakakis

P7-32


CMU SCS

Remark: virus propagation The earlier result makes sense now: • The higher the first eigenvalue, the more paths available -> • Easier for a virus to survive


CMU SCS

Outline • Reminders • Adjacency matrix – Intuition behind eigenvectors: Eg., Bipartite Graphs – Walks of length k

• Laplacian – Connected Components – Intuition: Adjacency vs. Laplacian – Cheeger Inequality and Sparsest Cut: • Derivation, intuition • Example

• Normalized Laplacian

KDD'09

Faloutsos, Miller, Tsourakakis

P7-34


CMU SCS

Main upcoming result the second eigenvector of the Laplacian (u2) gives a good cut: Nodes with positive scores should go to one group And the rest to the other


CMU SCS

Laplacian

4 1 2

L= D-A= 3 Diagonal matrix, dii=di

KDD'09

Faloutsos, Miller, Tsourakakis

P7-36


CMU SCS

Weighted Laplacian

10 4 1

0.3

4

2

3

2

KDD'09

Faloutsos, Miller, Tsourakakis

P7-37


CMU SCS

Outline • Reminders • Adjacency matrix – Intuition behind eigenvectors: Eg., Bipartite Graphs – Walks of length k

• Laplacian – Connected Components – Intuition: Adjacency vs. Laplacian – Cheeger Inequality and Sparsest Cut: • Derivation, intuition • Example

• Normalized Laplacian

KDD'09

Faloutsos, Miller, Tsourakakis

P7-38


CMU SCS

Connected Components • Lemma: Let G be a graph with n vertices and c connected components. If L is the Laplacian of G, then rank(L)= n-c. • Proof: see p.279, Godsil-Royle

KDD'09

Faloutsos, Miller, Tsourakakis

P7-39


CMU SCS

Connected Components

G(V,E) 1

2

3

4

L=

6 7

5

#zeros = #components

eig(L)= KDD'09

Faloutsos, Miller, Tsourakakis

P7-40


CMU SCS

Connected Components

G(V,E) 1

2

3 0.01 6

4 7

5

L= #zeros Indicates = #components a “good cut�

eig(L)= KDD'09

Faloutsos, Miller, Tsourakakis

P7-41


CMU SCS

Outline • Reminders • Adjacency matrix – Intuition behind eigenvectors: Eg., Bipartite Graphs – Walks of length k

• Laplacian – Connected Components – Intuition: Adjacency vs. Laplacian – Cheeger Inequality and Sparsest Cut: • Derivation, intuition • Example

• Normalized Laplacian

KDD'09

Faloutsos, Miller, Tsourakakis

P7-42


CMU SCS

Adjacency vs. Laplacian Intuition Let x be an indicator vector:

V-S

xi = 1, if i ∈ S

S

xi = 0, if i ∉ S

Consider now y=Lx

KDD'09

k-th coordinate

Faloutsos, Miller, Tsourakakis

P7-43


CMU SCS

G30,0.5

Adjacency vs. Laplacian Intuition S

Consider now y=Lx

k

KDD'09

Faloutsos, Miller, Tsourakakis

P7-44


CMU SCS

G30,0.5

Adjacency vs. Laplacian Intuition S

Consider now y=Lx

k

KDD'09

Faloutsos, Miller, Tsourakakis

P7-45


CMU SCS

G30,0.5

Adjacency vs. Laplacian Intuition S

Consider now y=Lx

k k

Laplacian: connectivity, Adjacency: #paths KDD'09

Faloutsos, Miller, Tsourakakis

P7-46


CMU SCS

Outline • Reminders • Adjacency matrix – Intuition behind eigenvectors: Eg., Bipartite Graphs – Walks of length k

• Laplacian – Connected Components – Intuition: Adjacency vs. Laplacian – Sparsest Cut and Cheeger inequality: • Derivation, intuition • Example

• Normalized Laplacian

KDD'09

Faloutsos, Miller, Tsourakakis

P7-47


CMU SCS

Why Sparse Cuts? • Clustering, Community Detection 4

cut

1

8 5 9

2

3

6

7

• And more: Telephone Network Design, VLSI layout, Sparse Gaussian Elimination, Parallel Computation KDD'09

Faloutsos, Miller, Tsourakakis

P7-48


CMU SCS

Quality of a Cut • Isoperimetric number φ of a cut S: #edges across

#nodes in smallest partition

4 1 2 KDD'09

3 Faloutsos, Miller, Tsourakakis

P7-49


CMU SCS

Quality of a Cut • Isoperimetric number φ of a graph = score of best cut:

4 1 2 KDD'09

3

and thus

Faloutsos, Miller, Tsourakakis

P7-50


CMU SCS

Quality of a Cut • Isoperimetric number φ of a graph = score of best cut: Best cut: BUT: 4

λ2:

1 2 KDD'09

3

hard to find Cheeger’s inequality gives bounds Plays major role

Let’s see the intuition behind λ2 Faloutsos, Miller, Tsourakakis

P7-51


CMU SCS

Laplacian and cuts - overview • A cut corresponds to an indicator vector (ie., 0/1 scores to each node) • Relaxing the 0/1 scores to real numbers, gives eventually an alternative definition of the eigenvalues and eigenvectors


CMU SCS

Why λ2? Characteristic Vector x

S

V-S

xi = 1, if i ∈ S xi = 0, if i ∉ S Then:

KDD'09

Faloutsos, Miller, Tsourakakis

Edges across cut

P7-53


CMU SCS

Why 位2? S 4

V-S

cut

1

8 5 9

2

3

6

7

x=[1,1,1,1,0,0,0,0,0]T

xTLx=2 KDD'09

Faloutsos, Miller, Tsourakakis

P7-54


CMU SCS

Why 位2?

Ratio cut Sparsest ratio cut NP-hard Relax the constraint:

?

Normalize: KDD'09

Faloutsos, Miller, Tsourakakis

P7-55


CMU SCS

Why 位2? Sparsest ratio cut NP-hard Relax the constraint: 位2

Normalize: because of the Courant-Fisher theorem (applied to L)

KDD'09

Faloutsos, Miller, Tsourakakis

P7-56


CMU SCS

Why 位2? OSCILLATE Each ball 1 unit of mass

x1

xn

Lx = 位x Dfn of eigenvector

Matrix viewpoint:

KDD'09

Faloutsos, Miller, Tsourakakis

P7-57


CMU SCS

Why λ2? OSCILLATE Each ball 1 unit of mass

KDD'09

xn

Lx = λx

Force due to neighbors

Physics viewpoint:

x1

displacement

Hooke’s constant

Faloutsos, Miller, Tsourakakis

P7-58


CMU SCS

Why 位2? OSCILLATE Each ball 1 unit of mass

x1

xn

Lx = 位x Node id

Eigenvector value For the first eigenvector: All nodes: same displacement (= value)

KDD'09

Faloutsos, Miller, Tsourakakis

P7-59


CMU SCS

Why 位2? OSCILLATE Each ball 1 unit of mass

x1

xn

Lx = 位x Node id

Eigenvector value

KDD'09

Faloutsos, Miller, Tsourakakis

P7-60


CMU SCS

Why λ2? Fundamental mode of vibration: “along” the separator

KDD'09

Faloutsos, Miller, Tsourakakis

P7-61


CMU SCS

Cheeger Inequality Score of best cut (hard to compute)

Max degree KDD'09

2nd smallest eigenvalue (easy to compute) Faloutsos, Miller, Tsourakakis

P7-62


CMU SCS

Cheeger Inequality and graph partitioning heuristic:

• Step 1: Sort vertices in non-decreasing order according to their score of the second eigenvector • Step 2: Decide where to cut. • Bisection Two common heuristics • Best ratio cut KDD'09

Faloutsos, Miller, Tsourakakis

P7-63


CMU SCS

Outline • Reminders • Adjacency matrix • Laplacian – Connected Components – Intuition: Adjacency vs. Laplacian – Sparsest Cut and Cheeger inequality: • Derivation, intuition • Example

• Normalized Laplacian

KDD'09

Faloutsos, Miller, Tsourakakis

P7-64


CMU SCS

Example: Spectral Partitioning

• K500

• K500

dumbbell graph

AIn= social zeros(1000); network analysis, such clusters are called communities A(1:500,1:500)=ones(500)-eye(500); A(501:1000,501:1000)= ones(500)-eye(500); myrandperm = randperm(1000); B = A(myrandperm,myrandperm); KDD'09

Faloutsos, Miller, Tsourakakis

P7-65


CMU SCS

Example: Spectral Partitioning • This is how adjacency matrix of B looks spy(B)

KDD'09

Faloutsos, Miller, Tsourakakis

P7-66


CMU SCS

Example: Spectral Partitioning • This is how the 2nd eigenvector of B looks like. L = diag(sum(B))-B; [u v] = eigs(L,2,'SM'); plot(u(:,1),’x’) Not so much information yet…

KDD'09

Faloutsos, Miller, Tsourakakis

P7-67


CMU SCS

Example: Spectral Partitioning • This is how the 2nd eigenvector looks if we sort it. [ign ind] = sort(u(:,1)); plot(u(ind),'x')

But now we see the two communities!

KDD'09

Faloutsos, Miller, Tsourakakis

P7-68


CMU SCS

Example: Spectral Partitioning • This is how adjacency matrix of B looks now spy(B(ind,ind)) Community 1 Cut here!

Observation: Both 2heuristics Community are equivalent for the dumbbell KDD'09

Faloutsos, Miller, Tsourakakis

P7-69


CMU SCS

Outline • Reminders • Adjacency matrix • Laplacian – Connected Components – Intuition: Adjacency vs. Laplacian – Sparsest Cut and Cheeger inequality:

• Normalized Laplacian

KDD'09

Faloutsos, Miller, Tsourakakis

P7-70


CMU SCS

Why Normalized Laplacian

• K500

The only weighted edge!

• K500 Cut here φ=

Cut here >

φ=

So, φ is not good here…

KDD'09

Faloutsos, Miller, Tsourakakis

P7-71


CMU SCS

Why Normalized Laplacian

• K500

Optimize Cheeger constant h(G), balanced cuts

The only weighted edge!

• K500 Cut here φ=

Cut here >

φ=

where KDD'09

Faloutsos, Miller, Tsourakakis

P7-72


CMU SCS

Extensions • Normalized Laplacian – Ng, Jordan, Weiss Spectral Clustering – Laplacian Eigenmaps for Manifold Learning – Computer Vision and many more applications… Standard reference: Spectral Graph Theory Monograph by Fan Chung Graham

KDD'09

Faloutsos, Miller, Tsourakakis

P7-73


CMU SCS

Conclusions Spectrum tells us a lot about the graph: • Adjacency: #Paths • Laplacian: Sparse Cut • Normalized Laplacian: Normalized cuts, tend to avoid unbalanced cuts

KDD'09

Faloutsos, Miller, Tsourakakis

P7-74


CMU SCS

References • Fan R. K. Chung: Spectral Graph Theory (AMS) • Chris Godsil and Gordon Royle: Algebraic Graph Theory (Springer) • Bojan Mohar and Svatopluk Poljak: Eigenvalues in Combinatorial Optimization, IMA Preprint Series #939 • Gilbert Strang: Introduction to Applied Mathematics (Wellesley-Cambridge Press)

KDD'09

Faloutsos, Miller, Tsourakakis

P7-75


Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.