Random Walks on Graphs An Overview Purnamrita Sarkar

  • Slides: 50
Download presentation
Random Walks on Graphs: An Overview Purnamrita Sarkar, CMU Shortened and modified by Longin

Random Walks on Graphs: An Overview Purnamrita Sarkar, CMU Shortened and modified by Longin Jan Latecki 1

Motivation: Link prediction in social networks 2

Motivation: Link prediction in social networks 2

Motivation: Basis for recommendation 3

Motivation: Basis for recommendation 3

Motivation: Personalized search 4

Motivation: Personalized search 4

Why graphs? n The underlying data is naturally a graph q q q Papers

Why graphs? n The underlying data is naturally a graph q q q Papers linked by citation Authors linked by co-authorship Bipartite graph of customers and products Web-graph Friendship networks: who knows whom 5

What are we looking for n Rank nodes for a particular query q q

What are we looking for n Rank nodes for a particular query q q q Top k matches for “Random Walks” from Citeseer Who are the most likely co-authors of “Manuel Blum”. Top k book recommendations for Purna from Amazon Top k websites matching “Sound of Music” Top k friend recommendations for Purna when she joins “Facebook” 6

Talk Outline n Basic definitions q q n Random walks Stationary distributions Properties q

Talk Outline n Basic definitions q q n Random walks Stationary distributions Properties q q Perron frobenius theorem Electrical networks, hitting and commute times n n Euclidean Embedding Applications q Pagerank n n q q Power iteration Convergencce Personalized pagerank Rank stability 7

Definitions n nxn Adjacency matrix A. q q n nxn Transition matrix P. q

Definitions n nxn Adjacency matrix A. q q n nxn Transition matrix P. q q n 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 stochastic P(i, j) = probability of stepping on node j from node i = A(i, j)/∑i. A(i, j) nxn Laplacian Matrix L. q q q L(i, j)=∑i. A(i, j)-A(i, j) Symmetric positive semi-definite for undirected graphs Singular 8

Definitions Adjacency matrix A Transition matrix P 1 1 1/2 9

Definitions Adjacency matrix A Transition matrix P 1 1 1/2 9

What is a random walk t=0 1 1 1/2 10

What is a random walk t=0 1 1 1/2 10

What is a random walk t=1 t=0 1 1 1/2 11 1/2

What is a random walk t=1 t=0 1 1 1/2 11 1/2

What is a random walk t=1 t=0 1 1 1/2 t=2 1 1 1/2

What is a random walk t=1 t=0 1 1 1/2 t=2 1 1 1/2 12 1/2

What is a random walk t=1 t=0 1 1 1/2 1/2 t=2 1 1

What is a random walk t=1 t=0 1 1 1/2 1/2 t=2 1 1 1/2 t=3 1 1 1/2 13 1/2

Probability Distributions n n xt(i) = probability that the surfer is at node i

Probability Distributions n n xt(i) = probability that the surfer is at node i at time t xt+1(i) = ∑j(Probability of being at node j)*Pr(j->i) =∑jxt(j)*P(j, i) n xt+1 = xt. P = xt-1*P*P= xt-2*P*P*P = …=x 0 Pt n Compute x 1 for x 0 =(1, 0, 0)’. 1 2 1/2 1 1 1/2 14 3

Stationary Distribution n What happens when the surfer keeps walking for a long time?

Stationary Distribution n What happens when the surfer keeps walking for a long time? n When the surfer keeps walking for a long time n When the distribution does not change anymore q n i. e. x. T+1 = x. T For “well-behaved” graphs this does not depend on the start distribution!! 15

What is a stationary distribution? Intuitively and Mathematically 16

What is a stationary distribution? Intuitively and Mathematically 16

What is a stationary distribution? Intuitively and Mathematically n The stationary distribution at a

What is a stationary distribution? Intuitively and Mathematically n The stationary distribution at a node is related to the amount of time a random walker spends visiting that node. 17

What is a stationary distribution? Intuitively and Mathematically n n The stationary distribution at

What is a stationary distribution? Intuitively and Mathematically n n The stationary distribution at a node is related to the amount of time a random walker spends visiting that node. Remember that we can write the probability distribution at a node as q xt+1 = xt. P 18

What is a stationary distribution? Intuitively and Mathematically n n n The stationary distribution

What is a stationary distribution? Intuitively and Mathematically n n n The stationary distribution at a node is related to the amount of time a random walker spends visiting that node. Remember that we can write the probability distribution at a node as q xt+1 = xt. P For the stationary distribution v 0 we have q v 0 = v 0 P 19

What is a stationary distribution? Intuitively and Mathematically n n The stationary distribution at

What is a stationary distribution? Intuitively and Mathematically n n The stationary distribution at a node is related to the amount of time a random walker spends visiting that node. Remember that we can write the probability distribution at a node as q xt+1 = xt. P For the stationary distribution v 0 we have q v 0 = v 0 P Whoa! that’s just the left eigenvector of the transition matrix ! 20

Talk Outline n Basic definitions q q n Random walks Stationary distributions Properties q

