{"id":232,"date":"2026-11-13T12:35:22","date_gmt":"2026-11-13T04:35:22","guid":{"rendered":"https:\/\/hoho.live\/luda\/index.php\/2026\/11\/13\/how-pagerank-iterates-a-damped-link-matrix\/"},"modified":"2026-11-13T21:53:19","modified_gmt":"2026-11-13T13:53:19","slug":"how-pagerank-iterates-a-damped-link-matrix","status":"publish","type":"post","link":"https:\/\/hoho.live\/luda\/index.php\/2026\/11\/13\/how-pagerank-iterates-a-damped-link-matrix\/","title":{"rendered":"How PageRank iterates a damped link matrix"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\"><strong>Short answer:<\/strong> <strong>PageRank<\/strong> assigns every page a score that is the stationary distribution of a random surfer. With probability d the surfer follows a link chosen uniformly among the page&#8217;s out-links. With probability 1\u2212d the surfer jumps to a uniformly random page. The usual damping factor is <strong>0.85<\/strong>. The scores are the dominant eigenvector of the resulting stochastic matrix, computed by <strong>power iteration<\/strong>. Dangling pages, which have no out-links, are treated as linking to every page so the matrix stays stochastic.<\/p>\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n<h4 class=\"wp-block-heading\"><strong>What the problem actually asks<\/strong><\/h4>\n\n<p class=\"wp-block-paragraph\">A raw link count promotes a page that many pages cite, and it also promotes a page cited by a page that itself has a high score. That circular definition is an eigenvector equation. Without damping, the chain can get stuck in a component and the stationary distribution need not be unique. The teleport term makes the chain irreducible and aperiodic on a finite web, so the stationary distribution exists and is unique, and power iteration converges.<\/p>\n\n\n<p class=\"wp-block-paragraph\">The damping factor is a modeling choice. 0.85 is the historical default, not a law. A different d changes the scores and the convergence rate. The gap that power iteration needs is created by this term.<\/p>\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n<h4 class=\"wp-block-heading\"><strong>What the algorithm guarantees<\/strong><\/h4>\n\n<p class=\"wp-block-paragraph\">The damped Google matrix has a unique positive stationary distribution, the PageRank vector, which sums to 1. Power iteration multiplies by that matrix, which in practice is a sparse multiply by the link structure plus a rank-one teleport correction, not a dense matrix. Each iteration is linear in the number of edges. The iteration converges geometrically at a rate bounded by d. Extra memory is the score vector.<\/p>\n\n\n<p class=\"wp-block-paragraph\">Pages with no out-links must be handled. Leaving their rows as zero breaks the stochastic matrix. The standard fix spreads that mass uniformly, or folds it into the teleport. Self-links and duplicate links should be defined by the graph builder before the iteration starts.<\/p>\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n<h4 class=\"wp-block-heading\"><strong>The working steps<\/strong><\/h4>\n\n<ol class=\"wp-block-list\">\n<li>Build the directed graph. For a dangling node, treat it as having an edge to every node, or account for its rank in the teleport term.<\/li>\n<li>Initialize a positive score vector that sums to 1.<\/li>\n<li>Each iteration sets the new score of v to (1\u2212d)\/n plus d times the sum, over in-neighbors u that have out-degree k_u, of score(u)\/k_u, with dangling mass included.<\/li>\n<li>Normalize if a dangling-node implementation requires it. Stop when the L1 change is below a tolerance.<\/li>\n<li>The dominant eigenvalue of the damped matrix is 1. Do not run an undamped iteration and expect the same uniqueness.<\/li>\n<\/ol>\n\n\n<p class=\"wp-block-paragraph\">The unique stationary distribution belongs to the damped chain. HITS is a different hub-and-authority iteration. Power iteration is the numerical method. PageRank is the surfer model. A personalized PageRank changes the teleport distribution so it is not uniform, and the same iteration applies.<\/p>\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n<h4 class=\"wp-block-heading\"><strong>Approaches that look simpler and fail<\/strong><\/h4>\n\n<figure class=\"wp-block-table\">\n<table>\n<thead>\n<tr>\n<th>Approach<\/th>\n<th>Why it fails when a dangling page keeps a zero row<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>Leave a page with no out-links as a row of zeros<\/td>\n<td>Probability mass disappears. The vector no longer sums to 1 and the matrix is not stochastic.<\/td>\n<\/tr>\n<tr>\n<td>Iterate the undamped link matrix and call the limit PageRank<\/td>\n<td>The limit can depend on the start when the web has more than one terminal component. The teleport term removes that dependence.<\/td>\n<\/tr>\n<tr>\n<td>Divide by out-degree zero<\/td>\n<td>The damped formula&#8217;s link term is only over pages that have out-links, with dangling mass handled separately. A raw division by zero is the bug the special case exists to avoid.<\/td>\n<\/tr>\n<tr>\n<td>Treat 0.85 as a required constant<\/td>\n<td>Any d in (0, 1) yields a unique distribution. The number changes the scores and the convergence rate.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/figure>\n\n\n<p class=\"wp-block-paragraph\">The eigenvector computation is power iteration. A hub and authority pair is HITS. PageRank is the damped random-surfer stationary distribution.<\/p>\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n<h4 class=\"wp-block-heading\"><strong>A working example<\/strong><\/h4>\n\n<p class=\"wp-block-paragraph\">This Python fragment iterates a damped link matrix. The single edge is 0\u21921, and vertex 1 is dangling, so its rank is spread by the teleport. With d = 0.5 the dangling page shares its rank and the link still favors vertex 1. It prints the scores rounded to two decimals, <code>0.40 0.60<\/code>.<\/p>\n\n<pre><code class=\"language-python\">n, d = 2, 0.5\nout = [1, 0]  # vertex 1 is dangling\nscore = [1 \/ n, 1 \/ n]\nfor _ in range(40):\n    nxt = [(1 - d) \/ n, (1 - d) \/ n]\n    dangling = sum(score[u] for u in range(n) if out[u] == 0)\n    nxt[0] += d * dangling \/ n\n    nxt[1] += d * dangling \/ n\n    nxt[1] += d * score[0] \/ out[0]\n    score = nxt\nassert abs(sum(score) - 1) &lt; 1e-9\nprint(f&quot;{score[0]:.2f}&quot;, f&quot;{score[1]:.2f}&quot;)\n<\/code><\/pre>\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n<h4 class=\"wp-block-heading\"><strong>Where it is used<\/strong><\/h4>\n\n<p class=\"wp-block-paragraph\"><strong>PageRank<\/strong> was the ranking walk of early Google and is still the name of the damped score on a web or citation graph. Power iteration is how that vector is computed. HITS is the hub-and-authority alternative on the same kind of link graph.<\/p>\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n<h4 class=\"wp-block-heading\"><strong>When you can drop this algorithm<\/strong><\/h4>\n\n<p class=\"wp-block-paragraph\">Drop the undamped matrix when the goal is the classical PageRank vector. Include the teleport term and a dangling-page rule, and iterate until the score vector stabilizes.<\/p>\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n<h4 class=\"wp-block-heading\"><strong>Why this stays published<\/strong><\/h4>\n\n<p class=\"wp-block-paragraph\">We publish this so a search for PageRank returns the damped surfer, the dangling-page fix, and the power iteration that computes the scores. <strong>PageRank is the unique stationary distribution of a web surfer who follows a link with probability d and otherwise jumps uniformly, computed by power iteration.<\/strong><\/p>\n\n\n<p class=\"wp-block-paragraph\">\u672c\u6587\u7531 HoHo \u8207 AI \u5354\u4f5c\u6574\u7406\uff0c\u6700\u5f8c\u66f4\u65b0\u65bc 2026 \u5e74 11 \u6708 13 \u65e5\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Short answer: PageRank assigns every page a score that is the stationary distribution of a random surfer. With probability d the surfer follows a link chosen uniformly among the page&#8217;s out-links. With probability 1\u2212d the surfer jumps to a uniformly random page. The usual damping factor is 0.85. The&hellip;<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[30,32],"tags":[],"class_list":["post-232","post","type-post","status-publish","format-standard","hentry","category-algorithms","category-graphs"],"_links":{"self":[{"href":"https:\/\/hoho.live\/luda\/index.php\/wp-json\/wp\/v2\/posts\/232","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/hoho.live\/luda\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/hoho.live\/luda\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/hoho.live\/luda\/index.php\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/hoho.live\/luda\/index.php\/wp-json\/wp\/v2\/comments?post=232"}],"version-history":[{"count":2,"href":"https:\/\/hoho.live\/luda\/index.php\/wp-json\/wp\/v2\/posts\/232\/revisions"}],"predecessor-version":[{"id":631,"href":"https:\/\/hoho.live\/luda\/index.php\/wp-json\/wp\/v2\/posts\/232\/revisions\/631"}],"wp:attachment":[{"href":"https:\/\/hoho.live\/luda\/index.php\/wp-json\/wp\/v2\/media?parent=232"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/hoho.live\/luda\/index.php\/wp-json\/wp\/v2\/categories?post=232"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/hoho.live\/luda\/index.php\/wp-json\/wp\/v2\/tags?post=232"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}