The algorithm that launched Google — ranking pages by link importance
Imagine the internet as a giant map where every web page points to others (hyperlinks). Some pages are more important because many other important pages link to them. PageRank is the algorithm that measures this importance.
In this cipher, a small web graph is given. Each page has a label (an ASCII code). You run PageRank to find which pages are most important — the top-ranked pages in order spell the answer.
Page 0 → [1, 2] Label: 72 ('H')
Page 1 → [2] Label: 69 ('E')
Page 2 → [3] Label: 76 ('L')
Page 3 → [0] Label: 76 ('L')
Page 4 → [0, 1] Label: 79 ('O')
After PageRank (damping=0.85, 50 iterations):
Rank order: Pages 0 > 2 > 3 > 1 > 4
Top labels: 72, 76, 76, 69, 79 → HELLO
def pagerank(links, damping=0.85, iterations=50):
n = len(links)
rank = [1.0/n] * n
for _ in range(iterations):
new_rank = [(1-damping)/n] * n
for i in range(n):
if links[i]:
share = rank[i] / len(links[i])
for j in links[i]:
new_rank[j] += damping * share
rank = new_rank
return rank
pages = [...] # from puzzle data
ranks = pagerank([p['links_to'] for p in pages])
order = sorted(range(len(ranks)), key=lambda i: ranks[i], reverse=True)
answer = ''.join(chr(pages[i]['label_code']) for i in order[:5])
print(answer)
| Level | What Happens | Time Estimate |
|---|---|---|
| 1 | 4 pages, clear ranking | <10s |
| 3-5 | 6-8 pages, complex link structure | 20-40s |
| 6-7 | 10+ pages, near-dead-ends and rank sinks | 1-3m |