An implementation of Google's earlier PageRank algorithm.
- Implementation of PageRank Algorithm.
- Implementation of TrustRank Algorithm to identify spam pages.
- Implementation of Topic-Specific Rank Algorithm.
- Visual Representation through a graph at each step as the algorithm proceeds.
Using apt
:
$ sudo apt install python3-numpy
$ sudo apt install python3-scipy
$ sudo apt install python3-networkx
Using pip3
:
$ sudo pip3 install numpy
$ sudo pip3 install scipy
$ sudo pip3 install networkx
Open main.py
, set the path of corpus and update the number of nodes in your coupus. Save main.py
and run it.
$ python3 main.py
Sample data is provided in /PageRank/data
. You may use your own graph too.
Contains the runner function which calls the ranking functions.
Contains 2 classes: getGraph
and plotGraph
.
getGraph: Takes input from graph file. Graph file contains edges of the graph.
plotGraph: The Visualizing class. Plots the web-graph of the screen and shows how it changes as the algorithm proceeds.
Contains class that implements Google's earlier PageRanking Algorithm. Here, teleport set contains all the nodes in the web-graph. A random-surfer can jump to any of the node(page) in the web-graph with equal probaility.
Contains class that implements TrustRank. Trust is propagated from a set of trusted pages to all other pages. Effective in detection of Spam Pages. Here, teleport set is the set of trusted pages.
Contains class implementing Topic-Specific Rank. Here, teleport set is a set of pages which are related to each other and belong to same topic.
- Node numbering starts from
0
. Node 0 is avalid
node in web-graph. - If you need to change any parameters, change them in
main.py
. Teleports
,Dead-ends
andSpider-traps
are taken care off.- Rank leaked during the iterations is re-distributed among
appropriate
nodes equally. - 2 implementations of Topic-Spectific Rank:
- Adjacency list (normal-iteration using numpy arrays)
- Sparce Matrix (power-iteration using scipy.csr_matrix)
eFactory: The PageRank Algorithm.
Princeton: Page Rank explained.
Wikipedia: PageRank.