Outline Introduction Matrix Tree Theorem PageRank and metrics of centrality Spectral Graph Theory and You: Matrix Tree Theorem and Centrality Metrics Jonathan Gootenberg March 11, 2013 1 / 19 Outline Introduction Matrix Tree Theorem PageRank and metrics of centrality Outline of Topics 1 Introduction Motivation Basics of Spectral Graph Theory Understanding the characteristic polynomial 2 Matrix Tree Theorem Preliminary concepts Proof of Matrix Tree Theorem 3 PageRank and metrics of centrality 2 / 19 Outline Introduction Matrix Tree Theorem PageRank and metrics of centrality Motivation Basics of Spectral Graph Theory Understanding the characteristic polynomial Why use spectral graph theory? The eigenvalues of a graph’s adjacency matrix (and others) can reveal important information about the community structure. The number of matrix trees The most central nodes 3 / 19 Outline Introduction Matrix Tree Theorem PageRank and metrics of centrality Motivation Basics of Spectral Graph Theory Understanding the characteristic polynomial Easily calculate all spanning trees 4 / 19 Outline Introduction Matrix Tree Theorem PageRank and metrics of centrality Motivation Basics of Spectral Graph Theory Understanding the characteristic polynomial Find most central nodes in a network 5 / 19 Outline Introduction Matrix Tree Theorem PageRank and metrics of centrality Motivation Basics of Spectral Graph Theory Understanding the characteristic polynomial Some definitions: Baby’s first matrix Definition (Adjacency Matrix A) Given an undirected graph G = (V , E ), the adjacency matrix of G is the n × n matrix A = A(G ) with entries aij such that ( 1, {vi , vj } ∈ E aij = 0, otherwise 6 / 19 Outline Introduction Matrix Tree Theorem PageRank and metrics of centrality Motivation Basics of Spectral Graph Theory Understanding the characteristic polynomial Some definitions: Baby’s first matrix G= 0 1 ⇒ A(G ) = 0 1 1 0 1 1 0 1 0 1 1 1 1 0 7 / 19 Outline Introduction Matrix Tree Theorem PageRank and metrics of centrality Motivation Basics of Spectral Graph Theory Understanding the characteristic polynomial Putting the spec in Spectral Definition (Spectrum of a graph) The spectrum of graph G is the set of eigenvalues of A(G ), along with their multiplicities. If the eigenvalues of A(G ) are λ0 > λ0 > . . . > λs−1 with multiplicites m(λ0 ), . . . , m(λs−1 ) then λ0 λ1 ··· λs−1 Spec G = m(λ0 ) m(λ1 ) · · · m(λs−1 ) 8 / 19 Outline Introduction Matrix Tree Theorem PageRank and metrics of centrality Motivation Basics of Spectral Graph Theory Understanding the characteristic polynomial Putting the spec in Spectral 0 1 A(G ) = 0 1 √ 1 1 + 17 Spec G = 2 1 1 0 1 1 1 2 1 1 1 0 √ 1 − 17 −1 0 1 1 1 0 1 0 1 9 / 19 Outline Introduction Matrix Tree Theorem PageRank and metrics of centrality Motivation Basics of Spectral Graph Theory Understanding the characteristic polynomial Putting the spec in Spectral 0 1 A(G ) = 0 1 √ 1 1 + 17 Spec G = 2 1 1 0 1 1 1 2 1 1 1 0 √ 1 − 17 −1 0 1 1 1 0 1 0 1 9 / 19 Outline Introduction Matrix Tree Theorem PageRank and metrics of centrality Motivation Basics of Spectral Graph Theory Understanding the characteristic polynomial What does the spectrum of a graph tell us? Definition (Characteristic Polynomial) The characteristic polynomial of G , χ(G , λ) is χ(G , λ) = det(λI − A) =λn + c1 λn−1 + c2 λn−2 + . . . + cn c1 = X λi i = Tr(A) =0 10 / 19 Outline Introduction Matrix Tree Theorem PageRank and metrics of centrality Motivation Basics of Spectral Graph Theory Understanding the characteristic polynomial What does the spectrum of a graph tell us? Definition (Characteristic Polynomial) The characteristic polynomial of G , χ(G , λ) is χ(G , λ) = det(λI − A) =λn + c1 λn−1 + c2 λn−2 + . . . + cn c1 = X λi i = Tr(A) =0 10 / 19 Outline Introduction Matrix Tree Theorem PageRank and metrics of centrality Motivation Basics of Spectral Graph Theory Understanding the characteristic polynomial What does the spectrum of a graph tell us? Definition (Characteristic Polynomial) The characteristic polynomial of G , χ(G , λ) is χ(G , λ) = det(λI − A) =λn + c1 λn−1 + c2 λn−2 + . . . + cn c1 = X λi i = Tr(A) =0 10 / 19 Outline Introduction Matrix Tree Theorem PageRank and metrics of centrality Motivation Basics of Spectral Graph Theory Understanding the characteristic polynomial What does the spectrum of a graph tell us? Definition (Characteristic Polynomial) The characteristic polynomial of G , χ(G , λ) is χ(G , λ) = det(λI − A) =λn + c1 λn−1 + c2 λn−2 + . . . + cn c1 = X λi i = Tr(A) =0 10 / 19 Outline Introduction Matrix Tree Theorem PageRank and metrics of centrality Motivation Basics of Spectral Graph Theory Understanding the characteristic polynomial What does the spectrum of a graph tell us? Characteristic Polynomial χ(G , λ) = λn + c1 λn−1 + c2 λn−2 + . . . + cn You can express ci in terms of the principal minors of A Principal Minor The principal minor det(A)J,J , J ⊂ {1, . . . , n} is the determiniant of the subset of A the same subset J of columns and rows 11 / 19 Outline Introduction Matrix Tree Theorem PageRank and metrics of centrality Motivation Basics of Spectral Graph Theory Understanding the characteristic polynomial What does the spectrum of a graph tell us? Characteristic Polynomial χ(G , λ) = λn + c1 λn−1 + c2 λn−2 + . . . + cn You can express ci in terms of the principal minors of A ci (−1)i is the P sum of the principal minors of size i × i ci (−1)i = |J|=i det(A)J,J 11 / 19 Outline Introduction Matrix Tree Theorem PageRank and metrics of centrality Motivation Basics of Spectral Graph Theory Understanding the characteristic polynomial What does the spectrum of a graph tell us? Consider c2 All non-zero principal minors are of the form 0 1 1 0 Therefore, −c2 = |E | 11 / 19 Outline Introduction Matrix Tree Theorem PageRank and metrics of centrality Motivation Basics of Spectral Graph Theory Understanding the characteristic polynomial What does the spectrum of a graph tell us? Consider c3 The non-trivial principal 0 1 1 0 0 0 matrices of size 3 0 0 1 1 0 0 , 1 0 0 , 1 0 1 0 0 1 are 1 1 0 1 1 0 11 / 19 Outline Introduction Matrix Tree Theorem PageRank and metrics of centrality Motivation Basics of Spectral Graph Theory Understanding the characteristic polynomial What does the spectrum of a graph tell us? Consider c3 0 1 0 0 1 1 0 1 1 1 0 0 = 0, 1 0 0 = 0, 1 0 1 = 2 0 0 0 1 0 0 1 1 0 Therefore, −c3 is twice the number of triangles in G 11 / 19 Outline Introduction Matrix Tree Theorem PageRank and metrics of centrality Preliminary concepts Proof of Matrix Tree Theorem The incidence matrix Definition (Incidence Matrix S) Given an undirected graph G = (V , E ) with V = {1, . . . , n}, E = {e1 , . . . , em } the incidence matrix of G is the n × m matrix S = S(G ) with entries Sij such that ej ends at i 1, Sij = −1, ej starts at i 0, otherwise 12 / 19 Outline Introduction Matrix Tree Theorem PageRank and metrics of centrality Preliminary concepts Proof of Matrix Tree Theorem The incidence matrix G= 1 0 0 1 0 −1 −1 0 0 1 ⇒ S(G ) = 0 1 −1 0 0 0 0 1 −1 −1 13 / 19 Outline Introduction Matrix Tree Theorem PageRank and metrics of centrality Preliminary concepts Proof of Matrix Tree Theorem The incidence matrix implies connectivity of the graph Theorem rank(S) = n - |number of connected components of G | 14 / 19 Outline Introduction Matrix Tree Theorem PageRank and metrics of centrality Preliminary concepts Proof of Matrix Tree Theorem The incidence matrix implies connectivity of the graph Theorem rank(S) = n - |number of connected components of G | Reorder the graph such that S1 S2 S = .. . 0 ··· ··· .. . 0 .. . Sc where c is the number of connected components of G We wish to show the rank of each component is ni − 1 14 / 19 Outline Introduction Matrix Tree Theorem PageRank and metrics of centrality Preliminary concepts Proof of Matrix Tree Theorem The incidence matrix implies connectivity of the graph Theorem rank(S) = n - |number of connected components of G | For a given connected component Si , suppose we have a summation over the rows sj ni X αj sj = 0 j=1 1 0 0 1 0 −1 −1 0 0 1 0 1 −1 0 0 0 0 1 −1 −1 15 / 19 Outline Introduction Matrix Tree Theorem PageRank and metrics of centrality Preliminary concepts Proof of Matrix Tree Theorem The incidence matrix implies connectivity of the graph Theorem rank(S) = n - |number of connected components of G | Consider a row sk , αk 6= 0 1 0 0 1 0 −1 −1 0 0 1 0 1 −1 0 0 0 0 1 −1 −1 15 / 19 Outline Introduction Matrix Tree Theorem PageRank and metrics of centrality Preliminary concepts Proof of Matrix Tree Theorem The incidence matrix implies connectivity of the graph Theorem rank(S) = n - |number of connected components of G | Each non-zero column in sk has sl =⇒ αk = αl 1 0 −1 −1 0 1 0 0 a corresponding row 0 1 0 0 −1 0 1 −1 0 1 0 -1 15 / 19 Outline Introduction Matrix Tree Theorem PageRank and metrics of centrality Preliminary concepts Proof of Matrix Tree Theorem The incidence matrix implies connectivity of the graph Theorem rank(S) = n - |number of connected components of G | Since the graph is connected, all αj = 1, and ni X sj = 0 j=1 Therefore, the rank of Si is ni − 1 Remark-S̃ Since Si has rank ni − 1, we can remove an arbitrary row to create S̃i without loss of information 15 / 19 Outline Introduction Matrix Tree Theorem PageRank and metrics of centrality Preliminary concepts Proof of Matrix Tree Theorem The incidence matrix implies connectivity of the graph Theorem rank(S) = n - |number of connected components of G | Remark-S̃ Since Si has rank ni − 1, we can remove an arbitrary row to create S̃i without loss of information 15 / 19 Outline Introduction Matrix Tree Theorem PageRank and metrics of centrality Preliminary concepts Proof of Matrix Tree Theorem Matrix Tree Theorem In the following proof, we will try all selections of n − 1 edges and use the determinant to see if the resulting subgraph is connected. We use create the matrix that is the combination of the columns of the incidence matrix S̃: Q = S̃ S̃ T 0 −1 1 1 0 0 1 0 0 −1 1 2 −1 0 −1 −1 0 0 1 0 0 −1 = −1 3 −1 0 1 −1 0 0 1 0 0 0 −1 2 0 1 0 16 / 19 Outline Introduction Matrix Tree Theorem PageRank and metrics of centrality Preliminary concepts Proof of Matrix Tree Theorem Matrix Tree Theorem In the following proof, we will try all selections of n − 1 edges and use the determinant to see if the resulting subgraph is connected. We use create the matrix that is the combination of the columns of the incidence matrix S̃: Q = S̃ S̃ T 0 −1 1 1 0 0 1 0 0 −1 1 2 −1 0 −1 −1 0 0 1 0 0 −1 = −1 3 −1 0 1 −1 0 0 1 0 0 0 −1 2 0 1 0 16 / 19 Outline Introduction Matrix Tree Theorem PageRank and metrics of centrality Preliminary concepts Proof of Matrix Tree Theorem Matrix Tree Theorem In the following proof, we will try all selections of n − 1 edges and use the determinant to see if the resulting subgraph is connected. We use create the matrix that is the combination of the columns of the incidence matrix S̃: Q = S̃ S̃ T 0 −1 1 1 0 0 1 0 0 −1 1 2 −1 0 −1 −1 0 0 1 0 0 −1 = −1 3 −1 0 1 −1 0 0 1 0 0 0 −1 2 0 1 0 16 / 19 Outline Introduction Matrix Tree Theorem PageRank and metrics of centrality Preliminary concepts Proof of Matrix Tree Theorem Matrix Tree Theorem Theorem The number of spanning trees of a graph G is equal to det(Q), where Q = S̃ S̃ T Graph Laplacian Q Q is referred to as the graph laplacian, and can also be expressed as Q =D −A where D is the degree matrix 17 / 19 Outline Introduction Matrix Tree Theorem PageRank and metrics of centrality Preliminary concepts Proof of Matrix Tree Theorem Matrix Tree Theorem Theorem The number of spanning trees of a graph G is equal to det(Q), where Q = S̃ S̃ T Lemma If T = (V , E ) is an directed tree rooted at n, we can order E such that ei ends at i. 17 / 19 Outline Introduction Matrix Tree Theorem PageRank and metrics of centrality Preliminary concepts Proof of Matrix Tree Theorem Matrix Tree Theorem Theorem The number of spanning trees of a graph G is equal to det(Q), where Q = S̃ S̃ T Lemma If T = (V , E ) is an directed tree rooted at n, we can order E such that ei ends at i. Proof. Label edges such that ei := (p(i), i), where p(i) is the parent of i 17 / 19 Outline Introduction Matrix Tree Theorem PageRank and metrics of centrality Preliminary concepts Proof of Matrix Tree Theorem Matrix Tree Theorem Theorem The number of spanning trees of a graph G is equal to det(Q), where Q = S̃ S̃ T Lemma If G = (V , E ), |E | = n − 1 is a directed graph that is not a tree, det(S̃) = 0 17 / 19 Outline Introduction Matrix Tree Theorem PageRank and metrics of centrality Preliminary concepts Proof of Matrix Tree Theorem Matrix Tree Theorem Theorem The number of spanning trees of a graph G is equal to det(Q), where Q = S̃ S̃ T Lemma If G = (V , E ), |E | = n − 1 is a directed graph that is not a tree, det(S̃) = 0 Proof. If |E | = n − 1 and G is not a tree, then it is not connected, and rank(S̃) = rank(S) ≤ n − 2 17 / 19 Outline Introduction Matrix Tree Theorem PageRank and metrics of centrality Preliminary concepts Proof of Matrix Tree Theorem Matrix Tree Theorem Theorem The number of spanning trees of a graph G is equal to det(Q), where Q = S̃ S̃ T Lemma If T = (V , E ), |E | = n − 1 is a tree with ei ∈ E ending at i ∈ V , det(S̃) = 1 17 / 19 Outline Introduction Matrix Tree Theorem PageRank and metrics of centrality Preliminary concepts Proof of Matrix Tree Theorem Matrix Tree Theorem Lemma If T = (V , E ), |E | = n − 1 is a tree with ei ∈ E ending at i ∈ V , det(S̃) = 1 Proof. By the results of the previous lemmas, we can order the vertices such that p(i) > i. Then 1 ∗ ··· ∗ . 0 1 . . . .. S̃ = . . .. . . . . . ∗ 0 ··· 0 1 which is upper diagonal. 17 / 19 Outline Introduction Matrix Tree Theorem PageRank and metrics of centrality Preliminary concepts Proof of Matrix Tree Theorem Matrix Tree Theorem Proof. We will use the linearity of the determinant to break down det(Q) into a sum of determinants of subgraphs: X det(Q) = det(S̃j ) where all Sj are subgraphs with n − 1 edges (Tr(Sj ) = n − 1). 17 / 19 Outline Introduction Matrix Tree Theorem PageRank and metrics of centrality Formulation of PageRank PageRank (PR) is a centrality metric which approximates a web surfer. Jumps with probability q: q n. Like typing a URL P f (j) Surfs with probability 1 − q: j:j→i kout (j) . Like clicking a link PageRank reccurance f (i) = X f (j) q + (1 − q) n kout (j) j:j→i 18 / 19 Outline Introduction Matrix Tree Theorem PageRank and metrics of centrality Formulation of PageRank PageRank (PR) is a centrality metric which approximates a web surfer. Jumps with probability q: q n. Like typing a URL P f (j) Surfs with probability 1 − q: j:j→i kout (j) . Like clicking a link PageRank reccurance f (i) = X f (j) q + (1 − q) n kout (j) j:j→i 18 / 19 Outline Introduction Matrix Tree Theorem PageRank and metrics of centrality Formulation of PageRank PageRank (PR) is a centrality metric which approximates a web surfer. Jumps with probability q: q n. Like typing a URL P f (j) Surfs with probability 1 − q: j:j→i kout (j) . Like clicking a link PageRank reccurance f (i) = X f (j) q + (1 − q) n kout (j) j:j→i 18 / 19 Outline Introduction Matrix Tree Theorem PageRank and metrics of centrality Formulation of PageRank PageRank (PR) is a centrality metric which approximates a web surfer. Jumps with probability q: q n. Like typing a URL P f (j) Surfs with probability 1 − q: j:j→i kout (j) . Like clicking a link PageRank reccurance f (i) = X f (j) q + (1 − q) n kout (j) j:j→i 18 / 19 Outline Introduction Matrix Tree Theorem PageRank and metrics of centrality Solving the PageRank reccurance PageRank reccurance f (i) = X f (j) q + (1 − q) n kout (j) j:j→i Definition (Transition Matrix P) Given an undirected graph G = (V , E ), the transition matrix of G is the n × n matrix P = P(G ) with entries pij such that ( P 1 , {vi , vj } ∈ E k aik pij = 0, otherwise 19 / 19 Outline Introduction Matrix Tree Theorem PageRank and metrics of centrality Solving the PageRank reccurance PageRank reccurance f (i) = X f (j) q + (1 − q) n kout (j) j:j→i X j:j→i f (j) = fP kout (j) 19 / 19 Outline Introduction Matrix Tree Theorem PageRank and metrics of centrality Solving the PageRank reccurance PageRank reccurance f (i) = X f (j) q + (1 − q) n kout (j) j:j→i X j:j→i We can use the property P i f (j) = fP kout (j) f (i) = 1 = f 1T 19 / 19 Outline Introduction Matrix Tree Theorem PageRank and metrics of centrality Solving the PageRank reccurance PageRank reccurance f (i) = X f (j) q + (1 − q) n kout (j) j:j→i X j:j→i f (j) = fP kout (j) f (i) = 1 = f 1T q q f = f 1T 1 + (1 − q)fP = f J + (1 − q)P n n We can use the property P i 19 / 19 Outline Introduction Matrix Tree Theorem PageRank and metrics of centrality Solving the PageRank reccurance PageRank reccurance f (i) = X f (j) q + (1 − q) n kout (j) j:j→i X j:j→i f (j) = fP kout (j) f (i) = 1 = f 1T q q f = f 1T 1 + (1 − q)fP = f J + (1 − q)P n n We can use the property P i We can compute PageRank with the eigenvector! 19 / 19