Paths ¡and ¡ ¡ Random ¡Walks ¡on ¡Graphs ¡
Based ¡on ¡materials ¡by ¡Lala ¡Adamic ¡and ¡ Purnamrita ¡Sarkar ¡
1
Paths and Random Walks on Graphs Based on materials by - - PowerPoint PPT Presentation
Paths and Random Walks on Graphs Based on materials by Lala Adamic and Purnamrita Sarkar 1 Mo#va#on: Link predic#on in social networks 2 Mo#va#on:
Based ¡on ¡materials ¡by ¡Lala ¡Adamic ¡and ¡ Purnamrita ¡Sarkar ¡
1
Mo#va#on: ¡Link ¡predic#on ¡in ¡social ¡networks ¡
2
Mo#va#on: ¡Basis ¡for ¡recommenda#on ¡
3
4
– Papers ¡linked ¡by ¡cita>on ¡ – Authors ¡linked ¡by ¡co-‑authorship ¡ – Bipar>te ¡graph ¡of ¡customers ¡and ¡products ¡ – Web-‑graph ¡ ¡ – Friendship ¡networks: ¡who ¡knows ¡whom ¡
5
– Top ¡k ¡matches ¡for ¡“Random ¡Walks” ¡from ¡Citeseer ¡ – Who ¡are ¡the ¡most ¡likely ¡co-‑authors ¡of ¡“Manuel ¡Blum”. ¡ – Top ¡k ¡book ¡recommenda>ons ¡ ¡for ¡Jen ¡from ¡Amazon ¡ – Top ¡k ¡websites ¡matching ¡“Sound ¡of ¡Music” ¡ – Top ¡k ¡friend ¡recommenda>ons ¡for ¡Bob ¡when ¡he ¡joins ¡ “Facebook” ¡
6
History: Graph theory
n Euler’s Seven Bridges of Königsberg – one of the first problems
in graph theory
n Is there a route that crosses each bridge only once and returns to
the starting point?
Source: http://en.wikipedia.org/wiki/Seven_Bridges_of_Königsberg Image 1 – GNU v1.2: Bogdan, Wikipedia; http://commons.wikimedia.org/wiki/Commons:GNU_Free_Documentation_License Image 2 – GNU v1.2: Booyabazooka, Wikipedia; http://commons.wikimedia.org/wiki/Commons:GNU_Free_Documentation_License Image 3 – GNU v1.2: Riojajar, Wikipedia; http://commons.wikimedia.org/wiki/Commons:GNU_Free_Documentation_License
Eulerian paths
n If starting point and end point are the same:
n only possible if no nodes have an odd degree
n each path must visit and leave each shore
n If don’t need to return to starting point
n can have 0 or 2 nodes with an odd degree
Node degree from matrix values
n Outdegree =
1 1 1 1 1 1 1
= n j ij
A
1
we obtain by summing the number of non- zero entries in the 3rd row n Indegree =
1 1 1 1 1 1 1
= n i ij
A
1
which we obtain by summing the number of non-zero entries in the 3rd column
= n i i
A
1 3
= n j j
A
1 3
– A(i,j) ¡= ¡weight ¡on ¡edge ¡from ¡i ¡to ¡j ¡ – If ¡the ¡graph ¡is ¡undirected ¡A(i,j)=A(j,i), ¡i.e. ¡A ¡is ¡symmetric ¡
– P ¡is ¡row ¡stochas>c ¡ – P(i,j) ¡= ¡probability ¡of ¡stepping ¡on ¡node ¡j ¡from ¡node ¡i ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡= ¡A(i,j)/∑iA(i,j) ¡ ¡
– L(i,j)=∑iA(i,j)-‑A(i,j) ¡ – Symmetric ¡posi>ve ¡semi-‑definite ¡for ¡undirected ¡graphs ¡ – Singular ¡
10
11
B E C A D
1 1 1 1 1 1 1 1 1 1 1 1 1 1
Adjacency Matrix
B E C D A
1/2 1/2 1/3 1/3 1/3 1/4 1/4 1/4 1/4 1/2 1/2 1/3 1/3 1/3
Transition Matrix
1/3 1/2 1/3 1/3 1/2 1/2 1/2 1/3 1/3 1/3 1/4 1/4 1/4 1/4
12
Graph Laplacian
B E C A D
1 1 1 1 1 1 1 1 1 1 1 1 1 1
2 3 4 2 3
2
3
4
2
3 A B C D E E D C B A
A B C D E E D C B A
A=
1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 3 4 2 3
d =
13
Graph Laplacian
Take the eigendecomposition of L
B E C A D
1 1 1 1 1 1 1 1 1 1 1 1 1 1
2 3 4 2 3
2
3
4
2
3 A B C D E E D C B A
A B C D E E D C B A
A=
1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 3 4 2 3
d = =
λ1 λ2 λ3 λ4 λ5 QT
direc>on ¡for ¡a ¡matrix ¡
such ¡that ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡, ¡where ¡v ¡is ¡the ¡eigenvector ¡ and ¡λ ¡is ¡the ¡corresponding ¡eigenvalue ¡
– Mul>plying ¡vector ¡v ¡by ¡the ¡scalar ¡λ ¡effec>vely ¡ stretches ¡or ¡shrinks ¡the ¡vector ¡
independent ¡eigenvectors ¡
Av v λ =
eigenvectors ¡are ¡then ¡the ¡major ¡and ¡minor ¡ axes ¡of ¡the ¡ellipse ¡
16
=
λ1 λ2 λ3 λ4 λ5 q1 q2 q3 q5 q4 q1
T
q2
T
q3
T
q4
T
q5
T
2
3
4
2
3 Eigenvector q1 is constant
0.22
0.5 0.65 0.45 0.22 0.65
0.27 0.45
0.00 0.00
0.45 0.22 0.27 0.5
0.45 0.22
0.45
q1 q2 q3 q4 q5
E D C B A
Eigenvalue λ1 = 0
5.00 4.41 3.00 1.59 0.00 1 2 3 4 5
17
q1 q2 q5 q10 q20 q50
Meshes provided by Gabriel Peyré
=
λ1 λ2 λ3 λ4 λ5 q1 q2 q3 q5 q4 q1
T
q2
T
q3
T
q4
T
q5
T
q1 q2 q1 q2
Random ¡Walks ¡
Adjacency ¡matrix ¡A ¡
18
Transition matrix P
1 1 1 1 1 1/2 1/2 1
19
1 1/2 1/2 1
t=0
20
1 1/2 1/2 1 1 1/2 1/2 1
t=0 t=1
21
1 1/2 1/2 1 1 1/2 1/2 1
t=0 t=1
1 1/2 1/2 1
t=2
22
1 1/2 1/2 1 1 1/2 1/2 1
t=0 t=1
1 1/2 1/2 1
t=2
1 1/2 1/2 1
t=3
φ(t)
i
φ(t+1)
i
= X
j
φ(t)
i
× Pr(j → i)
φ(t+1)
i
= φ(t)
i
× P = φ(t−1)
i
× P × P = φ(t−2)
i
× P × P × P · · · = φ(0)
i
× P t
– i.e. ¡ ¡
24
φ(t+1) = φ(t)
What ¡is ¡a ¡sta>onary ¡distribu>on? ¡ ¡ Intui>vely ¡and ¡Mathema>cally ¡
25
What ¡is ¡a ¡sta>onary ¡distribu>on? ¡ ¡ Intui>vely ¡and ¡Mathema>cally ¡
>me ¡a ¡random ¡walker ¡spends ¡visi>ng ¡that ¡node. ¡
26
What ¡is ¡a ¡sta>onary ¡distribu>on? ¡ ¡ Intui>vely ¡and ¡Mathema>cally ¡
>me ¡a ¡random ¡walker ¡spends ¡visi>ng ¡that ¡node. ¡
27
φ(t+1) = φ(t) × P
>me ¡a ¡random ¡walker ¡spends ¡visi>ng ¡that ¡node. ¡
¡
φ(∞)
What ¡is ¡a ¡sta>onary ¡distribu>on? ¡ ¡ Intui>vely ¡and ¡Mathema>cally ¡
28
φ(t+1) = φ(t) × P φ(∞) = φ(∞) × P
What ¡is ¡a ¡sta>onary ¡distribu>on? ¡ ¡ Intui>vely ¡and ¡Mathema>cally ¡
>me ¡a ¡random ¡walker ¡spends ¡visi>ng ¡that ¡node. ¡
29
φ(t+1) = φ(t) × P φ(∞) = φ(∞) × P
φ(∞)
30
(Horn ¡& ¡Johnson, ¡1985) ¡
– Called ¡the ¡Perron ¡vector ¡ ¡ ¡ ¡
¡
Power ¡method ¡to ¡compute ¡ ¡
1: set φ(0) to be a normalized nonnegative random vector 2: set i = 0 3: loop until φ(0), φ(1), . . . , φ(i−1), φ(i) converges 4: set φ(i+1) = Pφ(i) 5: normalize φ(i+1) 6: i++ 7: end loop 8: return φ(i)
φ(∞) φ(∞)
– Yes, ¡if ¡the ¡graph ¡is ¡“well-‑behaved”. ¡
31
¡ ¡
32
Irreducible Not irreducible
called ¡period. ¡ ¡ ¡
33
Aperiodic Periodicity is 3
Implica>ons ¡of ¡the ¡Perron ¡Frobenius ¡Theorem ¡
the ¡largest ¡eigenvalue ¡of ¡the ¡transi>on ¡matrix ¡will ¡be ¡ equal ¡to ¡1 ¡and ¡all ¡the ¡other ¡eigenvalues ¡will ¡be ¡ strictly ¡less ¡than ¡1. ¡
– Let ¡the ¡eigenvalues ¡of ¡P ¡be ¡{σi| ¡i=0:n-‑1} ¡in ¡non-‑increasing ¡
– σ0 ¡= ¡1 ¡> ¡σ1 ¡> ¡σ2 ¡>= ¡……>= ¡σn ¡
34
Implica>ons ¡of ¡the ¡Perron ¡Frobenius ¡Theorem ¡
the ¡largest ¡eigenvalue ¡of ¡the ¡transi>on ¡matrix ¡will ¡be ¡ equal ¡to ¡1 ¡and ¡all ¡the ¡other ¡eigenvalues ¡will ¡be ¡ strictly ¡less ¡than ¡1. ¡
– Let ¡the ¡eigenvalues ¡of ¡P ¡be ¡{σi| ¡i=0:n-‑1} ¡in ¡non-‑increasing ¡
– σ0 ¡= ¡1 ¡> ¡σ1 ¡> ¡σ2 ¡>= ¡……>= ¡σn ¡
there ¡exists ¡an ¡unique ¡sta>onary ¡distribu>on. ¡
35
about ¡the ¡importance ¡of ¡a ¡page ¡
– Occasionally, ¡the ¡surfer ¡gets ¡bored ¡and ¡jumps ¡to ¡a ¡ random ¡other ¡page ¡
Algebra ¡Behind ¡Google” ¡
37
ensure ¡that ¡the ¡graph ¡is ¡strongly ¡connected ¡and ¡ aperiodic: ¡
P = D−1A
Pu,v = Au,v dout
u
= Au,v Pn
v=1 Au,v
Pteleport = ηP + (1 − η)11T − I |V |
38