Class PageRankPowerSeries
public class PageRankPowerSeries extends PageRank
PageRank has a power series expansion in α (see PageRank
for definitions):
In “PageRank: Functional dependencies”, by Paolo Boldi, Massimo Santini, and Sebastiano Vigna, ACM Trans. Inf. Sys., 27(4):1−23, 2009, we show that the truncation of order k of the power series is exactly the value attained by the power method using v as starting vector. This class exploits the equivalence to compute iteratively the Maclaurin polynomials of order k:
The remainder (i.e., the difference with PageRank) at the k-th iteration can be bounded exactly using the norm of the difference r(k) − r(k−1), as
Hence,
normDelta()
.
It is worth remarking that a folklore justification for convergence, that is, the spectral gap between the dominant eigenvalue and the second eigenvalue, does not apply directly to PageRank, as it is applicable only to normal (i.e., diagonalizable) matrices. The inequality above, instead, makes it possible to bound in a precise manner the error in the current estimation.
Note that
The latter formula means that
The attribute previousRank
represents the ranking at the previous step.
Derivatives and coefficients of the Maclaurin polynomials
Using results from “PageRank: Functional dependencies”, by Paolo Boldi, Massimo Santini, and Sebastiano Vigna,
ACM Trans. Inf. Sys., 27(4):1−23, 2009, this class is able also to approximate the derivatives
of PageRank in α, and to compute, for each node, the
coefficients of Maclaurin polynomials. You have to set a non-empty order
array specifying
the order of the derivatives desired, or a basename for the coefficients,
respectively . The derivatives will be evaluated (as PageRank is) in the value set for α.
- See Also:
PageRank
,SpectralRanking
-
Nested Class Summary
Nested classes/interfaces inherited from class it.unimi.dsi.law.rank.SpectralRanking
SpectralRanking.IterationNumberStoppingCriterion, SpectralRanking.NormStoppingCriterion, SpectralRanking.StoppingCriterion
-
Field Summary
Fields Modifier and Type Field Description String
coeffBasename
If notnull
, the basename for coefficents.double[][]
derivative
The value of derivatives (only for the subset of nodes specified insubset
, if notnull
).int[]
order
The order of the derivatives.double[]
previousRank
The rank vector after the last iteration (only meaningful after at least one step).int[]
subset
If notnull
, the subset of nodes over which the derivatives should be computed.Fields inherited from class it.unimi.dsi.law.rank.PageRank
alpha, buckets, danglingNodeDistribution, DEFAULT_ALPHA, preference, stronglyPreferential
Fields inherited from class it.unimi.dsi.law.rank.SpectralRanking
DEFAULT_MAX_ITER, DEFAULT_NORM, DEFAULT_THRESHOLD, graph, iteration, logger, n, rank, STOCHASTIC_TOLERANCE
-
Constructor Summary
Constructors Constructor Description PageRankPowerSeries(ImmutableGraph graph)
Creates a new instance.PageRankPowerSeries(ImmutableGraph graph, Logger logger)
Creates a new instance. -
Method Summary
Modifier and Type Method Description void
clear()
Clears all data and releases resources by nullingSpectralRanking.rank
(i.e., results we no longer be available).void
init()
Basic initialization: we log the damping factor, check that the preference vector is correctly sized and stochastic, fillSpectralRanking.rank
with the preference vector and set the dangling-node distribution depending on the value ofPageRank.stronglyPreferential
.static void
main(String[] arg)
double
normDelta()
Returns the norm of an estimation of the distance to the limit of the iterative process: depending on the implementation, this can be an actual bound or, for example, just the difference between the last two approximations.void
step()
Performs one computation step.void
stepUntil(SpectralRanking.StoppingCriterion stoppingCriterion)
CallsSpectralRanking.init()
and steps until a given stopping criterion is met.Methods inherited from class it.unimi.dsi.law.rank.PageRank
buildProperties
Methods inherited from class it.unimi.dsi.law.rank.SpectralRanking
and, approximateNormVector, buildProperties, isStochastic, or
-
Field Details
-
previousRank
public double[] previousRankThe rank vector after the last iteration (only meaningful after at least one step). -
subset
public int[] subsetIf notnull
, the subset of nodes over which the derivatives should be computed. -
derivative
public double[][] derivativeThe value of derivatives (only for the subset of nodes specified insubset
, if notnull
). -
order
public int[] orderThe order of the derivatives. Must be non-null
, but it can be the empty array. -
coeffBasename
If notnull
, the basename for coefficents.
-
-
Constructor Details
-
PageRankPowerSeries
Creates a new instance.- Parameters:
graph
- the graph.logger
- a logger that will be passed tosuper()
.
-
PageRankPowerSeries
Creates a new instance.- Parameters:
graph
- the graph.
-
-
Method Details
-
init
Description copied from class:PageRank
Basic initialization: we log the damping factor, check that the preference vector is correctly sized and stochastic, fillSpectralRanking.rank
with the preference vector and set the dangling-node distribution depending on the value ofPageRank.stronglyPreferential
.- Overrides:
init
in classPageRank
- Throws:
IOException
-
step
Description copied from class:SpectralRanking
Performs one computation step.- Specified by:
step
in classSpectralRanking
- Throws:
IOException
-
stepUntil
Description copied from class:SpectralRanking
CallsSpectralRanking.init()
and steps until a given stopping criterion is met. The criterion is checked a posteriori (i.e., after each step); this means that at least one step is performed.- Overrides:
stepUntil
in classSpectralRanking
- Parameters:
stoppingCriterion
- the stopping criterion to be used.- Throws:
IOException
-
normDelta
public double normDelta()Description copied from class:SpectralRanking
Returns the norm of an estimation of the distance to the limit of the iterative process: depending on the implementation, this can be an actual bound or, for example, just the difference between the last two approximations.This method must be implemented by concrete subclasses if you want to use
SpectralRanking.NormStoppingCriterion
.- Overrides:
normDelta
in classSpectralRanking
- Returns:
- the norm of an estimation of the distance to the limit.
-
clear
public void clear()Description copied from class:SpectralRanking
Clears all data and releases resources by nullingSpectralRanking.rank
(i.e., results we no longer be available). Please extend this method to handle additional attributes.- Overrides:
clear
in classSpectralRanking
-
main
public static void main(String[] arg) throws IOException, JSAPException, ClassNotFoundException, ConfigurationException
-