Link Analysis: PageRank and HITS
Prerequisite Knowledge
This lecture builds on the following concepts from earlier lectures. If any feel unfamiliar, review the linked notes before proceeding.
Previously Covered in This Subject
- Anchor Text and Crawler-Indexer Pipeline — covered in Lecture 13 (Web Crawling in Detail and Recommender Systems)
- K-Means Clustering and Centroids — covered in Lecture 11 (Text Classification, Clustering, and Web Search)
- Static Web Graph and User Behaviour — covered in Lecture 11 (Text Classification, Clustering, and Web Search)
- Random Walk Sampling on a Link Graph — covered in Lecture 12 (Web Search Challenges, Size Estimation, Near Duplicates and Crawling)
Link Analysis: PageRank and HITS
14.1 Web as Graph and Good-Bad Propagation
14.1.1 Nodes, Edges, Inlinks and Outlinks
How can a messy pile of pages become something a computer can rank? The first move is to stop seeing pages as isolated texts and start seeing them as a network.
Think of the whole web as a city map. Each page is one building. Each hyperlink is a one-way street from one building to another. Once you hold that map, you can ask which building gets the most visitors, which street matters most, and which blocks form a tight neighbourhood.
A node (one page or article that can be ranked, written ) is a single document in the collection. An edge (a directed connection from one document to another, written ) is one hyperlink that carries meaning from its source to its target. Direction matters here. A link from to is not the same as a link from to .
An outlink (a link that leaves the current page) points from the current document to some other document. An inlink (a link that arrives at the current page) points from some other document into the current document. For a page , the count of outlinks is the out-degree (how many pages points to, written ), which might be when points to two pages. The count of inlinks is the in-degree (how many pages point to , written ), which might be when five pages point to .
A web collection is a directed graph . Here is the set of pages, with , and is the set of hyperlinks. For pages and , the pair is in exactly when links to . The out-degree is . The in-degree is . Reading row of the link table shows outlinks. Reading column shows inlinks.
This view unlocks the full network toolkit. Once documents and links form a graph, it becomes possible to ask for the most significant nodes, the most significant edges, tightly linked groups inside a huge network, and connected components that behave as one unit. A triangle of three pages that all point to each other carries a different weight than three isolated single links, because the triangle traps a walker inside while isolated links let the walker leave. At web scale, with thousands or millions of nodes, those small shapes add up to structure. Connected components, clusters, and hub centres all emerge from the same node-and-edge base.
Picture the shape with axes in mind. Put page index on the horizontal axis and link count on the vertical axis. Most pages sit low, with zero, one, or two inlinks. A few pages spike high, with hundreds of inlinks. That skewed curve, low for most and tall for a few, is the first visual hint of importance. The takeaway in one line: link shape already separates the few central pages from the many side pages.
Scope: The graph view applies whenever links are directional endorsements or pointers between documents. It fits web pages, citations, and recommendation links. It breaks when links are navigational boilerplate, such as a copyright footer repeated on every page of one site. Those template links inflate in-degree without adding endorsement, so practical systems discount internal links before scoring.
Social networks, recommendation networks, and road networks all reuse the same node-and-edge view. In a social network the goal includes finding the importance of a node and closely linked groups inside a big network. In a road network the goal includes finding the best possible route between two places. In a document network the goal includes finding the rank of a node and the rank of an edge. The shared maths lets one toolkit serve all three settings.
Worked mini-example — reading degrees. Take three pages , , . Suppose , , and . Then , , . For in-degrees, , , . Page has the most inlinks, so by link shape alone it looks most endorsed. Sense-check: the totals match, since the sum of all out-degrees equals the sum of all in-degrees , which must hold because each edge contributes once to each sum.
A common early slip is to treat in-degree as the full rank. A page with many inlinks from weak or spammy pages can outscore a page with few inlinks from strong pages if only raw counts are used. Later methods fix this by weighting each inlink by the strength of the page that gives it.
Exam note: Be ready to define node, edge, inlink, outlink, in-degree, and out-degree, and to read both views from one table: row for outlinks, column for inlinks.
One-line recap: pages as nodes plus hyperlinks as directed edges turn ranking into a network problem. That map leads straight to the good-bad labelling puzzle, where link direction alone hints at quality.
14.1.2 Good Nodes, Bad Nodes and Two Propagation Rules
Suppose a few pages are already known to be good and a few are known to be bad, while the rest are unknown. Can link shape alone colour each unknown node as good or bad?
Imagine a neighbourhood where two houses are known to be honest shops and one house is known to be a scam shop. A new shop opens and puts up signposts to both an honest shop and the scam shop. Which label would you give the new shop?
Take a node with out-degree two, where points to one good document and one bad document. A tiny working assumption helps here, stated in words as good nodes never point to bad nodes. In symbols, if is good then none of its out-neighbours is bad:
That assumption fails for here, because does point to a bad node. The fix is to label as bad. The logic is one step of elimination: the single bad outlink rules out the good label under this strict rule.
Carry the same idea forward in two directions. The first rule looks at outlinks. Verbal form: if you point to a bad node, you are bad. The second rule looks at inlinks. Verbal form: if a good node points to you, you are good. With those two rules, labels spread step by step. A node pointed to by a good node becomes good. A node that points to a bad node becomes bad. After a few rounds, the whole small network gets a label. In symbols, for any pages and with a link :
This simple spread is useful for spam detection and related tasks. It gives a first way to turn a bare web graph into a labelled graph before any scoring starts. Spam hosts often link to each other and to compromised pages, while trusted pages rarely link to known spam, so the two rules push labels outward from the known seeds.
Describe the spread as a picture. Put iteration number on the horizontal axis and count of newly labelled nodes on the vertical axis. The curve rises fast in early rounds as neighbours of seeds get coloured, then flattens as the frontier runs out of unknowns. The takeaway: a few seeds can colour a connected neighbourhood in a handful of passes.
Scope: These two hard rules are a teaching starting point, not a production classifier. They assume labels are binary, seeds are fully trusted, and the good-never-points-to-bad constraint holds without exception. They break when a good page links to a bad page by mistake, when a page is hacked after being labelled good, or when the graph has conflicting paths to the same node. Measured scores with weights replace the hard labels later.
Worked mini-example — three-step spread. Start with known good, known bad, and unknowns , , . Links: , , , . Step 1: points to , so by the outlink rule is bad. Step 2: points to , so by the inlink rule is good. Step 3: points to , so is bad. Final labels: bad, good, bad. Sense-check: each unknown touched a seed path, so no node stays uncoloured.
Do not apply the rules backwards. A bad node pointing to you does not make you bad under this pair, and your pointing to a good node does not make you good. Only the two stated directions carry force: outlink to bad spreads badness backward, inlink from good spreads goodness forward.
Exam note: State both rules with direction: outlink to bad makes the source bad, inlink from good makes the target good. Show the case with out-degree two as the reason must be bad.
One-line recap: two one-way label rules turn a few known good and bad pages into a fully coloured neighbourhood. The same neighbour-tells-about-you idea then widens into guilt by association.
14.1.3 Guilt by Association
The good-bad spread is one instance of a broader network idea often called guilt by association (the behaviour or label of neighbours tells us about a node, so a node near many bad nodes looks bad and a node near many good nodes looks good).
Think of a fruit basket. One rotten apple in a closed basket softens the apples that touch it. You judge the untouched apples by the company they keep, not only by their own skin.
One everyday version comes from a school classroom. Suppose a study group has six members. Two members copy in an exam. The other four never copy and never join any malpractice. Outsiders still call the whole group a bad group that copies. The four are judged by association with the two, not by their own acts. The mapping is direct: the group is the neighbourhood, copying is the bad label, and membership is the link. The break point: unlike web links, group membership is undirected and gives the four no way to cut the link, while a page can remove an outlink.
The same pattern runs in the other direction. Think of a very popular lead actor in older ensemble films. Wherever that lead appears, a cluster of supporting actors, villains, dancers, and crew appears with them, film after film. At time one cluster is seen in one film. At a later film much of the same cluster returns. The group travels together because of one central node. A director can play the same central role. The full crew follows the director from film to film. That repeated co-appearance is association at work: the central good node pulls its neighbours into the same orbit.
For document networks, the lesson is direct. Good tends to stay near good. Bad tends to pull neighbours toward bad. Link shape alone already hints at quality, because co-linking and repeated co-appearance expose shared origin even when page text hides it.
Scope: Guilt by association is a hint, not proof. It works when neighbours choose each other for topic or trust reasons. It fails for forced co-location, such as pages bundled by one template, actors hired by one studio contract, or students grouped at random. Always ask whether the link reflects choice before reading quality from it.
For search, this idea later hardens into concrete scores. Spam detection keeps the bad-spreads-backward half. Hub and authority scoring keeps the good-stays-with-good half but splits it across two roles. Citation similarity keeps the co-appearance half: two papers cited together by many third papers look similar in topic.
Guilt by association states that neighbour labels predict node labels. Classroom copying shows the bad side, the travelling film cluster shows the good side, and both point to link shape as an early quality signal.
14.1.4 Student Questions and Answers
Q: Do we try to find the best possible route in link analysis?
A: That is one application. More broadly, wherever nodes and edges exist, it is possible to study importance of a node, rank of a node, rank of an edge, and closely linked groups inside a big network. Route finding is one use. Node importance and group discovery are others. In this lecture the focus is node importance for ranking, not shortest paths.
The distinction matters because the maths changes with the goal. Route finding minimises path cost. Importance ranking accumulates endorsement weight. Both live on the same graph, but they optimise different quantities.
Q: Does this good-bad logic always fail, and is it the same iterative logic every time?
A: This good-bad pass is a basic starting logic used to motivate the graph view and to show how spam versus non-spam labels could spread. It is not meant as a fixed rule applied blindly in every step. Later methods replace hard labels with measured scores such as PageRank and hub-authority values, which keep the spread idea but weight it.
Several students pressed the same doubt in different words, so one canonical answer covers the repetition: the early rules teach direction of spread, the later scores teach amount of spread.
Q: Can a road map with good routes versus blocked bad routes work the same way?
A: That analogy is hard to stretch. In road networks there is no constraint that a good route always points only to another good route. A good highway can lead to a blocked side street without turning bad itself. The good-points-only-to-good constraint fits document trust better than roads, where physical connection carries no endorsement. Keep looking for graph examples such as social or citation networks, but keep the constraint in mind when testing whether the analogy holds.
Exam note: If asked why route finding is mentioned, answer that it is one network use among several, while this lecture ranks nodes by endorsement rather than finding shortest paths.
14.2 Search Flow and Ranking Goal
14.2.1 From Query to Ranked List
Why does a search engine show one page first and another tenth when both contain the query words? The answer starts with the flow from query to ordered list.
Picture a library desk. You hand over a slip with a few words. The librarian first pulls a trolley of books that mention those words, then decides which book to place on top. Pulling the trolley is retrieval. Stacking it in order is ranking.
A typical search flow has a small set of stages. A user types a query. The engine looks in the index, pulls back a relevant set of documents, and then must order that set. The open question is what decides that one document appears first, another second, and so on.
That ordering is the job of ranking. A ranking (an ordering of the retrieved documents from highest score to lowest, written as ) puts the highest scoring document at the top, the next highest second, and so on. The score behind the order blends several inputs. Pure document scores matter, such as text match and link strength. User data matters too, such as past search interest, location, and related signals. The present focus is narrower: for a given query, how are documents ranked by their own link and content signals alone, before user-specific adjustments are layered on top.
The staged flow is query index lookup relevant set scored ranked list. Let be the relevant set for query and the blended score of document . The displayed order sorts by falling . Document-only parts of are query-independent or query-text-dependent but user-independent. Personal parts shift the same base order per user.
Large web engines combine document-only scores with freshness, relevance, and user-specific scores at display time, with strong weight on link-based rank. Freshness lifts recent pages for breaking topics. Relevance ties the query words to page and anchor words. User signals adjust for place and history. The lecture isolates the document-only slice so link maths can be studied without personalisation noise.
Picture the blend as a stacked bar per document. The bottom block is text match, the middle block is link strength, the top block is freshness plus personal signals. The total bar height sets the order. The takeaway: link strength is one large block, never the whole bar.
Scope: The query-to-ranked-list view assumes an index already exists and retrieval already returned a candidate set. It does not cover crawling, index building, or duplicate removal. It also assumes scores from different signals can be blended into one number, which needs score normalisation and weight tuning in practice.
A frequent early mix-up is to equate retrieval with ranking. Retrieval decides membership in the set. Ranking decides position in the list. A page can be relevant enough to be retrieved yet still sit low because its blended score is weak.
Exam note: If asked why ranking is needed, answer that many documents can all be relevant, so the engine must order them by a blended score of document, freshness, and user signals.
One-line recap: retrieval pulls the candidate trolley, ranking stacks it by blended score. The next question is why link shape alone deserves a large block in that stack.
14.2.2 Why Link Shape Alone Can Rank
What does a bare pointer know that page text does not? It knows who vouched for whom.
A bare hyperlink already says a lot. If document points to document , that pointer is a vote of attention from to . Add up those votes across the web, weight them by who is voting, and an ordering emerges. That is the core bet of link analysis for ranking: use hyperlinks between documents to score web search results. A vote from a strongly endorsed page counts more than a vote from an unknown page, which is why later methods weight votes instead of counting them raw.
The endorsement bet is that confers some of the standing of onto . Raw in-degree counts votes. Weighted methods such as PageRank and HITS weight each vote by the standing of the voter, so the same link shape yields different orders under different weighting rules.
Think of class representatives voting for a school captain. Every ballot is a link. A ballot from a representative who won by a large margin carries more weight than a ballot from a narrow winner. The analogy breaks where links are forced: template footers and paid links are ballots stuffed without real endorsement, so they must be discounted.
Scope: Link-only ranking applies when links reflect voluntary endorsement at web scale. It weakens for new pages with few inlinks, for private collections with sparse links, and for topics where freshness beats history. Those gaps motivate anchor text, freshness boosts, and language matching alongside link scores.
Exam note: Expect questions that ask why ranking is needed at all, and what inputs feed the final ordered list beyond raw relevance: link strength plus freshness, query-document relevance, and user-specific signals.
One-line recap: hyperlinks are weighted votes, and adding those votes gives an order before any personal data is used. That vote idea becomes concrete once anchor words are added to the pointer.
14.3 Anchor Text, Doorway Pages and Google Bomb
14.3.1 Anchor Text as Description of the Target
A link points, but the clickable words describe. That description often summarises the target better than the target describes itself.
Have you ever picked a book by what other readers said about it rather than by its cover? Anchor text is that reader note attached to a pointer: the words the linking author chose to describe the destination.
A hyperlink has two parts. One part is the pointer itself. The other part is the anchor text (the clickable words the reader sees, written ). In page source the pattern looks like an anchor open tag, the visible words, a reference to the target, and an anchor close tag. A reader sees only the visible words, such as student results or click here, while the pointer sits underneath.
Anchor text helps predict the target. Suppose page links to page with the visible words you can find cheap cars here. While ranking , those four words suggest that should hold information about cheap cars. The link says the pages connect. The anchor words say what the target is about. The engine can therefore index under cheap and cars even when itself uses different wording.
More cases make the point. A book note might say an Information Retrieval book can be ordered at a local bookstore, where the bookstore name acts as anchor text. A university name or a course name can act the same way. A well known case is a query about IBM. Many pages match the letters IBM, including copyright pages, encyclopedia pages, and home pages. Anchor text plus the query can guide the engine straight to the intended IBM page, because many independent authors point to the IBM home page with the word IBM or computer. On a news-style page, a line such as IBM acquires a firm carries a link that should land on the parent IBM page. A line about new IBM optics should land there too. In each case the anchor words describe the target better than the bare pointer.
Anchor text is third-party description. For target and anchor set on an inlink , the terms in are indexed as if they partly describe , with a marker that they came from outside. Common anchor words such as click and here get low weight, in the same spirit as inverse document frequency, while rare descriptive words get high weight.
Anchor text is routinely indexed alongside links because it is often a better short summary of the target page than the target title alone. Corporate home pages are the textbook case: at the time of writing of the reference book, the IBM home page did not contain the word computer and the Yahoo home page did not contain the word portal, yet anchors pointing to them did, so only anchor indexing connected those queries to the right targets. Image-heavy pages behave the same way: the crawler sees no useful words inside the image, but anchors from other pages supply them.
Picture the fix with two columns. The left column lists words on the IBM page itself, with no computer entry. The right column lists anchor words from inlinks, with computer tallied many times. The horizontal axis is term frequency, and the anchor column spikes on the missing word. The takeaway in one line: outside words fill the gap left by inside wording.
Scope: Anchor indexing helps when independent authors describe the target honestly and in varied words. It weakens when anchors are generic (click here), when inlinks are few, or when anchors are bought or coordinated. Weighting by rarity and by source trust keeps the signal useful.
Worked mini-example — IBM disambiguation. Query . Three candidates contain IBM: a copyright footer, an encyclopedia entry, and the IBM home page. Page text alone ties them. Anchor evidence breaks the tie: dozens of inlinks to the home page carry anchors IBM and computer, while the other two get few such anchors. With anchor overlap added, the home page scores highest and is shown first. Sense-check: the result matches user intent, since most users typing IBM want the company home, not a passing mention.
Do not read anchor text as page text. It lives on the source page but describes the target. Indexing it under the source alone misses its ranking value. Indexing it under the target with an anchor marker preserves both location and role.
Exam note: Be ready to explain with the cheap-cars pointer and the IBM home-page case why outside description beats inside wording for some queries.
One-line recap: anchors add human-written labels to bare pointers, and those labels often rescue queries that page text alone cannot answer. The maths of that addition comes next.
14.3.2 Mathematical View of Anchor Weight
How much should outside words count? Enough to move the order, not so much that they drown page text.
There is no single fixed equation for anchor use, but the working form discussed here can be written in direct form. Let be the query term set, let be the anchor word set on an inlink to page , and let be a weight that favours anchor matches. The anchor-aware score for rises when overlaps . Described in words as add extra weight when query words match anchor words on inlinks, one simple form is:
Here is the base text score of page , counts shared terms between query and anchor set , and with sets how much anchor matches count. The point is not the exact . The point is that anchor evidence is added on top of page text.
The additive form keeps two sources separate. The base term holds inside-page match. The anchor term holds outside endorsement match summed over inlinks. Learning from labelled data sets the trade-off. A larger trusts third-party description more. A smaller trusts page text more.
Take numbers to fix ideas. Suppose , query , anchor , so , and . Then . A rival page with stronger base but no anchor overlap stays at , so overtakes on this query because of outside words.
Picture weight tuning as a line. Put on the horizontal axis and ranking quality on held-out queries on the vertical axis. Quality rises as leaves zero, peaks at a middle value, then falls as anchor spam takes over. The takeaway: some anchor weight helps, too much invites attack.
Scope: The linear addition assumes anchor overlap and base score are on comparable scales and that inlinks are independent. It breaks when one page buys many coordinated anchors or when generic anchors inflate overlap. Frequency weighting, rarity penalties, and source-trust weights restore the assumption in practice.
Machine-learned scoring sets the real weights from many features at once, not from this one-line sketch alone. The sketch teaches the direction of effect. The trained system teaches the amount.
Exam note: Write the anchor-aware form, name , , and , and stress that anchor evidence is added on top of page text rather than replacing it.
One-line recap: a small additive term lets outside words lift the right target. That same lift is what attackers later exploit.
14.3.3 Misuse, Doorway Pages and Google Bomb
A signal strong enough to help honest ranking is strong enough to attract attack once its weight is known.
Think of exam hints. Once students learn that one hint always appears, some will forge that hint to steer the marker. Anchor weight is that hint: honest authors use it to guide search, attackers forge it to hijack results.
A better signal invites misuse. If engines give high regard to anchor words, a writer with malicious intent can craft noble anchor words that point to unrelated targets. Readers who trust the visible words land where the writer wants, not where the words promise.
One named form is the doorway page pattern raised in discussion. A doorway page (a page or anchor whose visible words promise one topic but whose pointer delivers an unrelated target) uses a single word or short phrase that carries a link redirecting readers to a different target page than the words suggest. Since the clickable words live inside the anchor element, that trick is part of anchor handling in page source. The visible words promise one thing and the pointer delivers another.
A larger coordinated form was called a Google bomb (a coordinated anchor campaign in which many writers use the same chosen anchor words to favour documents of their choice, so a search returns deliberately bad or misleading results). A search returns deliberately bad or misleading results because many writers manipulate anchor text on purpose to favour documents of their choice. The anchor text might look noble, for example free learning, while the linked targets are not good documents. That gap pushed a large engine to add a different weighing function around 2007. The fix reduced the attack quickly but did not wipe out malicious anchor use at its root. Later coordinated queries such as dangerous cult surfaced unintended results across several engines. Older bombs such as who is a failure and evil empire were diffused. Engines still fight new variants today.
The attack works because ranking trusts the sum of independent anchors. One forged anchor is noise. Hundreds of coordinated anchors with the same words look like consensus. Defence therefore targets coordination: discounting bursts of identical anchors, weighting by source trust, and retuning the anchor weight so that page text and link structure must agree before a page can top the list.
Anchor spam is an early case of adversarial search behaviour, where the same signal that helps honest ranking helps attackers once its weight is known. The 2007 weighing response is the textbook example of an arms race: attackers coordinate, the engine reweights, the visible bombs fade, then new phrasings appear and the cycle repeats.
Scope: Anchor defences reduce large coordinated bombs but do not remove all malicious anchor use. Single-word doorway redirects and fresh phrasings still slip through, because the engine cannot tell honest praise from forged praise by words alone. Source reputation, link-farm detection, and behaviour signals must join the defence.
Worked sketch — noble words, poor target. Suppose 200 pages all add the anchor free learning pointing to target , while honest anchors for mention unrelated topics. For query , each forged inlink contributes under the additive form, so gains about anchor points and jumps above honest learning pages. After the 2007 reweighting, for bursty identical anchors drops sharply, so the same 200 links add far less and falls back. Sense-check: the fix targets coordination, not the words themselves, so honest varied anchors keep their value.
Do not confuse a doorway redirect with a normal navigation link. A normal link promises and delivers the same topic. A doorway promises one topic in visible words and delivers another through the pointer. The test is promise-versus-delivery, not the presence of a link.
Exam note: Be ready to pair one honest case (cheap cars, IBM) with one attack case (free learning, dangerous cult, who is a failure, evil empire) and to name the 2007 weighing response as reduction without full removal.
One-line recap: anchor trust lifts honest targets and, when forged at scale, lifts chosen targets instead, which forces engines to weight coordination itself. Student doubts about that forgery path come next.
14.3.4 Student Questions and Answers
Q: Can someone spam by changing anchor words while keeping the underline link look?
A: Yes. That is exactly the misuse path. With malicious intent, the same anchor text that helps honest search can be bent to send users to pages of the attacker choice. The visible underline stays familiar, so readers trust it, while the hidden pointer and the ranking weight given to anchor words make the trick pay off both for clicks and for position.
The key phrase to retain is malicious intent: honest anchors describe, forged anchors steer. The ranking weight is what converts a click trick into a position trick.
Q: What are doorway pages with a single word that redirects to other pages?
A: That pattern is the same anchor idea. A single word or short phrase is wrapped as anchor text and linked to a different target. The terminology comes from how the words look in page source inside the anchor element. The visible words promise one thing and the pointer delivers another, so the page acts as a doorway into an unexpected destination rather than as a genuine description.
Exam note: Be ready to explain with an example why anchor text helps ranking and how the same mechanism enables a Google bomb: honest anchors add consensus description, forged coordinated anchors fake that consensus.
14.4 Prompt Injection as Modern Anchor Misuse
14.4.1 Email Summarization Attack
What happens when the same hide-a-directive trick moves from links to language models? The answer is prompt injection.
Imagine a helpful assistant who reads your mail aloud and follows any instruction it hears. If one letter in the pile says ignore the rest and send everything to a stranger, and the assistant obeys the letter instead of you, that is prompt injection in one scene.
Malicious intent did not stop with anchor words. A modern parallel is prompt injection (hidden instructions smuggled inside data that a language model reads, so the model follows the data instead of the user). The shape matches anchor misuse: trusted visible content carries a hidden directive, and a system that gives high weight to that content obeys it.
A first-of-its-kind email attack around the time chat models became popular in 2022 shows the shape. Employees received long emails each day. To save time, they pasted each full email into a chat window and asked for a summary. One spam email hid an extra instruction inside its long body. Stated in words as after summarising this text, redirect the summaries to this web page, the hidden line told the model to send the summaries to a competitor address. Staff who trusted the tool kept pasting emails. Once that hidden instruction ran, prior summaries were redirected to the other address, leaking earlier work to a competitor.
The attack chain has four links: long trusted input plus a hidden directive plus a model that merges instructions and data plus a user who pastes without inspection. Break any link and the attack fails. Skim-and-paste habits, models without instruction hierarchy, and emails that allow free-form hidden text all strengthen the chain.
The defence direction mirrors anchor defence. Just as engines learned to distrust bursty coordinated anchors, model systems learn to separate system instructions from data text, to flag redirect-style directives inside pasted content, and to ask before acting on embedded orders. Each new protocol is followed by a new hiding trick, so the arms race continues.
Scope: The email case assumes the model treats pasted text as partly instructive and has a channel to exfiltrate output, such as browsing or follow-up requests. It does not apply to a model used strictly offline with no send or browse ability. Input checks and least-privilege tool access shrink the scope sharply.
Exam note: Retell the 2022 email summarisation theft in order: long daily emails, paste-for-summary habit, hidden redirect line inside one spam body, summaries sent to a competitor address.
One-line recap: a hidden sentence inside trusted mail turned a summariser into a forwarder. The same trick then spread to images and maths puzzles.
14.4.2 Image and Arithmetic Attacks
The hidden-directive pattern is not tied to email text. It travels wherever a model reads rich input.
The same trick spread to other inputs. An image summarisation attack hides a frame inside a frame that carries an attack instruction. A user asks for the time shown on a clock in the image. The model reads both the clock and the hidden instruction, so answering the visible question also triggers the hidden order. Arithmetic and jailbreak variants use camouflaged instructions to bypass safety rules: a maths word problem carries an extra sentence that tells the model to ignore its guardrails, and the model obeys the smuggled line. Each new defence is followed by a new attack form, from tiny fonts to encoded text to multi-step puzzles.
The link to anchor misuse is direct. In both cases, trusted visible content carries a hidden directive. In anchor spam, the visible words promise free learning while the pointer sends readers elsewhere. In prompt injection, the visible email asks for a summary while the hidden sentence sends data elsewhere. The intent pattern matches: use a high-weight signal against itself. The engine trusted anchors, so attackers forged anchors. The model trusts pasted context, so attackers forge context.
Both attacks exploit a confusion of roles. Anchor systems confused description with endorsement. Model systems confuse data with instructions. The fix in both cases is role separation: mark which words are allowed to describe, which pointers are allowed to endorse, which text is allowed to instruct, and which text must stay inert data.
Chat summarisation of email and images, competitor data theft through redirected summaries, and jailbreak studies all trace to prompt injection. The domain home is trustworthy AI deployment: email assistants, document summarizers, and image question-answering tools all sit on the same risk line.
Scope: Image and arithmetic variants assume the model reads embedded text inside pixels or puzzles as live instructions. Pure image classifiers without language following, and solvers that treat story text as inert numbers only, fall outside the pattern. The risk grows with model generality.
Prompt injection generalises anchor forgery from links to language: visible content promises one task while hidden content orders another, and the system obeys the hidden part because it never separated data from directives.
14.4.3 Student Questions and Answers
Q: Is prompt injection the same as cross-site scripting?
A: No. The email and image cases here are about hidden natural-language instructions inside model input that steer the model to redirect output or break rules. Cross-site scripting injects browser scripts into web pages to run code in a victim browser. The fix path for prompt injection uses model-side protocols and input checks, such as instruction hierarchy and redirect confirmation, not browser script fixes. The shared theme with anchor spam is malicious intent hiding inside trusted content, not shared code mechanics.
Exam note: If asked to contrast the two, stress input type and execution site: prompt injection steers model behaviour through words, cross-site scripting runs scripts in browsers through code.
14.5 Citation Analysis Roots of PageRank
14.5.1 From Co-Citation to PageRank
PageRank looks new, but its counting idea is decades older than the web. It began as a way to weigh journals by who cites whom.
Think of academic reputation. A journal cited by strong journals looks stronger than one cited by unknown journals, even when raw citation counts tie. PageRank applies that same reputation flow to web pages and links.
PageRank did not start as PageRank. The earlier name for the family was co-citation or citation analysis. The 1976 study behind the idea is Pinski and Narin, who built on Garfield (1955) to develop a journal influence weight whose definition is remarkably similar to PageRank. That work laid out the idea of weighting citations by the standing of the citing source and then sat largely unused until about 1990. It became widely known only after the same link-counting thought was adopted for web ranking by Larry Page and Sergey Brin, published as Brin and Page (1998) and Page et al. (1998), the team behind a major search company.
The core transfer is simple. A scientific citation is a link. A web hyperlink is a link. Methods that score papers by who cites whom can score pages by who links to whom. Co-citation similarity between articles, where two papers cited together by many third papers look similar in topic, becomes co-link similarity between pages. Influence weight for journals becomes rank for pages.
The lineage is Garfield (1955) citation analysis Pinski and Narin (1976) journal influence weight Brin and Page (1998) PageRank. Each step keeps the same fixed point: standing flows along references, and a node is strong when strong nodes point to it. The web version scales that flow to millions of nodes with teleporting and sparse computation.
Why did the 1976 idea wait until about 1990 to spread? Citation graphs were small and hand-curated, so raw counts sufficed for most library uses. The web removed that comfort: hyperlinks arrived at huge scale, with spam, boilerplate, and wildly uneven quality, so weighted flow became necessary rather than optional.
Scope: Citation transfer assumes a hyperlink endorses like a citation endorses. It holds for voluntary content links between independent pages. It weakens for template links, paid links, and navigational links, which is why practical systems discount internal links before scoring.
Citation counts, co-citation similarity between articles, and web PageRank share one ancestor idea. That shared root explains why the same eigenvector maths appears in library science and in web search under different names.
Spelling slips around the old names are common: the session audio renders the 1976 pair as Binsker and Narin, while the reference text gives Pinski and Narin, and the web pair is Larry Page and Sergey Brin rather than a Brim variant. Holding the correct pair matters because exam and reference questions trace the lineage by name and year.
Exam note: Name the chain with years: 1976 Pinski and Narin journal influence weight from Garfield (1955), reused for the web by Brin and Page (1998).
One-line recap: journal influence maths became web rank maths once links replaced citations. The citation-as-link mapping comes next.
14.5.2 Citation as Outlink
How exactly does a bibliography entry become a graph edge? By reading citing as pointing out and cited as pointed into.
Take a sentence such as Miller has shown that physical activity alters metabolism to estrogens, published in 2001. That sentence cites the work by Miller. In graph terms, the current scientific document holds text and gives an outlink to the Miller document. The citing page points out. The cited page receives an inlink. The visible sentence is the anchor, the bibliography entry is the pointer, and the Miller paper is the target.
For papers and , define when cites and otherwise. Then is the bibliography length of and is the citation count of . The row view lists whom credits. The column view lists who credits .
One document can cite many others. One paper can be cited by many. That web of pointers lets us study co-citation similarity between articles. Two papers cited together by many third papers look similar in topic, because independent authors grouped them for the same reason. The 1976 paper explored exactly that link-based similarity with journal weights. Later, the same counting logic, scaled to the web with teleporting and normalisation, became PageRank.
Think of two recipes that always appear together in many cookbooks. Even without reading either recipe, the repeated co-appearance signals shared cuisine. Co-citation works the same way for papers and, by transfer, for pages. The analogy breaks where co-appearance is forced by one editor rather than chosen by many independent citers.
Scope: Co-citation similarity needs multiple independent citers to be meaningful. One review that cites two papers together proves little. Dozens of separate papers citing the same pair prove shared topic. Web co-linking inherits the same sample-size condition.
Co-citation states that joint citation implies topic closeness. The Miller 2001 metabolism citation is the concrete outlink case: current paper points out, Miller paper gains one inlink.
14.5.3 PageRank Scoring Sketch
What is the simplest link-only score before random walks enter? A binary table of who links to whom.
Start with attendance, not reputation. First record who pointed to whom with ones and zeros. Only then weight those ones by voter strength and teleporting. The binary table is the attendance sheet.
PageRank is a scoring measure based on link structure of web pages. A rough first sketch, not the final score, works like this. If document links to document , set the pair score to 1. If document has no link to document , set that pair score to 0. In symbols, let be the link entry from page to page . Described in words as one if an outlink exists and zero otherwise, the rule is:
Here and range over page indices, with for pages, and is a scalar in . A search engine takes this link signal, combines it with relevance, freshness, similarity, and user-specific attributes, and then orders the list. PageRank carries major weight in that blend, but it is not the only input.
The matrix with entries is the adjacency of the web graph. It records existence only, not importance. Importance enters later by dividing rows by out-degree to form probabilities, adding teleport shares, and iterating to a steady state. Confusing with the final rank is the central early slip: is input bookkeeping, not the answer.
Work the sketch on two pairs. If exists, . If , . Row therefore reads with a single one under its target. Column collects ones from all its citers. The full table is mostly zeros on the real web, which is why sparse handling matters later.
Scope: The binary sketch assumes every outlink endorses equally and every missing link endorses zero. It ignores voter strength, anchor meaning, and template noise. Those limits motivate the probability, teleport, and iteration steps that turn into PageRank.
Worked mini-example — two rows. With pages and links only, row is and a page with no outlinks has row before the dead-end fix. In-degrees read down columns: , others . Sense-check: a single link moves one unit of bookkeeping, not one unit of final rank, since weighting and teleporting still lie ahead.
Do not present as PageRank itself. It is the link entry that later feeds and then the teleport update. Naming the stage correctly avoids mixing input tables with output scores.
Exam note: Write the 0/1 rule, define and , and add that PageRank blends this link signal with relevance, freshness, similarity, and user-specific scores rather than using it alone.
One-line recap: ones and zeros record the graph, and later steps turn that record into rank. The first question that record raises is who built the method.
14.5.4 Student Questions and Answers
Q: Have we heard of the PageRank algorithm and who made it?
A: Yes. It is linked to Larry Page and Sergey Brin and the early search-company team, published as Brin and Page (1998) and Page et al. (1998). The underlying citation-analysis idea dates to Garfield (1955) with the influence-weight form by Pinski and Narin (1976), and it only became famous once applied to web ranking with random walks and teleporting.
Exam note: Pair the web names with the older lineage in one sentence to show transfer rather than invention from nothing.
14.6 Link Matrix and Transition Probability Matrix
14.6.1 Random Walk and Random Surfer
Why imagine a person wandering the web when the goal is a number per page? Because long-run visit share is that number.
Picture a restless reader who starts on a random page and keeps clicking a random outgoing link forever. Pages that collect many visits from this endless walk are, by definition, the important pages. PageRank is that visit share.
Any network with nodes and edges shows random-walk behaviour. A method from network science called the walk-trap idea starts from one hunch. Stated in words as a random walker tends to reuse the same links more often than other links, the hunch is that traffic concentrates on a few busy paths. A peak-hour car moves more often on a few busy roads than on far side streets, because those roads connect more places. The same concentration appears for a web surfer: popular pages with many inlinks get revisited often, while side pages are rarely touched.
PageRank uses that behaviour through a random surfer picture. A random surfer (an imaginary walker who starts at a random page and at each step leaves along one of the current outlinks chosen at random, written as state at step ) keeps walking without a destination. Start at a random page. At each step, leave the current page along one of its outlinks. Keep walking. After many steps, each page settles to a long-term visit rate. That steady rate is the PageRank of the page. In words: the long-term fraction of time a random surfer spends on a page is its rank.
The surfer model turns endorsement into traffic. If and , the surfer picks each out-neighbour with chance . Repeating that choice builds a path . The fraction of steps spent at page converges, under teleporting, to , the PageRank of .
The walk-trap hunch explains why communities emerge: the walker stays long inside a dense cluster and rarely crosses to another cluster, just as a driver circles busy downtown streets before taking a rare highway out. That trapping is both a discovery tool for groups and a warning for ranking, since traps without teleporting would lock the surfer in.
Scope: The plain surfer assumes every outlink is equally likely and every page has at least one outlink. Real pages have dead ends with no outlinks and links of uneven trust. Teleporting and weighting repair both gaps, so the plain walk is a starting picture rather than the final computation.
Worked intuition — busy-road counts. Suppose an intersection offers three roads, with past counts , , and cars. A random walker following traffic picks them with chances , , and . After walks, the busy road gets about visits. Pages behave the same way: inlink-rich targets draw the surfer often. Sense-check: visit shares sum to , matching the probability rule that each step must go somewhere.
Do not confuse the walk-trap observation with the ranking goal. Walk-trap uses concentration to find groups. PageRank uses the same concentration to score pages. Shared movement maths, different end use.
The random surfer turns link shape into visit share: start random, follow random outlinks, and read long-run time per page as its rank.
14.6.2 Markov Chain With Pages as States
How can endless clicking be written as maths that guarantees a steady answer? With a Markov chain whose states are pages.
The walk is modelled as a Markov chain (a discrete-time random process that moves in steps where the next state depends only on the current state, written with transition chances ). In the classic form the steps are times , with a network state at each time. For ranking, the same frame is reused with a small change. Instead of times as labels, the states are documents . At each step the surfer is on exactly one page. If the surfer is on at step and stays on at through a self-loop, the transition chance from to in that move is 1.
Let be the page count and the table with entries . The Markov property states that , so only the current page matters. Each row sums to one:
That row-sum rule is the arithmetic check used throughout the lecture: any proposed probability row that does not sum to contains an error.
The object that stores all one-step chances is the transition probability matrix (a table whose entry gives the chance of moving from page to page in one step, with each ). Each row sums to 1 because the surfer must go somewhere next, including possibly staying by a self-loop. A stochastic matrix (a non-negative matrix whose rows each sum to ) is the formal name for such a table, and its largest eigenvalue is , which later yields the steady state.
Think of a board game where the next square depends only on the current square and one dice throw. The board squares are pages, the dice weights are row probabilities, and the history of how the token arrived does not change the next throw. The analogy breaks where web walkers use back buttons or memory, which would violate the history-free property, but the basic surfer obeys it.
Scope: The Markov model assumes history-free moves and fixed probabilities per step. It holds for the idealised surfer with teleporting. It fails for behaviour with memory, such as avoiding recently seen pages, or with time-varying link weights. Those richer behaviours need larger state spaces.
Exam note: Define the Markov chain with pages as states, state the row-sum rule, and explain the self-loop case where staying still carries chance for that move.
One-line recap: pages as states plus one-step chances as rows give a Markov chain, and that chain is the machine that later produces steady ranks.
14.6.3 Link Matrix Construction on Seven Documents
How does a diagram of seven pages become a table of ones and zeros? By scanning each row for outlinks.
The first concrete step is a link matrix, also called a transition link matrix. A link matrix (the table with where an outlink exists and elsewhere) records existence only. Use the same rule from above: 1 where an outlink exists, 0 elsewhere. Anchor words such as car brand names that appear next to links in the demo network are noted but not used for PageRank scoring here. They describe targets for anchor indexing, but the PageRank pass reads only the pointer, not the words.
In the seven-document demo, labelled through , the rows are built from outlinks only:
- From there is only one outlink, to . Mark that cell 1. The rest of the row is 0, so row is .
- From there are two outlinks: a self-loop to and a link to . Mark and , so row is .
- The same row scan continues for through , marking 1 for each outlink and 0 elsewhere. In particular links to , , and , giving three ones in that row.
Construction rule: fix row , scan all columns , set when the diagram shows . The row view is outlinks. The column view is inlinks, read after the whole table is built.
Read along a row to see outlinks. Read down a column to see inlinks. For example, inlinks to arrive from , from itself through a self-loop, and from . The matrix therefore holds both views at once even though it was built row by row from outlinks. Column shows three ones exactly at rows , , .
Described in words as mark one for each outlink in the row and zero elsewhere, the construction rule in symbols is the same definition above, with the row page and the column page.
Scope: Row-by-row marking assumes the diagram is complete and each drawn arrow is one endorsement. It ignores duplicate links, template footers, and missing pages. In production the same scan runs over crawled adjacency lists with internal-link discounting added.
Worked mini-example — rows to columns. Row gives . Column collects ones from rows , , , so before the remaining rows are added. Sense-check: summing the full row counts must equal summing the full column counts, since both count the same arrows.
Do not build columns directly from inlink lists and call them rows. Rows are outlinks by definition. Columns reveal inlinks only after rows are complete. Swapping the two transposes the graph and corrupts every later probability.
Exam note: Practise the row scan on and , then read down its column to list , , as its in-neighbours.
14.6.4 Probability Matrix With Worked Fractions
How do counts become chances? By sharing each row equally among its outlinks.
Divide each row by its out-degree to turn counts into chances. Let be the out-degree of page , a positive integer. Let be the one-step chance from to . Described in words as link entry divided by out-degree of the row page, the rule is:
Each row of with ones becomes a probability row with entries of and zeros elsewhere. The row sum is , which preserves the stochastic property. Zero stays zero: no link means no direct chance before teleporting.
For , which can go to either or , each target gets half the chance:
The arithmetic is and , with the other five entries . The row reads and sums to .
For a page such as with three out-targets , , and , each gets one third:
Here per target, and , so the row again sums to one. The steps so far are only bookkeeping: link matrix first, then transition probability matrix. That table is the input for steady-state study with teleporting.
Picture one row as a pie. For the pie has two equal slices of . For it has three equal slices of about . The takeaway: out-degree sets slice count, division sets slice size.
Scope: Equal sharing assumes every outlink is equally likely. It ignores anchor relevance, link position, and source trust. Weighted surfers split the same row unevenly, but the equal-split version is the exam baseline and the textbook default before teleporting.
Worked check — D1 row. Start from with . Divide: . Sum: . Sense-check passes, so the row is ready for the teleport update.
Never divide by in-degree or by at this stage. The divisor is the row out-degree. Dividing by column totals or by page count breaks the row-sum rule and every later iteration.
Exam note: Write , show the halves and the thirds, and verify each row sums to .
14.6.5 Sparseness of Real Matrices
Why does size change the algorithm, not just the wait? Because real link tables are almost all zeros.
Two facts dominate real use. First, dimensions are huge, with millions of rows and columns on the web. Second, most real matrices are sparse, meaning zeros outnumber nonzeros by far. A page links to a handful of targets out of millions, so each row holds a few ones among millions of zeros. Even the tiny six- or seven-document demo looks sparse, with far more zeros than ones. Any ranking method must handle that sparseness wisely rather than assuming dense tables.
A sparse matrix (a table where stored nonzeros are far fewer than zeros) is kept as adjacency lists of out-neighbours, not as a full grid. Power iteration then touches only existing edges per round, giving cost linear in edge count rather than quadratic in .
Picture the seven-by-seven grid with ones inked. Only a scattering of cells is filled. Now stretch that picture to a million by a million with the same handful per row: the ink becomes dust. The takeaway: dense storage and dense multiplies are impossible, sparse passes are mandatory.
Scope: Sparse methods assume the edge list fits the access pattern of repeated row passes. They break when random access to arbitrary entries is needed per step. Ranking iterations respect the assumption because each round scans rows in order.
Sparseness forces list-based storage and edge-linear iteration. The demo sparsity previews the web-scale constraint.
14.6.6 Student Questions and Answers
Q: What labels sit next to documents along with inlinks and outlinks in the demo?
A: Car brand names used as anchor text. For PageRank scoring in this step they are noted but not used. Only the link entries feed the matrix. The brand words matter for anchor indexing and for the jaguar-style weighted demo elsewhere, but the plain PageRank pass reads pointers alone.
Q: If can be in either or , what is the chance?
A: Fifty percent each. The row has two ones, so each entry becomes one half after dividing by the out-degree of two. In symbols , and the row sums to .
Q: If can go to , , or , what is the chance?
A: About thirty-three percent each. Three outlinks split the row probability into thirds, so . The three slices sum to .
Q: Does the matrix hold more numbers or more zeros?
A: More zeros. Most real matrices are sparse, with zeros far outnumbering ones, so methods must be built for sparse, high-dimension tables with edge-linear passes rather than dense grids.
Exam note: Expect a small matrix task where a link table must first be turned into row probabilities before any ranking iteration: mark ones by outlinks, divide each row by its out-degree, check row sums.
14.7 Dead Ends, Ergodic Condition and Teleporting
14.7.1 Why Long-Term Visits Need More Than a Plain Chain
What stops the surfer from getting stuck? Nothing in the plain chain, which is why the plain chain is not enough.
The goal is a long-term visit rate for a page (the steady fraction of steps the surfer spends on over many steps, written ). That rate is not a single visit but a settled share, such as spending percent of all steps on one page. A plain Markov chain is not enough on web graphs because of dead ends and traps.
Picture four pages where , , and all point to and points nowhere. A surfer who reaches gets stuck, with no outlink to follow and no row that sums to one. On the real web the same shape arises naturally. Many pages may point to one famous article while that article points to few or none, such as a widely cited reference that itself cites nobody. Without a fix, no steady rate exists, because mass piles into the trap and never leaves.
Dead ends break stochasticity: a row of all zeros cannot sum to . Spider traps break mixing: a group with outlinks only inside itself keeps the surfer circling inside. Both break convergence to a unique steady vector, so the chain must be repaired before iteration.
The fix uses ergodic chains. An ergodic chain (a Markov chain in which every page can reach every other page by some path and the walk is not locked into a fixed repeating cycle) guarantees a unique steady state. A chain counts as ergodic when it is both irreducible and aperiodic. Irreducible (every page can reach every other page by some path, with positive chance after enough steps) means no isolated corner or dead end survives. Aperiodic (the walker is not forced into a fixed repeating cycle) means the walk is free to leave a loop such as to to to and visit elsewhere. A triangle to , to , to is welcome as local shape, but the walker must not be locked into visiting those partitions in strict rotation forever.
Imagine a theme park with one exit-free dead-end alley and one three-ride loop that forces ride order , , , . Visitors jam the alley or spin the loop forever. Adding free shuttle jumps to any ride breaks both jams. Teleporting is that shuttle.
Scope: Ergodicity is the licence for a unique steady rank. It assumes the repaired chain keeps the original link signal dominant while adding just enough jumping to connect everything. Too much jumping washes out link differences. Too little leaves traps intact.
Worked sketch — trap mass. With and dead, start surfers spread evenly. After one step, all surfers on move to , joining those already there. At they stop, so the next step is undefined and mass never returns. Sense-check: no steady share exists without an escape, since absorbs everything.
Do not confuse a self-loop with a fix. A self-loop at lets the surfer stay but never leave, so the trap persists. Only jumps to outside pages restore reachability.
Dead ends and closed loops block a steady visit share. Irreducibility plus aperiodicity, jointly called ergodicity, is the condition that restores it.
14.7.2 Teleporting With Damping Factor Alpha
How does a single number unstick every trap at once? By giving the surfer a small jump chance on every step.
Think of a reader who mostly follows links but sometimes types a fresh address into the address bar. That occasional fresh start is teleporting: a jump without following a path.
Teleporting gives the walker a way out. The everyday sense of the word applies: jump without following a path. Let be the damping factor (the chance of following a real outlink, here ). Let be the teleport chance (the chance of jumping elsewhere, here ). Let be the total page count, a positive integer, here . Described in words as alpha times actual probability plus one minus alpha divided by N, the updated entry from page to page is:
Here is the old row probability from the probability matrix, and is the new teleport-adjusted chance. Each row still sums to 1 because .
Two paths now join every pair. One path uses the link with weight . One path uses teleport with weight . Teleport applies to all targets, including pages that already have a direct link. That last point caused confusion and was stressed twice: even a linked target gets both the link share and the teleport share, so linked entries are while unlinked entries are pure teleport-share.
With teleporting in place, the walker cannot get stuck at one end, because every row gains a positive jump to every page. The adjusted table can then meet the irreducibility and aperiodicity needs for a steady rate: every page reaches every other page in one jump, and self-teleport breaks strict cycles.
Note on notation for readers of the reference book: the book writes teleport chance as its own parameter and link-following chance as one minus that parameter, with a typical teleport value . The lecture flips the name, calling link-following chance with a typical value . The maths matches once names are mapped: lecture equals book , and lecture equals book teleport-prob. Keep the lecture form for exam answers.
Scope: Teleporting assumes uniform jumps to all pages. It fits general web search with no topic focus. Topic-specific ranking replaces uniform jumps with jumps biased to a chosen set, which changes the steady vector toward that topic.
Worked row check. Take a row with old chances and , , teleport share . New linked entries: each. New unlinked entries: each. Row sum: . Sense-check passes.
The top slip is giving teleport only to unlinked pages. Every target gets the teleport share, linked or not. Skipping the linked target understates its entry and breaks the row sum.
Exam note: Write the teleport update, name , , , , and , and state that teleport covers all targets including linked ones.
14.7.3 Worked Teleport Numbers on Seven Documents
Numbers fix the rule better than words. With and , every entry can be computed by hand.
Take with documents through . Described in words as one minus alpha divided by N, the per-target teleport share is:
The value is added to every cell. Link weight multiplies only the old probability. That split is what keeps rows stochastic while preserving link differences.
For to , where a direct link exists with , the new entry adds both shares:
Where has no link, with , only teleport remains:
Row is therefore , which sums to .
For a row such as where the old chance was on two targets, the update is:
Row becomes , summing to . For with three old thirds of about , each linked entry becomes , shown as in the reference table, while unlinked entries stay .
Repeat for every row. The result is a full teleport matrix where every entry is positive and each row sums to 1. That full positivity is exactly irreducibility in numbers: every page can now reach every other page in one step.
A common mix-up is whether to divide by six or seven when a link already exists to one target. The answer used here is seven. All documents count, including the linked one, because teleport can land anywhere, even on the current page itself with chance .
Scope: The , , , pattern is tied to and . Changing either input changes every entry. Always recompute the teleport share first, then apply the link-plus-teleport rule per cell.
Worked verification — textbook match. The reference table for teleportation rate shows the same row patterns: for single-outlink rows, pairs for two-outlink rows, triples for three-outlink rows, elsewhere. The seven-document PageRank vector built from that table is . Matching the table cell by cell confirms the hand arithmetic before iterating.
Do not round the teleport share early and carry the error. Keep exact here, then multiply and add. Early rounding of thirds to is safe only when the final check is row sums to within rounding tolerance.
Exam note: Show the teleport share, the linked case, the unlinked case, and the half-split case, each with multiply-then-add steps and a row-sum check.
14.7.4 Textbook Form With Outlinks in the Denominator
Why do two books show different teleport equations for the same numbers? Because they start from different input tables.
Some books write the same update from the link matrix directly. Let be the link entry and the out-degree. Described in words as alpha times link entry over out-degree plus teleport share, the book form is:
The fraction is exactly . The book form builds probabilities inside the teleport step. The lecture form assumes probabilities were already built and writes . Both give the same number for the same , , , and .
For , the two ones divided by out-degree two give each, which is exactly the used above:
The two forms match. One starts from link counts and divides by out-degree inside the equation. The other starts from the probability matrix where that division is already done. Do not treat the missing denominator as an error. It reflects which table is used as input.
Picture the pipeline as three trays. Tray one holds with zeros and ones. Tray two holds with row fractions. Tray three holds with teleport added. The book form jumps from tray one to tray three in one line. The lecture form steps from tray two to tray three. The takeaway: match the equation to the tray you were given.
Scope: Use the book form when the question gives a link matrix or adjacency. Use the shorter lecture form when it gives a probability matrix. Mixing them, such as dividing by out-degree twice, halves the link share by mistake.
Exam note: If a question gives a link matrix, divide by out-degree first or use the book form with out-degree in the denominator. If it gives a probability matrix, use the shorter alpha-times-probability form. State which input you started from.
14.7.5 Student Questions and Answers
Q: Does the teleport chance also cover jumping to a linked page, or only to unlinked pages?
A: It covers all pages. From to with no link, the chance is pure teleport, . From to with a link, the chance adds link share plus teleport share, . With four total pages the teleport share per target would be one minus alpha divided by four, applied to all four including the linked one. The stressed point is that teleport can land anywhere, even on the current page.
Q: At a non-dead end is the link rate 10 percent and the teleport rate 90 percent, or the other way round?
A: The link path carries alpha and teleport carries one minus alpha. With alpha at , the link share is and the teleport share pool is split across , so each target gets . The confusing line about a 10 percent jump to a random page mixes two ideas: following links most of the time with chance alpha, plus a small jump chance spread over all pages with total . Think of two ways to move: by link with alpha, and by teleport with one minus alpha over .
Q: What exactly is the teleporting rate, one minus alpha or alpha?
A: One minus alpha in total, split as one minus alpha over per target. Alpha stays with the link-following path. With , teleport total is and per-target share with is .
Q: For with seven documents, is the divisor six because one link already exists?
A: No, it is seven. Teleporting is possible to a linked document too, so all seven documents count. One minus is , and over seven is per target. Dividing by six would drop the linked target from the jump set and break the row sum.
Exam note: Teleport share goes to all pages including linked ones. Dividing by or skipping the linked target is wrong. Rows of any probability or teleport matrix sum to ; use that to check arithmetic.
14.8 Power Method and Steady-State PageRank Computation
14.8.1 State Vector, Next State and Pi Vector
The teleport table is built. How does a table become a rank per page? By flowing probability through it until the flow stops changing.
Picture coloured water split among seven buckets joined by pipes of different widths. Each minute the water redistributes through the pipes. After many minutes the level in each bucket stops moving. Those settled levels are the steady shares.
Only the matrix exists so far. The next goal is the steady state. Let be a row state vector (one probability per document with entries in that sum to 1, written at step ). Let be the teleport matrix with entries . Described in words as next distribution equals current vector times probability matrix, the one-step update is:
Here is the distribution at step and is the distribution at the next step. Each row of says where the surfer can be next and with what chance. Multiplying the current share vector by the table pushes shares forward one step: entry of sums over all the mass times the jump chance .
The update is linear and shape-checked: a row times an table gives a row. Entry by entry, . Because each row of sums to and sums to , the next vector also sums to , so it stays a valid distribution.
Repeat the multiply: , then , then , and so on through steps, which is . When step and step no longer differ within tolerance, stop. That frozen vector is the steady-state vector, written . A steady-state vector (the distribution that no longer changes under the update, with each and ) satisfies:
Each entry is the long-term visit rate of document . Higher means higher rank. This repeated multiply-until-frozen method is the power method. It works regardless of the starting vector, because the matrix keeps reshaping the scores toward the same steady point when the chain is ergodic. In eigenvector language, is the principal left eigenvector of for eigenvalue .
Visualise convergence with iteration on the horizontal axis and each trace on the vertical axis. Early steps swing widely. Later steps flatten toward horizontal lines. The takeaway: differences shrink each round until all traces run flat.
Scope: The power method assumes an ergodic teleport matrix with a unique steady state. It converges from any valid start under that condition. It stalls or splits without teleporting on trapped graphs, which is why the teleport repair must come first.
Worked shape check. With , sums to . After one multiply by a stochastic , the result still sums to , as the two-document trace and will confirm. Sense-check every iteration by summing: any row that drifts from signals arithmetic error.
Do not change the matrix between steps. The teleport table stays fixed. Only the state vector updates. Recomputing per round or reapplying damping per round double-counts teleporting.
Exam note: Write both lines and , define and , and state the stop rule that and match.
One-line recap: push a share vector through the fixed teleport table until it freezes, and the frozen shares are the ranks. The two-page hand run makes that concrete.
14.8.2 Two-Document Worked Computation in Full
Hand arithmetic cements the method. Two pages and a fixed table are enough to see every multiply and add.
Use a tiny teleport matrix for documents and :
Described in words as probability 0.1 from document one to itself, 0.9 from one to two, 0.3 from two to one, and 0.7 from two to itself, this table is already teleport-adjusted. Each row sums to : and .
The entry is read as from row to column . Column collects arrivals at . Column collects arrivals at . The next share at is the weighted sum down column with current shares as weights.
Pick a starting vector . This is a valid distribution with entries in summing to ; it places all mass on at the start. A one-by-two vector times a two-by-two matrix gives a one-by-two vector.
First iteration, described in words as zero times 0.1 plus one times 0.3 for the first entry, and zero times 0.9 plus one times 0.7 for the second:
Step by step: , , sum for . For , , , sum . Check: . Ranks after step one are 0.3 for and 0.7 for , so leads.
Second iteration, described in words as 0.3 times first column plus 0.7 times first column for entry one, and the same mix on the second column for entry two:
Work the numbers. For entry one, and , so . For entry two, and , so . Hence:
Check: . The vector moved from toward , with still ahead.
Keep multiplying the fresh vector by the same fixed matrix. The teleport matrix never changes. Only the state vector changes. After step two the vector is . After step three and later steps the values keep adjusting by small amounts, closing toward . After steps the and vectors match within tolerance. The frozen result here is:
Verify the freeze directly:
Both entries reproduce, so holds. So has long-term rate 0.25 and has 0.75. Show first and second, because higher score means better rank.
Scope: The freeze belongs to this specific . A different table gives a different freeze. The method generalises; the numbers do not transfer.
Worked cross-check — solving directly. Let . The freeze condition on the first entry gives . Then , so and . This matches the iteration limit. Sense-check: the algebra and the repeated multiplies agree, confirming the power method found the true steady state.
Do not start with or . Neither sums to , so neither is a distribution. Any valid start such as or reaches the same freeze, but invalid starts break the probability meaning from step zero.
Exam note: Be ready to do two or three power-method steps by hand on a two-by-two teleport matrix, showing each multiply and add without skipping, checking row sums, and identifying the higher entry as the better rank.
14.8.3 Practice Matrix for Home Use
A second tiny teleport matrix is set for home practice:
Described in words as 0.7 self-loop on document one, 0.3 from one to two, 0.2 from two to one, and 0.8 self-loop on document two, this table already includes damping, so no extra alpha step is needed. Each row sums to .
The task is to count steps to freezing from two starts. Start once with and again with . Never start with or , which are not valid distributions because their entries do not sum to . Count how many iterations each start needs to freeze within the same tolerance. The target answer is the value and the frozen pair, which must match across both starts.
Try the first step from to fix the pattern: . From the first step is . Continue with the same fixed table until successive vectors agree. The freeze must satisfy with entries summing to .
Scope: Iteration count depends on the stopping tolerance. Fix the tolerance first, such as changes below , then count. Comparing counts across starts needs the same tolerance for both runs.
Exam note: State the valid-start rule, show one full multiply-add per iteration, and report both the freeze and the step count .
14.8.4 Student Questions and Answers
Q: Is the starting vector always zero comma one, or can it be anything?
A: It must be a valid distribution, with entries in summing to , not all zeros and not all ones. Both zero comma one and one comma zero are fine, as is any random valid vector such as . Any valid start works because the fixed teleport probabilities adjust the scores over steps toward the same steady point, provided the chain is ergodic.
Q: At step do we multiply the fresh vector zero point three and zero point seven by the same matrix?
A: Yes. The teleport matrix with , , , and stays fixed for every step. Only the state vector updates, from to to and onward. That fixed-matrix repeated multiply is what moves ranks toward steady values without re-estimating jump chances.
Q: Where did the damping factor go during the repeated multiplies?
A: It is already inside the teleport matrix. The flow used three tables in order: link matrix , then probability matrix , then teleport matrix with folded in. The power method runs only on the teleport matrix , so no separate damping multiply is needed per step. Reapplying alpha each round would shrink link shares twice.
Exam note: If asked where alpha lives during iteration, answer inside : the three-tray order is link, probability, teleport, and iteration touches only the last tray.
14.9 Seven-Document PageRank Result, Query Timing and Limits
14.9.1 Thirteen Iterations to a Frozen Vector
What does the full seven-page run produce after the teleport table is iterated to stillness? One frozen share per page.
Think of the seven buckets again, now with the real pipe widths from the demo graph. After thirteen rounds of redistribution the water levels stop moving. Reading those levels from to gives the final order.
Return to the seven-document network. The probability matrix was built first from out-degree division. The teleport matrix with damping was built next with added to every cell. The power method then ran on that teleport matrix from a valid start, reusing the same each round.
It took 13 iterations to freeze. From iteration 11 to 12 only one document value changed within tolerance. From iteration 12 to 13 nothing changed. The frozen vector, in order through , is:
Each is the long-term visit rate of document , and the seven entries sum to : before rounding, which is up to the two-decimal display. The top rank is at . The next are at and at . The lowest ranks are and at each, with at just above them.
The order makes sense against link shape. Document has three inlinks and two outlinks. Many pages point to it and it points onward, so a random surfer lands there often and can also leave, which keeps its share high without trapping. Pages with few inlinks sit at the bottom, because the surfer rarely arrives except by teleporting. The reference table for teleportation rate reports the identical vector, which confirms the hand-built before iteration.
Picture the result as bars. Put document index to on the horizontal axis and steady share on the vertical axis. The bar at stands tallest at . Bars at and are stubs at . The takeaway: inlink-rich plus well-connected pages dominate the skyline.
Scope: The thirteen-step count belongs to this graph, this , and the chosen tolerance. A stricter tolerance needs more steps. A larger teleport share needs fewer steps but flattens differences. Report count and tolerance together.
Worked ranking — reading the order. Sort the frozen shares from high to low: , , , , , , . Display first and with tied last. Sense-check: the order follows inlink strength tempered by outlink flow, not raw in-degree alone, since both receives and passes on traffic.
Do not stop at partial freezing. One unchanged entry between rounds 11 and 12 did not mean convergence. Only the full-vector freeze at round 13 counts, because a single settled page can still shift once its neighbours settle.
Exam note: Quote the frozen vector in to order, name best and with worst, and note the 13-iteration path with the 11-to-12 partial change.
One-line recap: thirteen passes turn the teleport table into a settled order topped by the well-linked . That order is computed before any query arrives.
14.9.2 Query-Independent Scoring and Final Blend
When is PageRank computed: before the user types or after? Before, on a schedule, then blended after.
PageRank is computed before any query arrives. It is query-independent link analysis: the same serves every query until the next refresh. The engine refreshes page ranks on a schedule, stores them, pulls back documents relevant to the new query through the text index, and then re-ranks that relevant set. The re-rank blends PageRank with query-document relevance, freshness, user-specific scores, and related signals, with strong weight on PageRank. The ranked list the user sees reflects that blend, not PageRank alone.
Two clocks run at different speeds. The slow clock recomputes over the whole graph offline. The fast clock answers each query by fetching and sorting it with . Link strength is precomputed. Relevance and personal parts are per-query.
Think of restaurant ratings printed monthly in a guide plus daily specials chosen per diner. The guide rating is PageRank: stable and shared. The final plate order adds hunger, season, and taste. The analogy breaks where freshness dominates: a breaking-news query flips the blend toward recency even when the guide still crowns an old page.
Scope: Offline precomputation assumes the graph changes slowly relative to the refresh cycle. It lags breaking events and fresh pages, which is why freshness boosts and incremental updates join the blend rather than replacing it.
Exam note: Contrast timing in one line: PageRank query-independent and precomputed, final ranking per-query blended with relevance, freshness, and user signals.
One-line recap: slow global ranks plus fast per-query blending give the displayed list. Link-only shares then hit two clear limits.
14.9.3 Limits of Link-Only Scoring
What can link counts never know? What is new and what the words mean.
Two limits motivate the next method. First, scores do not reflect current events. Suppose a major earthquake happened a day or a week ago. A fresh article from ten minutes, one hour, or ten days ago should outrank a five-year-old article on an older quake. But the old page has lived on the web longer and gathered many inlinks, so link-only scoring favours the old page over the fresh, more needed one. Age accumulates endorsement while recency starts near zero, so history beats urgency without a freshness correction.
Second, link shape cannot read natural-language queries. A query such as why is my laptop battery draining quickly asks about cause, linking draining to background apps or ageing cells. A query about latest updates asks about recency. Pure link counts carry no reading of draining, latest, or why, because arrows record that pages connect, not what the asker wants from them. Link structure is highly useful but not sufficient alone.
The two gaps are time-blindness and language-blindness. Time-blindness overranks old highly linked pages for breaking topics. Language-blindness underranks pages that answer the intent without matching link-heavy phrasing. Both are repaired outside the link table: freshness boosts for the first, query-text and anchor matching for the second.
Freshness boosts for breaking news and language-aware matching sit alongside PageRank to cover these gaps in production. The earthquake case gets a recency lift that outweighs stale inlink mass. The battery-draining query gets intent matching that links cause-words to fix-words even when the best page has modest in-degree.
Scope: Freshness and language fixes assume reliable timestamps and readable query intent. They misfire on undated pages and on vague queries, where link strength remains the safer signal. The blend must shift weight by query type rather than fixing one recipe.
Worked contrast — quake ranking. Old quake page: , freshness near . Fresh quake page: , freshness high. Link-only order puts the old page first. Blended score with a strong freshness term reverses them for an earthquake-yesterday query but keeps the old page first for a quake-history query. Sense-check: the same two values yield different orders under different intents, which proves rank cannot be link-only.
Do not dismiss PageRank because of these limits. It remains the stable quality prior. The lesson is addition, not replacement: keep the link prior and add time plus language on top.
Exam note: Give both limits with examples: stale highly linked earthquake pages outranking fresh breaking pages, and link counts unable to read why or latest in battery-draining queries.
14.9.4 Student Questions and Answers
Q: Which documents rank best and worst in the seven-document result?
A: Document six is best at and is shown at the top of the list. Document one and document five tie for worst at each. The middle order is at , at , at , and at .
Q: Is PageRank applied before the query or after the query?
A: Before. PageRank is query-independent link analysis computed on a schedule and stored. After a query arrives, the engine pulls relevant documents and re-ranks them with PageRank plus relevance, freshness, and user-specific scores. That before-versus-after timing is the core contrast with the next method.
Exam note: Answer timing questions with the two-clock picture: slow offline PageRank, fast per-query blended re-rank.
14.11 HITS Worked Iterations, Convergence and K-Means Contrast
14.11.1 First Iteration From All Ones
What do hub-authority updates give on round one when nothing is known yet? Simple degree counts.
Starting from all ones is like giving every page one token of trust. Round one then counts how many tokens each page collects from its neighbours: in-neighbours for authority, out-neighbours for hubs.
Start all hub and authority values at 1 for pages through , since no old scores exist yet. New authority for a page sums hub values of its in-neighbours. New hub for a page sums authority values of its out-neighbours. With all ones, the first pass simply counts degrees: authority equals in-degree, hub equals out-degree.
For page , inlinks arrive from , , and , so:
For page , five inlinks arrive, so . For page on the hub side, only one outlink leaves, so . For page with two outlinks, . For page with one outlink, . The same count repeats for the rest: each authority is its in-degree, each hub its out-degree.
Round-one rule from unit starts: and . No weighting yet, because every neighbour contributes exactly . Weighting enters from round two once shares differ from one.
Totals after round one are 15 for authorities and 15 for hubs. The authority total is the edge count counted by heads. The hub total is the same edge count counted by tails. Described in words as running sums that reach fifteen, the normalisation divides every authority score by 15 and every hub score by 15. So , , , , and similarly for the rest.
Picture round one as two bar charts. Authority bars match in-degree heights, tallest at with . Hub bars match out-degree heights, tallest at the page with four outlinks. The takeaway: structure alone, without prior reputation, already separates likely makers from likely guides.
Scope: Degree-equals-score holds only for round one from all-one starts. From round two the same neighbour sums use normalised shares as weights, so counts become weighted sums. Quoting degrees as final scores mistakes the start for the finish.
Worked check — totals. Summing in-degrees over through must equal summing out-degrees, since both count the same arrows. Here both reach . Dividing each raw score by gives shares that sum to per role. Sense-check: if the two totals ever differ, an inlink or outlink was missed in the count.
For authority always pull from hub neighbours. For hub always pull from authority neighbours. Mixing the two, such as summing authority shares to update authority, is the most common slip and corrupts round two onward.
Exam note: For authority pull hub scores. For hub pull authority scores. Round one from ones gives in-degree and out-degree with totals 15 and 15, then shares over 15.
One-line recap: ones turn the first pass into degree counting. Weighted sums take over from round two.
14.11.2 Second Iteration With Weighted Sums
How does round two differ? Same neighbour sets, but neighbours now carry unequal shares.
Round two uses the normalised round-one scores as weights. For , inlinks still come from , , and , but now their hub weights are , , and . Described in words as sum of hub shares of in-neighbours, the new authority is:
Round-two authority is a weighted in-degree: each in-neighbour contributes , not . Round-two hub is a weighted out-degree: each out-neighbour contributes . Strong neighbours now count more than weak ones, which is the reinforcement that raw degrees lack.
For , inlinks come from and . Pull hub shares, not authority shares, giving plus style terms that total . So before normalisation. For with five in-neighbours, the hub shares add to . So raw. The same pattern covers the rest: list in-neighbours, look up their hub shares, add.
Hub updates flip the source. For with one outlink, take the authority share of its target, which is . So raw. For with its out-neighbours, add authority shares such as plus to reach . So raw. Repeat for all pages: list out-neighbours, look up their authority shares, add.
Now normalise again. The authority total this round is . Described in words as each raw authority divided by thirty-five over fifteen, an example is:
The division cancels the : . Numerically .
The hub total is . Described in words as each raw hub divided by forty-five over fifteen, an example is:
Again . Every other page follows the same divide-by-total step, giving per-role shares that sum to .
Scope: The , , raws and the , totals belong to this -through- graph. A different graph gives different fractions. The reusable part is the two-step rhythm: weighted sum, then divide by column total.
Worked verification — B authority. In-neighbours of are and with round-one hub shares and . Sum: . Normalise: . Sense-check: sits below at but above at , matching the in-neighbour strength order.
Do not normalise authorities by the hub total or hubs by the authority total. Each role divides by its own column total: authorities by , hubs by in this round. Crossing totals mixes the two lenses.
Exam note: Practise the , , second-round authorities , , with normalisation, plus hub terms such as with normalisation.
One-line recap: round two replaces unit votes with share-weighted votes, then rescales to shares again. Those shares still need many rounds to settle.
14.11.3 Convergence, Cost and Final Ranks
When can iteration stop? Only when the full tables stop moving, not when a few entries pause.
After two rounds the scores have not frozen. Authority and hub tables at round four and round six show gradual settling. By round six, pages , , , , and look stable, with repeated values such as 0.6 style entries and 0.111111 style entries on one side, while , , and still move on the authority side and , , and still move on the hub side. Freezing only part of the table is not convergence. The process must continue until the full tables stop changing within tolerance for both roles.
Convergence means and both fall below tolerance across all pages. Partial stillness is a mid-point, not the fixed point. The underlying reason the full freeze exists is the eigenvector structure: iteration is power iteration on for authorities and for hubs, which settles when the principal direction dominates.
Convergence does arrive, around the twelfth iteration in the extended trace for node and its peers. Both hub and authority columns settle at that point. The method stays fast because each step is only addition along edges. Described in words as sum hubs for authorities and sum authorities for hubs, the per-round cost is linear in edge count , so many rounds remain cheap and the turnaround stays quick even in a notebook that loops repeatedly. No matrix inversion or dense multiply is needed.
Final ranks split by role. On authority, node stands highest because the most inlinks point to it, with five in-neighbours feeding it the largest weighted sum, and comes next. On hubs, node stands highest because it carries four outlinks, more than any peer, so it accumulates the largest authority-weighted sum. If the need is the best authoritative source, rank by authority and place first. If the need is the best pointer page that links to many authorities, rank by hubs and place first. The split is deliberate: keep the two lenses separate and choose based on the task.
The six-document textbook trace tells the same story from the other side. Document six carries the top PageRank and lines up with hub strength, while its authority score stays low. Document three carries high authority through many inlinks. PageRank alone would crown document six. An authority need would crown document three instead, which proves one score cannot serve both needs.
Picture convergence with iteration on the horizontal axis and share on the vertical axis for nodes , , . Early rounds swing. Middle rounds narrow. Late rounds run flat after about twelve passes. The takeaway: patience to round twelve buys stability that round two cannot show.
Scope: Twelve rounds belongs to these demo graphs and tolerance. Larger bases need their own stopping check. The portable rule is full-table stillness, not a fixed round number.
Worked reading — role split. Authority order starts then , driven by inlink weight. Hub order starts , driven by four outlinks. A query for the best source returns . A query for the best reading list returns . Sense-check: the two answers differ by design, so returning one list for both tasks would hide the better answer for one of them.
Do not report hub ranks when asked for authorities or vice versa. The six-document case is the trap: PageRank-best equals hub-best on document six, but authority-best is document three. Reading the wrong column flips the answer.
Exam note: Know what convergence means (full-table freeze), why cost stays low (additions linear in edges), and who leads each role ( authority, hub; six-doc split with six on PageRank-hub and three on authority).
One-line recap: iterate weighted sums to full stillness around round twelve, then read makers and guides from separate lists. A different iterative loop clarifies what is shared and what is not.
14.11.4 K-Means Contrast
Why compare link iteration with clustering? Because both loop until nothing changes, yet update nothing alike.
Think of two games that both end when nobody moves. In one game players pass tokens along roads. In the other game players walk toward flags and flags move to the middle of their crowd. Same stop rule, different moves.
A question linked HITS iterations to cluster finding. The shared trait is real: both loop until nothing changes. The mechanics differ. HITS sums neighbour scores along links. K-means measures distances to centres and averages coordinates.
K-means works like this on a toy set with points , , , , and and two centres in blue and in green:
- Pick random points as starting centroids and .
- For each data point, measure distance to and to , written versus , and assign the point to the closer centre. Suppose round one gives cluster one as and cluster two as .
- Recompute each centroid as the mean of its members. Let and be member coordinates in a flat Cartesian plane. Described in words as average of x plus average of y, the new blue centre over two points is:
The centroid is the coordinate mean. For two members divide summed coordinates by two. For three members divide by three: . Assignment uses closeness in space. Refresh uses averaging in space. No graph edges are involved.
For three members divide by three. The fresh lands between and . The fresh lands among , , and . Round one ends only after both assignment and centroid refresh; half a round does not count.
Round two remeasures from the new centres. Point may now sit closer to the blue centre, giving versus . Refresh means again: sum the three for and divide by three, sum the two for and divide by two. Round three remeasures. If assignments no longer shift, centroids no longer shift either. With holding and holding unchanged from the prior round, stop and call the clusters final.
HITS sums neighbour scores along links. K-means measures distances to centres and averages coordinates. Both stop at no-change, but the update math and the data shape are different: graph reinforcement versus spatial regrouping.
Scope: The comparison covers loop shape only. HITS needs a graph with directed edges. K-means needs points in a space with distances and means. Swapping inputs breaks both: links have no centroids, points have no in-neighbours.
Worked tiny numbers — centroid. Suppose and share blue. Then , the midpoint. Suppose , , share green. Then . Sense-check: each fresh centre sits inside its crowd, ready for the next assignment pass.
Do not call HITS centroids or K-means hubs. The words belong to different structures. The safe shared word is iteration to stability, with per-step maths stated separately.
HITS iterates neighbour sums to maker-guide stability. K-means iterates assign-then-average to cluster stability. Shared stop idea, disjoint step maths.
14.11.5 Student Questions and Answers
Q: For node with two outlinks, is the hub score two?
A: Yes. Hub sums authority neighbours over outlinks, so with two outlinks from all-one starts the hub total for is . Authority for a page such as with five inlinks is for the same reason. Both are round-one degree counts before weighting begins.
Q: For node authority from and , is it one over fifteen plus one over fifteen?
A: Not quite. Authority must pull hub shares, not authority shares. The hub shares of and give terms such as four over fifteen and two over fifteen, totalling six over fifteen: . Keep the source straight: authority from hubs, hubs from authorities. Using authority shares here is the classic source swap.
Q: For node authority with five in-neighbours, is it twelve over fifteen?
A: Yes. Add the five hub shares of its in-neighbours. That weighted sum is twelve over fifteen () before the round-two normalisation by , giving . The count of terms is five, but the values are shares, not ones.
Q: For node hub with one outlink, is it two over fifteen?
A: Yes. Take the authority share of its single target, which is two over fifteen (). After hub normalisation by forty-five over fifteen, that becomes two over forty-five: . One outlink means one term, weighted by the target authority share.
Q: Is this iteration like cluster finding with centroids?
A: Only in the loop-until-stable shape. HITS adds neighbour hub and authority scores along inlinks and outlinks, with cost linear in edges. K-means assigns points by minimum distance to centroids such as minimum of distance from to and distance from to , then recomputes centroids as coordinate means such as . The convergence idea matches. The per-step maths does not: sums along links versus distances plus averages in space.
Q: From an exam view, must we run six or twelve iterations by hand?
A: No. The long traces to round six and round twelve show what the method does behind the scenes until it settles. A hand task would ask for one or two rounds with normalisation, plus which pages lead on hub versus authority. The reply given was that six full rounds will not be demanded by hand. Practise the through first round and the , , second-round authorities and hubs with normalisation, plus the six-document comparison where PageRank best matches hub best while authority best is a different page.
Exam note: Practise the through first round and the , , second-round authorities and hubs with normalisation. Also practise the six-document comparison where PageRank best matches hub best while authority best is a different page. For authority pull hub scores. For hub pull authority scores.
Exam Guidance Summary
- Expect a short matrix task: build a link matrix with for outlink and elsewhere, divide rows by out-degree to get , then apply with a given such as and giving per target, for single-link rows, and for half-split rows. Check every row sums to .
- Expect two or three power-method steps on a two-by-two teleport matrix such as rows and from start , reaching , then , and freezing at with ranked first. Show every multiply and add, verify , and never start from or .
- Expect a home-style twin with rows and from starts and , asking for iteration count to freeze within a stated tolerance. Report both and the frozen pair, which must match across starts.
- Expect HITS one-round counts on the through base: authority equals in-degree, hub equals out-degree, totals and , then normalised shares over . Second round for , , and with , , and style authority sums and normalisation giving , , , plus style hub terms with normalisation giving .
- Expect a contrast question: PageRank is query-independent and computed before the query over the whole graph, then used in per-query re-ranking with relevance, freshness, and user signals. HITS is query-dependent and computed after the query on root-then-base sets with iteration and normalisation.
- Expect anchor-text reasoning: why anchor words help ranking, with cheap-cars pointers and IBM home-page disambiguation (copyright, encyclopedia, home, IBM acquires a firm, IBM optics), plus how misuse yields Google bomb cases such as free learning, dangerous cult, who is a failure, and evil empire, and the 2007 weighing response that reduced but did not remove the attack.
- Expect limits of PageRank: stale highly linked pages outrank fresh breaking pages such as earthquake updates from ten minutes to ten days ago versus five-year-old pages, and link counts cannot read natural-language queries such as why battery drains quickly with draining, latest, and why.
- Expect lineage naming: Garfield (1955) to Pinski and Narin (1976) journal influence weight to Brin and Page (1998) and Page et al. (1998) with Larry Page and Sergey Brin, plus the Miller 2001 metabolism citation as an outlink example and co-citation similarity as joint citation by third papers.
Exam note: For authority pull hub scores. For hub pull authority scores. Swapping sources is the top slip.
Use the row-sum rule as a free arithmetic check on every matrix task before iterating.
Exam note: Teleport share goes to all pages including linked ones. Dividing by or skipping the linked target is wrong. Rows of any probability or teleport matrix sum to ; use that to check arithmetic.
Hand tasks reward one clean round over many rushed rounds, so practise normalisation until the divide-by-total step is automatic.
Exam note: Long six- or twelve-round HITS traces will not be demanded by hand. Know what full-table convergence means and how to do one clean round with normalisation.
Key Industry Applications
- Web search ranking blends PageRank with relevance, freshness, similarity, and user-specific signals, with strong weight on the link score. The slow offline PageRank clock plus the fast per-query blended re-rank is the production pattern behind every displayed list.
- Anchor text indexing improves target description, seen in cheap-cars pointers, bookstore and university anchors, and IBM query disambiguation across copyright, encyclopedia, and home pages plus IBM acquires a firm and IBM optics lines. Outside description fills gaps where page text uses marketing wording or image-only content.
- Adversarial search covers Google bomb anchor manipulation with noble words such as free learning, doorway single-word redirects that promise one topic and deliver another, and the 2007 weighing response that cut coordinated bombs quickly without ending malicious anchor use, with residual cases such as dangerous cult plus diffused cases who is a failure and evil empire.
- Prompt injection in chat models mirrors anchor spam, seen in 2022 email summarisation theft that redirected summaries to a competitor address through a hidden line, plus image frame-in-frame clock attacks and arithmetic jailbreak variants that bypass safety rules. Role separation between instructions and data is the shared defence direction.
- Citation and co-citation analysis from Garfield (1955) through Pinski and Narin (1976) underlies both paper similarity and web ranking, seen in the Miller 2001 metabolism citation case where the citing paper gives an outlink and the Miller paper gains an inlink. Joint citation by third papers signals topic closeness.
- Random-walk and walk-trap thinking links peak-hour road use, social network groups, recommendation networks, and surfer models for ranking. Traffic concentration on busy paths is the shared observation; group discovery versus page scoring is the split in use.
- Sparse-matrix handling is required because real link tables are huge and mostly zero, even in tiny seven-document demos. Adjacency lists with edge-linear power iteration replace dense grids at web scale.
- HITS two-score design serves different needs, with authority best for source pages such as node with five inlinks and hub best for pointer pages such as node with four outlinks, plus the six-document split where document six leads PageRank and hubs while document three leads authorities. Broad-topic search such as leukemia needs both lists.
IR Lecture 14 notes · Link Analysis: PageRank and HITS
Sections Breakdown
Directed web graph representation, in-degree and out-degree metrics, and label propagation under good and bad node assumptions.
Integration of query-independent link structure with textual relevance in retrieval pipelines.
Target description via hyperlink anchor text, anchor scoring models, and vulnerability to doorway pages and Google bombing.
Modern parallels between malicious anchor text manipulation and prompt injection attacks in language model pipelines.
Bibliometric lineage of link analysis from Garfield and Pinski-Narin citation indexing to PageRank.
Modeling the random surfer as a Markov chain, building adjacency and row-stochastic transition probability matrices.
Handling absorbing states and periodicity using random teleportation with damping factor alpha.
Iterative stationary distribution computation via power iteration until numerical convergence.
Seven-node convergence trace, offline precomputation workflows, and limitations regarding freshness and natural language queries.
Kleinberg's query-dependent HITS algorithm, constructing root and base subgraphs, and mutual authority-hub reinforcement.
Step-by-step numeric trace of HITS iterations with vector normalization, and structural contrast with k-means centroid updates.
Comprehensive review of key exam problem patterns, calculation traps, and core formulas.
Real-world implementations of link analysis across production search engines, recommender systems, and security.
Exam Revision Notes
Below is the distilled, exam-ready core. Every entry comes from the full explanation above. Use this section for rapid review; return to the main notes when a point needs more context.
Web as Graph and Good-Bad Propagation
Must-know: Web is a directed graph; outlink-to-bad makes source bad, inlink-from-good makes target good
⚠️ Top pitfall: Treating in-degree alone as rank; weak spam inlinks can outscore few strong inlinks
Self-check: Node X points to one good and one bad page. What label does X get and why?
Connects to: 14.2, 14.6
Search Flow and Ranking Goal
Must-know: Ranking orders the relevant set by blended document, freshness, and user scores
⚠️ Top pitfall: Equating retrieval membership with ranking position
Self-check: What is the difference between retrieval and ranking?
Connects to: 14.1, 14.9
Anchor Text, Doorway Pages and Google Bomb
Must-know: Anchor words describe the target and are added on top of page text; coordinated forgery yields Google bomb
⚠️ Top pitfall: Reading anchor text as source-page text instead of target description
Self-check: Why does the IBM home page rank for computer even when the word is missing on the page?
Connects to: 14.2, 14.4
Prompt Injection as Modern Anchor Misuse
Must-know: Prompt injection hides directives in data; 2022 email summary theft redirected output to competitor
⚠️ Top pitfall: Confusing prompt injection with cross-site scripting
Self-check: How does prompt injection mirror anchor spam?
Connects to: 14.3
Citation Analysis Roots of PageRank
Must-know: Pinski and Narin (1976) influence weight from Garfield (1955) reused by Brin and Page (1998); citation is an outlink
⚠️ Top pitfall: Presenting link-entry table L as final PageRank
Self-check: Who wrote the 1976 influence-weight study and who reused it for the web?
Connects to: 14.6, 14.10
Link Matrix and Transition Probability Matrix
Must-know: Link matrix ones by outlinks, then divide rows by out-degree; D1 halves, D2 thirds; real matrices sparse
⚠️ Top pitfall: Dividing by in-degree or N instead of row out-degree
Self-check: D1 links to D1 and D2. What are P11 and P12?
Connects to: 14.5, 14.7
Dead Ends, Ergodic Condition and Teleporting
Must-know: Teleport with alpha 0.86 and N=7 gives 0.02 per target; linked entries add both shares; ergodic needs irreducible plus aperiodic
⚠️ Top pitfall: Giving teleport only to unlinked pages or dividing by N-1
Self-check: With alpha 0.86 and N=7, what is P02' when P02=1?
Connects to: 14.6, 14.8
Power Method and Steady-State PageRank Computation
Must-know: Power method multiplies fixed P' until freeze; two-doc run 0.3/0.7 to 0.24/0.76 to steady 0.25/0.75
⚠️ Top pitfall: Changing the matrix each round or reapplying damping per step
Self-check: From X0=[0,1] on [[0.1,0.9],[0.3,0.7]], what is X1?
Connects to: 14.7, 14.9
Seven-Document PageRank Result, Query Timing and Limits
Must-know: Seven-doc freeze D6 0.31 top, D1/D5 0.04 bottom; PageRank query-independent then blended; stale-link and language limits
⚠️ Top pitfall: Stopping at partial freeze when one entry settles
Self-check: Which document ranks best in the seven-doc result and why?
Connects to: 14.8, 14.10
HITS Hubs Authorities Root Base Sets and Update Rules
Must-know: HITS keeps hub plus authority with mutual sums; root set from text search grown to base set; normalise each round
⚠️ Top pitfall: Swapping sources: authority from authorities or hub from hubs
Self-check: Does HITS run before or after the query and on what set?
Connects to: 14.9, 14.11
HITS Worked Iterations, Convergence and K-Means Contrast
Must-know: Round one degrees 15/15, round two A 4/15 B 6/15 C 12/15, freeze near round twelve, C authority E hub; K-means assigns by distance then averages
⚠️ Top pitfall: Reporting hub ranks for authority questions; PageRank-best matches hub-best not authority-best in six-doc case
Self-check: In round two, what is auth(A) before normalisation and after?
Connects to: 14.10
Exam Guidance Summary
Must-know: Matrix, power-method, HITS, timing, anchor, limits, and lineage tasks with row-sum and source-direction checks
⚠️ Top pitfall: Skipping row-sum checks on matrix tasks
Self-check: What are the two most-checked arithmetic rules across tasks?
Connects to: 14.6, 14.7, 14.8, 14.11
Key Industry Applications
Must-know: Link rank plus anchors plus freshness powers search; spam and injection are the adversarial mirrors
⚠️ Top pitfall: Using one score for both maker and guide needs
Self-check: Name one honest use and one attack use of anchor signals.
Connects to: 14.3, 14.9, 14.10
Was this lecture useful?
BitsNotes AI Assistant
Subject Notes AssistantConfigure AI Chat
Choose how to access the chatbotSigned in as
Powered by BitsNotes — 20 messages per day. No API key needed. Want unlimited access? Use "Bring Your Own Key" mode.
Sign in to use AI Chat
Get 20 free AI messages per day to ask questions about your lecture notes. Sign in with Google or GitHub — it takes 5 seconds.
Sign In to BitsNotesSwitch to "Bring Your Own Key" tab above for unlimited access with any OpenAI-compatible provider.