This project implements Google's PageRank algorithm using eigenvector computation via the power iteration method.
PageRank models the web as a directed graph where nodes represent pages and edges represent links. The ranking corresponds to the stationary distribution of a Markov chain, computed as the dominant eigenvector of the stochastic matrix.
- Graph Construction: Creates a small directed graph (10-20 nodes) representing web pages
- Link Matrix Construction: Builds the column-stochastic link matrix with damping factor
- Power Iteration: Implements the power iteration algorithm from scratch
- Convergence Analysis: Studies convergence behavior vs. tolerance and damping factor α
- Comparison: Validates results against scipy.linalg.eig and NetworkX PageRank
- Spectral Analysis: Analyzes eigenvalue spectrum and spectral gap
- Visualization: Comprehensive plots and graphs throughout
- Clone this repository
- Install required packages:
pip install -r requirements.txtOpen and run the Jupyter notebook:
jupyter notebook pagerank.ipynbThe notebook is organized into sections:
- Setup and Imports
- Graph Creation and Visualization
- PageRank Matrix Construction
- Power Iteration Implementation
- Convergence Analysis
- Comparison with Built-in Solvers
- Spectral Analysis
- Summary and Analysis
A comprehensive LaTeX technical report is available in the report/ directory. To generate the PDF:
# First, run the notebook to generate figures
jupyter notebook pagerank.ipynb # Run all cells
# Then compile the report
cd report
./compile_report.shSee report/README.md for detailed instructions.
- Power iteration converges efficiently for typical damping factors (α ≈ 0.85)
- Convergence speed is determined by the spectral gap (λ₁ - λ₂)
- Higher damping factors lead to slower convergence but better page discrimination
- All methods (power iteration, eigensolver, NetworkX) produce consistent results
- S. Brin and L. Page, "The Anatomy of a Large-Scale Hypertextual Web Search Engine", Computer Networks, 1998.
- D. Gleich, "PageRank Beyond the Web", SIAM Review, 2015.
- L. Page, S. Brin, R. Motwani, and T. Winograd, "The PageRank Citation Ranking: Bringing Order to the Web", Technical Report, Stanford University, 1998.
- Sparse matrix implementation for larger graphs
- Personalized PageRank
- Dynamic PageRank updates
- Topic-sensitive PageRank
- Real-world graph testing