PageRank (PR) is an algorithm used in by Google, to rank web pages in their search results.
This project is a C implementation of the PageRank algorithm, designed to run in parallel using pthreads and a thread pool. The implementation provides faster performance compared to a non-parallel version, making it suitable for handling large datasets efficiently.
- Parallel Processing: Utilizes pthreads for parallel execution, significantly improving performance.
- Thread Pool: Implements a thread pool to manage threads efficiently.
- Directed Graph: The graph is implemented as a directed graph, where each node can have multiple outgoing edges.
- Dynamic Memory Management: Uses malloc and free for dynamic memory allocation.
- Configurable: The number of indexes (nodes) and their edges can be easily adjusted in the code.
Below an image that shows the mathematical formula used in the PageRank algorithm, which calculates the rank of each page based on its incoming links.
![PageRank Formula](https://private-user-images.githubusercontent.com/110912180/344403348-082fa9de-1107-4111-9d86-bb175b1724ae.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjMzNzU0MzcsIm5iZiI6MTcyMzM3NTEzNywicGF0aCI6Ii8xMTA5MTIxODAvMzQ0NDAzMzQ4LTA4MmZhOWRlLTExMDctNDExMS05ZDg2LWJiMTc1YjE3MjRhZS5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwODExJTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDgxMVQxMTE4NTdaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT04YjFkZTdlNDg1YjA1OTJkN2E4NjgzNzFlNTM1MjJhNGRiOWYzNTJlOGZjZjRmNWJhMmQ0ZjA5ZDFkN2U3M2M3JlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.WqmT4RlIeQ7uBOap_Cp34-N9QKvCKxCn1iF4UTO94kY)
This image illustrates a pseudo code of the sequential implementation of the PageRank algorithm.
![Sequential PageRank Code](https://private-user-images.githubusercontent.com/110912180/344403453-54bbae76-3252-4bce-b209-2d9df557042a.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjMzNzU0MzcsIm5iZiI6MTcyMzM3NTEzNywicGF0aCI6Ii8xMTA5MTIxODAvMzQ0NDAzNDUzLTU0YmJhZTc2LTMyNTItNGJjZS1iMjA5LTJkOWRmNTU3MDQyYS5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwODExJTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDgxMVQxMTE4NTdaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT1hMGViZjZmODJmNzg2ZTJhYmZmNjYxMTlmZTVjZjM3ZjliNWVjOTc2YmNkYzJiMmMzY2M5Nzc4ZDJjNDU3MGFhJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.GIHAdvJ4nU7HdesyCYQmIZTy8KFiFS-YRZZgHi5FDFw)
To build and run the code, follow these steps:
Clone the repository:
git clone https://github.com/tomerp1812/Page-Ranking.git
cd Page-Ranking
Build the executable:
make
Run the program:
./main.out
- An operating system that supports pthreads (e.g., Linux, macOS).
- A C compiler (e.g., gcc).