5.4. igraph_pagerank — Calculates the Google PageRank for the specified vertices.

int igraph_pagerank(const igraph_t *graph, igraph_vector_t *vector,
		    igraph_real_t *value, const igraph_vs_t vids,
		    igraph_bool_t directed, igraph_real_t damping, 
		    const igraph_vector_t *weights,
		    igraph_arpack_options_t *options);

This is the new PageRank implementation, based on the ARPACK library. The old, power-method based implementation can be used as well, it is kept under the name igraph_pagerank_old().

Please note that the PageRank of a given vertex depends on the PageRank of all other vertices, so even if you want to calculate the PageRank for only some of the vertices, all of them must be calculated. Requesting the PageRank for only some of the vertices does not result in any performance increase at all.

Since the calculation is an iterative process, the algorithm is stopped after a given count of iterations or if the PageRank value differences between iterations are less than a predefined value.

For the explanation of the PageRank algorithm, see the following webpage: http://www-db.stanford.edu/~backrub/google.html, or the following reference:

Sergey Brin and Larry Page: The Anatomy of a Large-Scale Hypertextual Web Search Engine. Proceedings of the 7th World-Wide Web Conference, Brisbane, Australia, April 1998.

Arguments: 

graph:

The graph object.

vector:

Pointer to an initialized vector, the result is stored here. It is resized as needed.

value:

Pointer to a real variable, the eigenvalue corresponding to the PageRank vector is stored here. It should be always exactly one.

vids:

The vertex ids for which the PageRank is returned.

directed:

Boolean, whether to consider the directedness of the edges. This is ignored for undirected graphs.

damping:

The damping factor ("d" in the original paper)

weights:

Optional edge weights, it is either a null pointer, then the edges are not weighted, or a vector of the same length as the number of edges.

options:

Options to ARPACK. See igraph_arpack_options_t for details. Note that the function overwrites the n (number of vertices), nev (1), ncv (3) and which (LM) parameters and it always starts the calculation from a non-random vector calculated based on the degree of the vertices.

Returns: 

Error code: IGRAPH_ENOMEM, not enough memory for temporary data. IGRAPH_EINVVID, invalid vertex id in vids.

Time complexity: TODO.

See also: 

igraph_pagerank_old() for the old implementation, igraph_arpack_rssolve() and igraph_arpack_rnsolve() for the underlying machinery.