Talk Outline n Basic definitions q q n Random walks Stationary distributions Properties q q Perron frobenius theorem Electrical networks, hitting and commute times n n Euclidean Embedding Applications q Pagerank n n q q Power iteration Convergencce Personalized pagerank Rank stability 21

Interesting questions n Does a stationary distribution always exist? Is it unique? q n

Interesting questions n Does a stationary distribution always exist? Is it unique? q n What is “well-behaved”? q n Yes, if the graph is “well-behaved”. We shall talk about this soon. How fast will the random surfer approach this stationary distribution? q Mixing Time! 22

Well behaved graphs n Irreducible: There is a path from every node to every

Well behaved graphs n Irreducible: There is a path from every node to every other node. Irreducible Not irreducible 23

Well behaved graphs n Aperiodic: The GCD of all cycle lengths is 1. The

Well behaved graphs n Aperiodic: The GCD of all cycle lengths is 1. The GCD is also called period. Periodicity is 3 Aperiodic 24

Implications of the Perron Frobenius Theorem n If a markov chain is irreducible and

Implications of the Perron Frobenius Theorem n If a markov chain is irreducible and aperiodic then the largest eigenvalue of the transition matrix will be equal to 1 and all the other eigenvalues will be strictly less than 1. q q Let the eigenvalues of P be {σi| i=0: n-1} in non-increasing order of σi. σ0 = 1 > σ2 >= ……>= σn 25

Implications of the Perron Frobenius Theorem n If a markov chain is irreducible and

Implications of the Perron Frobenius Theorem n If a markov chain is irreducible and aperiodic then the largest eigenvalue of the transition matrix will be equal to 1 and all the other eigenvalues will be strictly less than 1. q q n Let the eigenvalues of P be {σi| i=0: n-1} in non-increasing order of σi. σ0 = 1 > σ2 >= ……>= σn These results imply that for a well behaved graph there exists an unique stationary distribution. 26

Some fun stuff about undirected graphs n n n A connected undirected graph is

Some fun stuff about undirected graphs n n n A connected undirected graph is irreducible A connected non-bipartite undirected graph has a stationary distribution proportional to the degree distribution! Makes sense, since larger the degree of the node more likely a random walk is to come back to it. 27

Page. Rank Page, Lawrence and Brin, Sergey and Motwani, Rajeev and Winograd, Terry The

Page. Rank Page, Lawrence and Brin, Sergey and Motwani, Rajeev and Winograd, Terry The Page. Rank Citation Ranking: Bringing Order to the Web. Technical Report. Stanford Info. Lab, 1999.

Pagerank (Page & Brin, 1998) n Web graph: if i is connected to j

Pagerank (Page & Brin, 1998) n Web graph: if i is connected to j and 0 otherwise q An webpage is important if other important pages point to it. q Intuitively q v works out to be the stationary distribution of the Markov chain corresponding to the web: v = v P, where for example 1 1 1/2 29 1/2

Pagerank & Perron-frobenius n n Perron Frobenius only holds if the graph is irreducible

Pagerank & Perron-frobenius n n Perron Frobenius only holds if the graph is irreducible and aperiodic. But how can we guarantee that for the web graph? q n Do it with a small restart probability c. At any time-step the random surfer q q jumps (teleport) to any other node with probability c jumps to its direct neighbors with total probability 1 -c. 30

Power iteration n Power Iteration is an algorithm for computing the stationary distribution. q

Power iteration n Power Iteration is an algorithm for computing the stationary distribution. q Start with any distribution x 0 q Keep computing xt+1 = xt. P q Stop when xt+1 and xt are almost the same. 31

Power iteration n n Why should this work? Write x 0 as a linear

Power iteration n n Why should this work? Write x 0 as a linear combination of the left eigenvectors {v 0, v 1, … , vn-1} of P n Remember that v 0 is the stationary distribution. n x 0 = c 0 v 0 + c 1 v 1 + c 2 v 2 + … + cn-1 vn-1 32

Power iteration n n Why should this work? Write x 0 as a linear

Power iteration n n Why should this work? Write x 0 as a linear combination of the left eigenvectors {v 0, v 1, … , vn-1} of P n Remember that v 0 is the stationary distribution. n x 0 = c 0 v 0 + c 1 v 1 + c 2 v 2 + … + cn-1 vn-1 c 0 = 1. WHY? (see next slide) 33

Convergence Issues 1 n n n Lets look at the vectors x for t=1,

Convergence Issues 1 n n n Lets look at the vectors x for t=1, 2, … Write x 0 as a linear combination of the eigenvectors of P x 0 = c 0 v 0 + c 1 v 1 + c 2 v 2 + … + cn-1 vn-1 c 0 = 1. WHY? Remember that 1 is the right eigenvector of P with eigenvalue 1, since P is stochastic. i. e. P*1 T = 1 T. Hence vi 1 T = 0 if i≠ 0. 1 = x*1 T = c 0 v 0*1 T = c 0. Since v 0 and x 0 are both distributions 34

Power iteration v 0 v 1 v 2 ……. vn-1 1 c 2 cn-1

Power iteration v 0 v 1 v 2 ……. vn-1 1 c 2 cn-1 35

Power iteration v 0 v 1 σ0 σ 1 c 1 v 2 …….

Power iteration v 0 v 1 σ0 σ 1 c 1 v 2 ……. vn-1 σ 2 c 2 σn-1 cn-1 36

Power iteration v 0 v 1 v 2 ……. vn-1 σ 02 σ 12

Power iteration v 0 v 1 v 2 ……. vn-1 σ 02 σ 12 c 1 σ 22 c 2 σn-12 cn-1 37

Power iteration v 0 v 1 σ 0 t σ 1 t c 1

Power iteration v 0 v 1 σ 0 t σ 1 t c 1 v 2 ……. vn-1 σ 2 t c 2 σn-1 t cn-1 38

Power iteration σ0 = 1 > σ1 ≥…≥ σn v 0 1 1 v

Power iteration σ0 = 1 > σ1 ≥…≥ σn v 0 1 1 v 1 σ1 t c 1 v 2 ……. vn-1 σ2 t c 2 σn-1 t cn 39

Power iteration σ0 = 1 > σ1 ≥…≥ σn v 0 1 v 1

Power iteration σ0 = 1 > σ1 ≥…≥ σn v 0 1 v 1 0 v 2 ……. vn-1 0 0 40

Convergence Issues n n n Formally ||x 0 Pt – v 0|| ≤ |λ|t

Convergence Issues n n n Formally ||x 0 Pt – v 0|| ≤ |λ|t q λ is the eigenvalue with second largest magnitude The smaller the second largest eigenvalue (in magnitude), the faster the mixing. For λ<1 there exists an unique stationary distribution, namely the first left eigenvector of the transition matrix. 41

Pagerank and convergence n n n The transition matrix pagerank really uses is The

Pagerank and convergence n n n The transition matrix pagerank really uses is The second largest eigenvalue of be ≤ (1 -c) can be proven 1 to Nice! This means pagerank computation will converge fast. 1. The Second Eigenvalue of the Google Matrix, Taher H. Haveliwala and Sepandar D. Kamvar, Stanford University Technical Report, 2003. 42

Pagerank n We are looking for the vector v s. t. n r is

Pagerank n We are looking for the vector v s. t. n r is a distribution over web-pages. n If r is the uniform distribution we get pagerank. n What happens if r is non-uniform? 43

Pagerank n We are looking for the vector v s. t. n r is

Pagerank n We are looking for the vector v s. t. n r is a distribution over web-pages. n If r is the uniform distribution we get pagerank. n What happens if r is non-uniform? Personalization 44

Rank stability n How does the ranking change when the link structure changes? n

Rank stability n How does the ranking change when the link structure changes? n The web-graph is changing continuously. n How does that affect page-rank? 45

Rank stability 1 (On the Machine Learning papers from the CORA 2 database) Rank

Rank stability 1 (On the Machine Learning papers from the CORA 2 database) Rank on the entire database. Rank on 5 perturbed datasets by deleting 30% of the papers 1. Link analysis, eigenvectors, and stability, Andrew Y. Ng, Alice X. Zheng and Michael Jordan, IJCAI-01 2. Automating the contruction of Internet portals with machine learning, A. Mc Callum, K. Nigam, 46 J. Rennie, K. Seymore, In Information Retrieval Journel, 2000

Rank stability n n n Ng et al 2001: Theorem: if v is the

Rank stability n n n Ng et al 2001: Theorem: if v is the left eigenvector of. Let the pages i 1, i 2, …, ik be changed in any way, and let v’ be the new pagerank. Then So if c is not too close to 0, the system would be rank stable and also converge fast! 47

Conclusion n Basic definitions q q n Properties q n Random walks Stationary distributions

Conclusion n Basic definitions q q n Properties q n Random walks Stationary distributions Perron frobenius theorem Applications q Pagerank n n q q Power iteration Convergencce Personalized pagerank Rank stability 48

Thanks! Please send email to Purna at psarkar@cs. cmu. edu with questions, suggestions, corrections

Thanks! Please send email to Purna at psarkar@cs. cmu. edu with questions, suggestions, corrections 49

Acknowledgements n Andrew Moore n Gary Miller q q n Fan Chung Graham’s course

Acknowledgements n Andrew Moore n Gary Miller q q n Fan Chung Graham’s course on q q n n n Check out Gary’s Fall 2007 class on “Spectral Graph Theory, Scientific Computing, and Biomedical Applications” http: //www. cs. cmu. edu/afs/cs/user/glmiller/public/Scientific. Computing/F-07/index. html Random Walks on Directed and Undirected Graphs http: //www. math. ucsd. edu/~phorn/math 261/ Random Walks on Graphs: A Survey, Laszlo Lov'asz Reversible Markov Chains and Random Walks on Graphs, D Aldous, J Fill Random Walks and Electric Networks, Doyle & Snell 50