Level 2 · foundational · ~9 h
Power iteration PageRank on a Wikipedia link subgraph — real-data stress test
Build a directed link graph from a Wikipedia dump subset and compute PageRank by power iteration, tracking convergence and dangling-node handling. Repeat on a real dataset, report a table with confidence intervals over three trials, and explain which assumption broke.
Prerequisites
Problem statement
- 01Build a directed link graph from a Wikipedia dump subset and compute PageRank by power iteration, tracking convergence and dangling-node handling. Repeat on a real dataset, report a table with confidence intervals over three trials, and explain which assumption broke.
Real-world motivation
- 01PageRank is a large sparse eigenvector problem where the stochastic matrix and dangling nodes dictate correctness. The real-data stress test setting forces concrete choices about data, scale and evaluation.
Learning objectives
- 01Parse links into a sparse adjacency
- 02Construct the Google matrix
- 03Verify convergence and rank stability
- 04Report wall-clock seconds on one pinned CPU core alongside the baseline metrics.
Technical architecture
- 01sparse adjacency in CSR
- 02dangling-node correction
- 03power iteration with residual monitoring
Mathematical foundations
- 01$G=\alpha S+(1-\alpha)\frac{1}{n}\mathbf{1}\mathbf{1}^\top$
- 02$p_{k+1}=Gp_k$, convergence rate $\alpha$
Dataset and sources
- 01MNIST 70k subset
- 02UCI Sparse Matrix collection
Step-by-step tasks
- 01Frame the task and freeze the real-data stress test evaluation protocol with a fixed random seed.
- 02Implementation 1: Stream a 50k-page Wikipedia subset
- 03Implementation 2: Normalize outgoing links, add dangling rows
- 04Implementation 3: Iterate until L1 residual < 1e-8
- 05Verification 1: Verify p sums to one every iteration
- 06Verification 2: Check ranks against networkx.pagerank
- 07Run the ablation grid and report wall-clock seconds on one pinned CPU core over three independent trials.
Implementation requirements
- 01Stream a 50k-page Wikipedia subset
- 02Normalize outgoing links, add dangling rows
- 03Iterate until L1 residual < 1e-8
- 04Log all hyperparameters and the random seed for the real-data stress test run.
Testing requirements
- 01Verify p sums to one every iteration
- 02Check ranks against networkx.pagerank
- 03Measure wall-clock seconds on one pinned CPU core over at least three seeds.
Evaluation metrics
- 01L1 residual
- 02iterations to converge
- 03top-k rank overlap
- 04wall-clock seconds on one pinned CPU core
Expected outputs
- 01top-50 page table
- 02residual curve
Common failure modes
- 01spider traps concentrate all mass
- 02dangling nodes cause mass loss
- 03real data violates the synthetic noise model and the baseline overfits
Stretch goals
- 01implement personalized PageRank
- 02compare with HITS hubs and authorities
- 03profile the method with cProfile and report the dominant kernel
Research extensions
- 01study sensitivity to the damping factor
- 02derive convergence under node perturbation
GitHub submission requirements
- 01A repository whose README states the real-data stress test protocol and the exact command to reproduce it.
- 02Source for the scratch implementation, a test file, and a results table with uncertainty estimates.
- 03A two-page report explaining failures on MNIST 70k subset and what the ablation revealed.
Completion rubric
- 01stochastic matrix correct
- 02dangling handling correct
- 03residual-based stopping
- 04Extra credit: profile the method with cProfile and report the dominant kernel
Submit when every rubric item is satisfied and your repository contains runnable code plus a reproduction command.