Skip to content

🔢 A Python implementation of the PageRank algorithm using a sparse matrix representation and the power iteration method with a damping factor.

Notifications You must be signed in to change notification settings

amerob/pagerank-algorithm-python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PageRank Implementation in Python

This repository contains a Python implementation of the PageRank algorithm using a sparse matrix representation and the power iteration method with a damping factor.

graph

Features

  • Sparse Matrix Representation: Constructs the transition matrix as a sparse matrix for memory and computational efficiency.
  • Normalization: Ensures each column of the transition matrix sums to 1 (stochastic matrix).
  • Power Iteration Method: Computes the PageRank vector using an iterative approach with convergence tolerance.
  • Damping Factor: Incorporates the damping factor (set to 0.85) to simulate the behavior of a random surfer.
  • Example Usage: Includes a simple example with a network of 6 pages and predefined links.

Algorithm

pseudo

Requirements

  • Python 3.6+
  • NumPy
  • SciPy

Usage

  1. Clone the repository:

    git clone https://github.com/amerob/pagerank-algorithm-python.git
    cd pagerank-algorithm-python
  2. Install dependencies:

    pip3 install -r requirements.txt
  3. Run the script:

    python main.py

Note

This code only shows the core concepts behind the PageRank algorithm and serves as a starting point for exploring graph ranking. Contributions are welcome.

About

🔢 A Python implementation of the PageRank algorithm using a sparse matrix representation and the power iteration method with a damping factor.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages