






Estude fácil! Tem muito documento disponível na Docsity
Ganhe pontos ajudando outros esrudantes ou compre um plano Premium
Esta página não é visível na pré-visualização
Não perca as partes importantes!







KURT BRYAN†^ AND TANYA LEISE‡
Abstract. Google’s success derives in large part from its PageRank algorithm, which ranks the importance of webpages according to an eigenvector of a weighted link matrix. Analysis of the PageRank formula provides a wonderful applied topic for a linear algebra course. Instructors may assign this article as a project to more advanced students, or spend one or two lectures presenting the material with assigned homework from the exercises. This material also complements the discussion of Markov chains in matrix algebra. Maple and Mathematica files supporting this material can be found at www.rose-hulman.edu/∼bryan.
Key words. linear algebra, PageRank, eigenvector, stochastic matrix
AMS subject classifications. 15-01, 15A18, 15A
∗THE APPROXIMATE MARKET VALUE OF GOOGLE WHEN THE COMPANY WENT PUBLIC IN 2004. †Department of Mathematics, Rose-Hulman Institute of Technology, Terre Haute, IN 47803; email: [email protected]; phone: 812) 877-8485; fax: (812)877-8883. ‡Mathematics and Computer Science Department, Amherst College, Amherst, MA 01002; email: [email protected]; phone: (413)542-5411; fax: (413)542-2550.
1
Fig. 2.1. An example of a web with only four pages. An arrow from page A to page B indicates a link from page A to page B.
2.1. The basic idea. In what follows we will use the phrase “importance score” or just “score” for any quantitative rating of a web page’s importance. The importance score for any web page will always be a non-negative real number. A core idea in assigning a score to any given web page is that the page’s score is derived from the links made to that page from other web pages. The links to a given page are called the backlinks for that page. The web thus becomes a democracy where pages vote for the importance of other pages by linking to them. Suppose the web of interest contains n pages, each page indexed by an integer k, 1 ≤ k ≤ n. A typical example is illustrated in Figure 2.1, in which an arrow from page A to page B indicates a link from page A to page B. Such a web is an example of a directed graph.^1 We’ll use xk to denote the importance score of page k in the web. The xk is non-negative and xj > xk indicates that page j is more important than page k (so xj = 0 indicates page j has the least possible importance score). A very simple approach is to take xk as the number of backlinks for page k. In the example in Figure 2.1, we have x 1 = 2, x 2 = 1, x 3 = 3, and x 4 = 2, so that page 3 would be the most important, pages 1 and 4 tie for second, and page 2 is least important. A link to page k becomes a vote for page k’s importance. This approach ignores an important feature one would expect a ranking algorithm to have, namely, that a link to page k from an important page should boost page k’s importance score more than a link from an unimportant page. For example, a link to your homepage directly from Yahoo ought to boost your page’s score much more than a link from, say, www.kurtbryan.com (no relation to the author). In the web of Figure 2.1, pages 1 and 4 both have two backlinks: each links to the other, but page 1’s second backlink is from the seemingly important page 3, while page 4’s second backlink is from the relatively unimportant page 1. As such, perhaps we should rate page 1’s importance higher than that of page 4. As a first attempt at incorporating this idea let’s compute the score of page j as the sum of the scores of all pages linking to page j. For example, consider the web of Figure 2.1. The score of page 1 would be determined by the relation x 1 = x 3 + x 4. Since x 3 and x 4 will depend on x 1 this scheme seems strangely self-referential, but it is the approach we will use, with one more modification. Just as in elections, we don’t want a single individual to gain influence merely by casting multiple votes. In the same vein, we seek a scheme in which a web page doesn’t gain extra influence simply by linking to lots of other pages. If page j contains nj links, one of which links to page k, then we will boost page k’s score by xj /nj , rather than by xj. In this scheme each web page gets a total of one vote, weighted by that web page’s score, that is evenly divided up among all of its outgoing links. To quantify this for a web of n pages, let Lk ⊂ { 1 , 2 ,... , n} denote the set of pages with a link to page k, that is, Lk is the set of page k’s backlinks. For each k we require
xk =
j∈Lk
xj nj
where nj is the number of outgoing links from page j (which must be positive since if j ∈ Lk then
(^1) A graph consists of a set of vertices (in this context, the web pages) and a set of edges. Each edge joins a pair of vertices. The graph is undirected if the edges have no direction. The graph is directed if each edge (in the web context, the links) has a direction, that is, a starting and ending vertex.
a strongly connected web (that is, you can get from any page to any other page in a finite number of steps); see Exercise 10 below.
Unfortunately, it is not always true that the link matrix A will yield a unique ranking for all webs. Consider the web in Figure 2.2, for which the link matrix is
We find here that V 1 (A) is two-dimensional; one possible pair of basis vectors is x = [1/ 2 , 1 / 2 , 0 , 0 , 0]T and y = [0, 0 , 1 / 2 , 1 / 2 , 0]T^. But note that any linear combination of these two vectors yields another vector in V 1 (A), e.g., 34 x + 14 y = [3/ 8 , 3 / 8 , 1 / 8 , 1 / 8 , 0]T^. It is not clear which, if any, of these eigenvectors we should use for the rankings!
It is no coincidence that for the web of Figure 2.2 we find that dim(V 1 (A)) > 1. It is a consequence of the fact that if a web W , considered as an undirected graph (ignoring which direction each arrows points), consists of r disconnected subwebs W 1 ,... , Wr , then dim(V 1 (A)) ≥ r, and hence there is no unique importance score vector x ∈ V 1 (A) with
i xi^ = 1. This makes intuitive sense: if a web W consists of r disconnected subwebs W 1 ,... , Wr then one would expect difficulty in finding a common reference frame for comparing the scores of pages in one subweb with those in another subweb.
Indeed, it is not hard to see why a web W consisting of r disconnected subwebs forces dim(V 1 (A)) ≥ r. Suppose a web W has n pages and r component subwebs W 1 ,... , Wr. Let ni denote the number of pages in Wi. Index the pages in W 1 with indices 1 through n 1 , the pages in W 2 with indices n 1 + 1 through n 1 + n 2 , the pages in W 3 with n 1 + n 2 + 1 through n 1 + n 2 + n 3 , etc. In general, let Ni =
∑i j=1 nj^ for^ i^ ≥^ 1, with^ N^0 = 0, so^ Wi^ contains pages^ Ni−^1 + 1 through^ Ni. For example, in the web of Figure 2 we can take N 1 = 2 and N 2 = 5, so W 1 contains pages 1 and 2, W 2 contains pages 3, 4 , and 5. The web in Figure 2.2 is a particular example of the general case, in which the matrix A assumes a block diagonal structure
0 0 0 Ar
where Ai denotes the link matrix for Wi. In fact, Wi can be considered as a web in its own right. Each ni × ni matrix Ai is column-stochastic, and hence possesses some eigenvector vi^ ∈ lRni^ with eigenvector 1. For each i between 1 and r construct a vector wi^ ∈ lRn^ which has 0 components for all elements corresponding to blocks other than block i. For example,
w^1 =
v^1 0 0 .. . 0
, w^2 =
v^2 0 .. . 0
Then it is easy to see that the vectors wi, 1 ≤ i ≤ r, are linearly independent eigenvectors for A
with eigenvalue 1 because
Awi^ = A
vi 0 .. . 0
= wi.
Thus V 1 (A) has dimension at least r.
2.2.2. Dangling Nodes. Another difficulty may arise when using the matrix A to generate rankings. A web with dangling nodes produces a matrix A which contains one or more columns of all zeros. In this case A is column-substochastic, that is, the column sums of A are all less than or equal to one. Such a matrix must have all eigenvalues less than or equal to 1 in magnitude, but 1 need not actually be an eigenvalue for A. Nevertheless, the pages in a web with dangling nodes can still be ranked use a similar technique. The corresponding substochastic matrix must have a positive eigenvalue λ ≤ 1 and a corresponding eigenvector x with non-negative entries (called the Perron eigenvector) that can be used to rank the web pages. See Exercise 4 below. We will not further consider the problem of dangling nodes here, however. Exercise 1. Suppose the people who own page 3 in the web of Figure 1 are infuriated by the fact that its importance score, computed using formula (2.1), is lower than the score of page 1. In an attempt to boost page 3’s score, they create a page 5 that links to page 3; page 3 also links to page
3.2. Analysis of the matrix M. Note that Proposition 1 shows that V 1 (M) is nonempty since M is stochastic. The goal of this section is to show that V 1 (M) is in fact one-dimensional. This is a consequence of the following two propositions. Proposition 2. If M is positive and column-stochastic, then any eigenvector in V 1 (M) has all positive or all negative components. Proof. We use proof by contradiction. First note that in the standard triangle inequality |
i yi| ≤^
i |yi|^ (with all^ yi^ real) the inequality is strict when the^ yi are of mixed sign. Suppose x ∈ V 1 (M) contains elements of mixed sign. From x = Mx we have xi =
∑n j=1 Mij^ xj^ and the summands^ Mij^ xj^ are of mixed sign (since^ Mij^ >^ 0). As a result we have a strict inequality
|xi| =
∑^ n
j=
Mij xj
∑^ n
j=
Mij |xj |. (3.4)
Sum both sides of inequality (3.4) from i = 1 to i = n, and swap the i and j summations. Then use the fact that M is column-stochastic (
i Mij^ = 1 for all^ j) to find
∑^ n
i=
|xi| <
∑^ n
i=
∑^ n
j=
Mij |xj | =
∑^ n
j=
( (^) n ∑
i=
Mij
|xj | =
∑^ n
j=
|xj |,
a contradiction. Hence x cannot contain both positive and negative elements. If xi ≥ 0 for all i (and not all xi are zero) then xi > 0 follows immediately from xi =
∑n j=1 Mij^ xj^ and^ Mij^ >^ 0. Similarly xi ≤ 0 for all i implies that each xi < 0. The following proposition will also be useful for analyzing dim(V 1 (M)): Proposition 3. Let v and w be linearly independent vectors in lRm, m ≥ 2. Then, for some values of s and t that are not both zero, the vector x = sv + tw has both positive and negative components. Proof. Linear independence implies neither v nor w is zero. Let d =
i vi. If^ d^ = 0 then v must contain components of mixed sign, and taking s = 1 and t = 0 yields the conclusion.
If d 6 = 0 set s = −
P i wi ∑^ d^ ,^ t^ = 1, and^ x^ =^ sv^ +^ tw. Since^ v^ and^ w^ are independent^ x^6 =^0. However, i xi^ = 0. We conclude that^ x^ has both positive and negative components.^ We can now prove that using M in place of A yields an unambiguous ranking for any web with no dangling nodes. Lemma 3.2. If M is positive and column-stochastic then V 1 (M) has dimension 1. Proof. We again use proof by contradiction. Suppose there are two linearly independent eigenvectors v and w in the subspace V 1 (M). For any real numbers s and t that are not both zero, the nonzero vector x = sv + tw must be in V 1 (M), and so have components that are all negative or all positive. But by Proposition 3, for some choice of s and t the vector x must contain components of mixed sign, a contradiction. We conclude that V 1 (M) cannot contain two linearly independent vectors, and so has dimension one. Lemma 3.2 provides the “punchline” for our analysis of the ranking algorithm using the matrix M (for 0 < m < 1). The space V 1 (M) is one-dimensional, and moreover, the relevant eigenvectors have entirely positive or negative components. We are thus guaranteed the existence of a unique eigenvector x ∈ V 1 (M) with positive components such that
i xi^ = 1. Exercise 7. Prove that if A is an n × n column-stochastic matrix and 0 ≤ m ≤ 1 , then M = (1 − m)A + mS is also a column-stochastic matrix. Exercise 8. Show that the product of two column-stochastic matrices is also column-stochastic. Exercise 9. Show that a page with no backlinks is given importance score mn by formula (3.2). Exercise 10. Suppose that A is the link matrix for a strongly connected web of n pages (any page can be reached from any other page by following a finite number of links). Show that dim(V 1 (A)) = 1 as follows. Let (Ak)ij denote the (i, j)-entry of Ak.
k AikAkj^ ; all^ Aij^ are non-negative, so (A^2 )ij > 0 implies that for some k both Aik and Akj are positive.
the corresponding eigenspace be one-dimensional, a condition that is satisfied in the case when M is defined by equation (3.1). To use the power method on the matrices M that arise from the web ranking problem we would generally need to know that any other eigenvalues λ of M satisfy |λ| < 1. This assures that the power method will converge to the eigenvector we want. Actually, the following proposition provides what we need, with no reference to any other eigenvalues of M! Definition 4.1. The 1 -norm of a vector v is ‖v‖ 1 =
i |vi|. Proposition 4. Let M be a positive column-stochastic n × n matrix and let V denote the subspace of lRn^ consisting of vectors v such that
j vj^ = 0. Then^ Mv^ ∈^ V^ for any^ v^ ∈^ V^ , and ‖Mv‖ 1 ≤ c‖v‖ 1
for any v ∈ V , where c = max 1 ≤j≤n | 1 − 2 min 1 ≤i≤n Mij | < 1. Proof. To see that Mv ∈ V is straightforward: Let w = Mv, so that wi =
∑n j=1 Mij^ vj^ and ∑^ n
i=
wi =
∑^ n
i=
∑^ n
j=
Mij vj =
∑^ n
j=
vj
( (^) n ∑
i=
Mij
∑^ n
j=
vj = 0.
Hence w = Mv ∈ V. To prove the bound in the proposition note that
‖w‖ 1 =
∑^ n
i=
eiwi =
∑^ n
i=
ei
∑^ n
j=
Mij vj
(^2) See [15] for a general introduction to the power method and the use of spectral decomposition to find the rate of convergence of the vectors xk = Mk^ x 0.
is the second largest eigenvalue of M. Moreover, for M of the form M = (1 − m)A + mS with A column-stochastic and all Sij = 1/n it can be shown that |λ 2 | ≤ 1 − m (see, e.g., [1], Theorem 5.10). As a result, the power method will converge much more rapidly than indicated by ck‖x 0 − q‖ 1. Nonetheless, the value of c in Proposition 4 provides a very simple bound on the convergence of the power method here. It is easy to see that since all entries of M are at least m/n, we will always have c ≤ 1 − 2 m/n in Proposition 4. As a practical matter, note that the n × n positive matrix M has no non-zero elements, so the multiplication Mv for v ∈ lRn^ will typically take O(n^2 ) multiplications and additions, a formidable computation if n = 8, 000 , 000 , 000. But equation (3.2) shows that if x is positive with ‖x‖ 1 = 1 then the multiplication Mx is equivalent to (1 − m)Ax + ms. This is a far more efficient computation, since A can be expected to contain mostly zeros (most web pages link to only a few other pages). We’ve now proved our main theorem: Theorem 4.2. The matrix M defined by (3.1) for a web with no dangling nodes will always be a positive column-stochastic matrix and so have a unique q with positive components such that Mq = q and
i qi^ = 1. The vector^ q^ may be computed as the limit of iterations^ xk^ = (1^ −^ m)Axk−^1 +^ ms, where x 0 is any initial vector with positive components and ‖x 0 ‖ 1 = 1. The eigenvector x defined by equation (3.2) also has a probabilistic interpretation. Consider a web-surfer on a web of n pages with no dangling nodes. The surfer begins at some web page (it doesn’t matter where) and randomly moves from web page to web page according to the following procedure: If the surfer is currently at a page with r outgoing links, he either randomly chooses any one of these links with uniform probability 1 −rm OR he jumps to any randomly selected page on the web, each with probability mn (note that r 1 −rm + n mn = 1, so this accounts for everything he can do). The surfer repeats this page-hopping procedure ad infinitum. The component xj of the normalized vector x in equation (3.2) is the fraction of time that the surfer spends, in the long run, on page j of the web. More important pages tend to be linked to by many other pages and so the surfer hits those most often. Exercise 14. For the web in Exercise 11, compute the values of ‖Mkx 0 −q‖ 1 and ‖M
k (^) x 0 −q‖ 1 ‖Mk−^1 x 0 −q‖ 1 for k = 1, 5 , 10 , 50 , using an initial guess x 0 not too close to the actual eigenvector q (so that you can watch the convergence). Determine c = max 1 ≤j≤n | 1 − 2 min 1 ≤i≤n Mij | and the absolute value of the second largest eigenvalue of M.
Exercise 15. To see why the second largest eigenvalue plays a role in bounding ‖M
k (^) x 0 −q‖ 1 ‖Mk−^1 x 0 −q‖ 1 , consider an n × n positive column-stochastic matrix M that is diagonalizable. Let x 0 be any vector with non-negative components that sum to one. Since M is diagonalizable, we can create a basis of eigenvectors ∑ {q, v 1 ,... , vn− 1 }, where q is the steady state vector, and then write x 0 = aq + n− 1 k=1 bkvk.^ Determine^ M
kx 0 , and then show that a = 1 and the sum of the components of each
vk must equal 0. Next apply Proposition 4 to prove that, except for the non-repeated eigenvalue λ = 1, the other eigenvalues are all strictly less than one in absolute value. Use this to evaluate
limk→∞ ‖M
k (^) x 0 −q‖ 1 ‖Mk−^1 x 0 −q‖ 1. Exercise 16. Consider the link matrix
Show that M = (1 − m)A + mS (all Sij = 1/ 3 ) is not diagonalizable for 0 ≤ m < 1. Exercise 17. How should the value of m be chosen? How does this choice affect the rankings and the computation time?
REFERENCES
[1] A. Berman and R. Plemmons, Nonnegative Matrices in the Mathematical Sciences, Academic Press, New York, 1979. [2] M. W. Berry and M. Browne, Understanding Search Engines: Mathematical Modeling and Text Retrieval, Second Edition, SIAM, Philadelphia, 2005. [3] M. Bianchini, M. Gori, and F. Scarselli, Inside PageRank, ACM Trans. Internet Tech., 5 (2005), pp. 92–128.
[4] S. Brin and L. Page, The anatomy of a large-scale hypertextual web search engine, http : //www − db.stanford.edu/ ∼ backrub/google.html (accessed August 1, 2005). [5] A. Farahat, T. Lofaro, J. C. Miller, G. Rae, and L.A. Ward, Authority Rankings from HITS, PageRank, and SALSA: Existence, Uniqueness, and Effect of Initialization, SIAM J. Sci. Comput., 27 (2006), pp. 1181-1201. [6] A. Hill, Google Inside Out, Maximum PC, April 2004, pp. 44-48. [7] S. Kamvar, T. Haveliwala, and G. Golub, Adaptive methods for the computation of PageRank, Linear Algebra Appl., 386 (2004), pp. 51–65. [8] A. N. Langville and C. D. Meyer, A survey of eigenvector methods of web information retrieval, SIAM Review, 47 (2005), pp. 135-161. [9] A. N. Langville and C. D. Meyer, Deeper inside PageRank, Internet Math., 1 (2005), pp. 335–380. [10] C. D. Meyer, Matrix Analysis and Applied Linear Algebra, SIAM, Philadelphia, 2000. [11] Cleve Moler, The world’s largest matrix computation, http : //www.mathworks.com/company/newsletters/news notes /clevescorner/oct02 cleve.html (accessed August 1, 2005). [12] Mostafa, J., Seeking better web searches, Sci. Amer., 292 (2005), pp. 66-73. [13] Sara Robinson, The Ongoing search for efficient web search algorithms, SIAM News, 37 (Nov 2004). [14] Ian Rogers, The Google Pagerank algorithm and how it works, http : //www.iprcom.com/papers/pagerank/ (accessed August 1, 2005). [15] W. J. Stewart, An Introduction to the Numerical Solution of Markov Chains, Princeton University Press, Princeton, 1994.