PHP Classes
elePHPant
Icontem

guaranix Rank: Implementation of the Google page rank algorithm

Recommend this page to a friend!
  Info   Screenshots Screenshots   View files View files (6)   DownloadInstall with Composer Download .zip   Reputation   Support forum (2)   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2006-11-02 (12 years ago) RSS 2.0 feedStarStarStar 50%Total: 2,663 All time: 1,416 This week: 364Up
Version License PHP version Categories
grank 1.0GNU General Publi...3.0Algorithms, Databases, Searching
Description Author

This class implements the Google page rank algorithm based on the original paper written by Larry Page, Sergey Brin and other at the Stanford university.

It keeps track of the pages and the links that they contain in a MySQL database.

The class can calculate the page rank of each page based on the links that exist pointing to it from other pages.

Innovation Award
PHP Programming Innovation award nominee
October 2006
Number 8


Prize: One downloadable copy of Roadsend PHP Compiler
The main reason why Google become the most popular search engine is the fact that it was able to provide the most relevant results to the user searches.

Google search results are sorted using an algorithm named page rank. It takes in account the number of ingoing and outgoing links to each page.

This class provides a pure PHP implementation of the Google page rank algorithm. It follows the paper written originally by Larry Page, Sergei Brin and others.

Manuel Lemos
  Performance   Level  
Name: Cesar D. Rodas <contact>
Classes: 39 packages by
Country: Paraguay Paraguay
Innovation award
Innovation award
Nominee: 25x

Winner: 5x

Details
IMPORTANT!!

FOR RUN THIS SCRIPT YOU MUST NEED TO CREATE A TABLE WITH:

CREATE TABLE `pagerank` (
  `master` int(11) NOT NULL default '0',
  `slave` int(11) NOT NULL default '0',
  KEY `m` (`master`),
  KEY `s` (`slave`)
);
Master is a page that apoints to slave... 

If you wanna to modify your column or table name, you must change the mysql.php file.



The Guaranix Rank is an implementation of the PageRank (The Larry Page and Sergei Brin Algorithm).


Google the greater Web Search Engine uses the PageRank for search the better pages first.

This algorithm could be used to calculate witch page is more important that anothers.

On my test, on a Sempromp 1.8 GHZ 512 RAM, it took about one hour to calculate the 
PageRank of 1.000.000 Web Pages ( Just 60000 are Crawled and the others are just links undowloaded jet) 
From Wikipedia in English.  Starting with an only page that is 
http://en.wikipedia.org/wiki/Linus_Torvalds. 

Here are the top of PageRank: *
+----------+-----------------------------------------------------------+---------+
| posicion | url                                                       | pr      |
+----------+-----------------------------------------------------------+---------+
|        1 | http://en.wikipedia.org/wiki/Special:Upload               | 66.1543 |
|        2 | http://en.wikipedia.org/wiki/Wikipedia:General_disclaimer |   65.72 |
|        3 | http://en.wikipedia.org/wiki/Wikipedia:Featured_articles  | 64.5116 |
|        4 | http://en.wikipedia.org/wiki/Wikipedia:Contact_us         | 64.2818 |
|        5 | http://en.wikipedia.org/wiki/Special:Recentchanges        |  64.025 |
|        6 | http://en.wikipedia.org/wiki/Help:Contents                | 63.5814 |
|        7 | http://en.wikipedia.org/wiki/Wikipedia:About              | 63.4931 |
|        8 | http://en.wikipedia.org/wiki/Wikipedia:Community_Portal   | 63.4072 |
|        9 | http://en.wikipedia.org/wiki/Special:Specialpages         | 63.3888 |
|       10 | http://en.wikipedia.org/wiki/Portal:Current_events        |  62.964 |
+----------+-----------------------------------------------------------+---------+

A comparation Between OS: *
+----------+---------------------------------------------+----------+
| posicion | url                                         | pr       |
+----------+---------------------------------------------+----------+
|      233 | http://en.wikipedia.org/wiki/Linux          |  1.26486 |
|      410 | http://en.wikipedia.org/wiki/Microsoft      | 0.950259 |
|      428 | http://en.wikipedia.org/wiki/Unix           | 0.919783 |
|     1853 | http://en.wikipedia.org/wiki/FreeBSD        | 0.405697 |
|     2235 | http://en.wikipedia.org/wiki/Category:Unix  |  0.35416 |
|     2665 | http://en.wikipedia.org/wiki/Mac_OS         | 0.312736 |
|     5680 | http://en.wikipedia.org/wiki/Category:Linux | 0.243818 |
+----------+---------------------------------------------+----------+

A Comparation Between Computer Peoples: *
+----------+-----------------------------------------------+----------+
| posicion | url                                           | pr       |
+----------+-----------------------------------------------+----------+
|      717 | http://en.wikipedia.org/wiki/Linus_Torvalds   | 0.626179 |
|     1595 | http://en.wikipedia.org/wiki/Richard_Stallman | 0.451587 |
|     4636 | http://en.wikipedia.org/wiki/Bill_Gates       | 0.267769 |
+----------+-----------------------------------------------+----------+

A Comparation between WebSearch Engines: *
+----------+-------------------------------------------------------------+----------+
| posicion | url                                                         | pr       |
+----------+-------------------------------------------------------------+----------+
|      194 | http://en.wikipedia.org/wiki/Google                         |  1.30925 |
|    10956 | http://en.wikipedia.org/wiki/MSN                            | 0.193957 |
|    64674 | http://en.wikipedia.org/wiki/List_of_acquisitions_by_Google |  0.15752 |
+----------+-------------------------------------------------------------+----------+
	This Results are automatic calculate by this Class, the result is not changed by our preference


The PageRank will be more usefull is there is download the whole wikipedia.

For better performance in the test file there is set to 68M, if you have a good machine you give more of RAM.

Screenshots  
  • how_works/pr_example.gif
  • how_works/pr.gif
  Files folder image Files  
File Role Description
Plain text file gRank.php Class This is the class that will calcualte the PR
Accessible without login Plain text file gRankSimpleTest.php Output This is an example...
Accessible without login Plain text file gRankTest.php Example An Example... :D
Accessible without login Plain text file LICENSE Lic. License file
Accessible without login Plain text file mysql.php Aux. This is the MySQL functions
Accessible without login Plain text file README Doc. Read this!

 Version Control Unique User Downloads Download Rankings  
 0%
Total:2,663
This week:0
All time:1,416
This week:364Up
 User Ratings  
 
 All time
Utility:65%StarStarStarStar
Consistency:62%StarStarStarStar
Documentation:59%StarStarStar
Examples:56%StarStarStar
Tests:-
Videos:-
Overall:50%StarStarStar
Rank:2293