Skip to content

Latest commit

 

History

History
28 lines (21 loc) · 1.4 KB

File metadata and controls

28 lines (21 loc) · 1.4 KB

PageRank Algorithm — Graph Ranking from Eigenvectors

PageRank graph ranking algorithm implemented from the eigenvector formulation using power iteration — the same algorithm that powered early Google Search.

What I Built

A from-scratch PageRank implementation using the column-normalised transition matrix and power iteration (d=0.85 damping factor). Handles dangling nodes via uniform teleportation and validates convergence via L1 norm.

What I Learned

  • PageRank as stationary distribution: how much time a random walker spends on each page at equilibrium
  • Dangling node problem: pages with no out-links cause probability mass to leak — solved by teleportation
  • Power iteration convergence: ||r_new − r||₁ < tol, typically < 50 iterations for most graphs
  • Generalisation: PageRank works on any directed graph (citation networks, social networks, protein interaction networks)

Skills & Tools Used

Python NumPy NetworkX graph-theory pagerank eigenvectors

Results

  • Convergence in 23 iterations on a 5-node test graph (tol=1e-8)
  • Results match NetworkX networkx.pagerank() to 6 decimal places

Real-World Applicability

PageRank (and its variants HITS, TrustRank) underpins web search ranking, academic citation analysis (Google Scholar), and recommendation systems (collaborative filtering via graph walks).

How to Run

pip install -r requirements.txt
python pweek3.py