public class PageRankBasic extends Object
This implementation requires a set of pages and a set of directed links as input and works as follows.
In each iteration, the rank of every page is evenly distributed to all pages it points to. Each
page collects the partial ranks of all pages that point to it, sums them up, and applies a
dampening factor to the sum. The result is the new rank of the page. A new iteration is started
with the new ranks of all pages. This implementation terminates after a fixed number of
iterations. This is the Wikipedia entry for the
Page Rank algorithm
Input files are plain text files and must be formatted as follows:
- Pages represented as an (long) ID separated by new-line characters.
For example "1\n2\n12\n42\n63"
gives five pages with IDs 1, 2, 12, 42, and 63.
- Links are represented as pairs of page IDs which are separated by space characters. Links
are separated by new-line characters.
For example "1 2\n2 12\n1 12\n42 63"
gives four (directed) links (1)->(2), (2)->(12),
(1)->(12), and (42)->(63). For this simple implementation it is required that each page has
at least one incoming and one outgoing link (a page can point to itself).
Usage:
PageRankBasic --pages <path> --links <path> --output <path> --numPages <n> --iterations <n>
If no parameters are provided, the program is run with default data from
PageRankData
and 10 iterations.
This example shows how to use:
- Bulk Iterations - Default Join - Configure user-defined functions using constructor parameters.
Modifier and Type | Class and Description |
---|---|
static class |
PageRankBasic.AdjacencyList |
static class |
PageRankBasic.AdjacencyList$ |
static class |
PageRankBasic.Link |
static class |
PageRankBasic.Link$ |
static class |
PageRankBasic.Page |
static class |
PageRankBasic.Page$ |
Constructor and Description |
---|
PageRankBasic() |
public static void main(String[] args)
Copyright © 2014–2017 The Apache Software Foundation. All rights reserved.