brainconn.centrality
.pagerank_centrality¶
-
pagerank_centrality
(A, d, falff=None)[source]¶ The PageRank centrality is a variant of eigenvector centrality. This function computes the PageRank centrality of each vertex in a graph.
Formally, PageRank is defined as the stationary distribution achieved by instantiating a Markov chain on a graph. The PageRank centrality of a given vertex, then, is proportional to the number of steps (or amount of time) spent at that vertex as a result of such a process.
The PageRank index gets modified by the addition of a damping factor, d. In terms of a Markov chain, the damping factor specifies the fraction of the time that a random walker will transition to one of its current state’s neighbors. The remaining fraction of the time the walker is restarted at a random vertex. A common value for the damping factor is d = 0.85.
Parameters: - A (NxN
numpy.ndarray
) – adjacency matrix - d (float) – damping factor (see description)
- falff (Nx1
numpy.ndarray
or None) – Initial page rank probability, non-negative values. Default value is None. If not specified, a naive bayesian prior is used.
Returns: r – vectors of page rankings
Return type: Nx1
numpy.ndarray
Notes
The algorithm will work well for smaller matrices (number of nodes around 1000 or less)
- A (NxN