PageRank was originally proposed in the context of World Wide Web (WWW), it takes advantage of the link structure of WWW to produce a global objective 'importance' ranking of webpages that can be used by search engines. This algorithm was proposed in 1997-1998 by Google co-founders Larry Page and Sergey Brin.
With the development of technology and the emergence of enormous correlation data, PageRank has been adopted in many other fields too.
In WWW, hypertexts contained in webpages create links between webpages. Every webpage (node) can have some forward links (via out-edges) and backlinks (via in-edges). In the following graph, A and B are backlinks of C, D is a forward link of C.

Webpages vary greatly in terms of the number of backlinks they have. Naturally, webpages that are more important, authoritative or of high quality are likely to receive more or more important backlinks.
PageRank can be described as this: a page has high rank if the sum of the ranks of its backlinks is high. This covers both the case when a page has many backlinks and when a page has a few highly ranked backlinks.
The ranks (scores) of all pages are computed in a recursive way by starting with any set of ranks and iterating the computation until it converges. In each iteration, a page gives out its rank to all its forward links evenly to contribute to the ranks of the pages it points to; meanwhile every page receives ranks from its backlinks, so the rank of page u after one iteration is:

where Bu is the backlink set of u.
Below shows a steady state of a set of pages:

Consider the following kinds of webpages:
To overcome these problems, a damping factor, whose value is between 0 and 1, is introduced. It gives each webpage a base rank while weakening the ranks passed from backlinks. The rank of page u after one iteration becomes:

where d is the damping factor. For example, when d is 0.7, if a webpage receives 8 ranks in total from backlinks, then the rank of this webpage is updated to 0.7*8 + (1-0.7) = 5.9.
Damping factor can also be understood as the probability that a web surfer randomly jump to a webpage that is not one of the forward links of the current webpage.
algo(page_rank)Name | Type | Spec | Default | Optional | Description |
|---|---|---|---|---|---|
| init_value | float | >0 | 0.2 | Yes | The same initial rank for all nodes |
| loop_num | int | >=1 | 5 | Yes | Number of iterations |
| damping | float | (0,1) | 0.8 | Yes | Damping factor |
| weaken | int | 1, 2 | 1 | Yes | For PageRank, keep it as 1; 2 means to run ArticleRank |
| limit | int | ≥-1 | -1 | Yes | Number of results to return, -1 to return all results |
| order | string | asc, desc | / | Yes | Sort nodes by the rank |
The example graph is as follows:

| Spec | Content |
|---|---|
| filename | _id,rank |
UQLalgo(page_rank).params({ init_value: 1, loop_num: 50, damping: 0.8, weaken: 1, order: 'desc' }).write({ file: {filename: 'rank'} })
Results: File rank
FileE,2.3906 G,1.15624 F,1.03774 N,0.842146 I,0.67812 B,0.615097 L,0.615097 J,0.36 A,0.333333 C,0.333333 H,0.333333 M,0.28 D,0.2 K,0.2
| Spec | Content | Write to | Data Type |
|---|---|---|---|
| property | rank | Node property | float |
UQLalgo(page_rank).params({ loop_num: 50, weaken: 1 }).write({ db:{property: 'PR'} })
Results: Rank for each node is written to a new property named PR
| Alias Ordinal | Type | Description | Columns |
|---|---|---|---|
| 0 | []perNode | Node and its rank | _uuid, rank |
UQLalgo(page_rank).params({ init_value: 1, loop_num: 50, damping: 0.8, weaken: 1, order: 'desc', limit: 5 }) as PR return PR
Results: PR
| _uuid | rank |
|---|---|
| 5 | 2.390599 |
| 7 | 1.15624 |
| 6 | 1.037742 |
| 14 | 0.842146 |
| 9 | 0.67812 |
| Alias Ordinal | Type | Description | Columns |
|---|---|---|---|
| 0 | []perNode | Node and its rank | _uuid, rank |
UQLalgo(page_rank).params({ loop_num: 50, damping: 0.8, weaken: 1, order: 'desc', limit: 5 }).stream() as PR find().nodes({_uuid == PR._uuid}) as nodes return table(nodes._id, PR.rank)
Results: table(nodes._id, PR.rank)
| nodes._id | PR.rank |
|---|---|
| E | 2.390599 |
| G | 1.15624 |
| F | 1.037742 |
| N | 0.842146 |
| I | 0.67812 |