Class PageRank
- Direct Known Subclasses:
PageRankGaussSeidel,PageRankParallelGaussSeidel,PageRankParallelPowerSeries,PageRankPowerSeries,PageRankPush
public abstract class PageRank extends SpectralRanking
Formulae and preferences
There are two main formulae for PageRank in the literature. The first one, which we shall call weakly preferential, patches all dangling nodes by adding a uniform transition towards all other nodes. The second one, which we shall call strongly preferential, patches all dangling nodes adding transitions weighted following the preference vector v. We can consider the two formulae together, letting u be a vector that is uniform in the weak case and coincides with v in the strong case.
If we denote with P the normalised adjacency matrix of the graph, with d the characteristic vector of dangling nodes, and with α the damping factor, the generic equation is
By default, weakly preferential PageRank is computed; strongly preferential
PageRank computation is enforced by setting stronglyPreferential to true.
- See Also:
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 doublealphaThe damping factor.BitSetbucketsIf notnull, the set of buckets ofSpectralRanking.graph.DoubleListdanglingNodeDistributionThe vector used used to patch null rows of the adjacency matrix (u in the general formula).static doubleDEFAULT_ALPHAThe default damping factor.DoubleListpreferenceThe preference vector to be used (ornullif the uniform preference vector should be used).booleanstronglyPreferentialDecides whether we use the strongly or weakly (the default) preferential algorithm.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 PageRank(ImmutableGraph g, Logger logger)Creates a new instance. -
Method Summary
Modifier and Type Method Description PropertiesbuildProperties(String graphBasename, String preferenceFilename, String danglingFilename)Returns aPropertiesobject that contains all the parameters used by the computation.voidinit()Basic initialization: we log the damping factor, check that the preference vector is correctly sized and stochastic, fillSpectralRanking.rankwith the preference vector and set the dangling-node distribution depending on the value ofstronglyPreferential.Methods inherited from class it.unimi.dsi.law.rank.SpectralRanking
and, approximateNormVector, buildProperties, clear, isStochastic, normDelta, or, step, stepUntil
-
Field Details
-
DEFAULT_ALPHA
public static final double DEFAULT_ALPHAThe default damping factor.- See Also:
- Constant Field Values
-
alpha
public double alphaThe damping factor. In the random surfer interpretation, this is the probability that the surfer will follow a link in the current page. -
preference
The preference vector to be used (ornullif the uniform preference vector should be used). -
danglingNodeDistribution
The vector used used to patch null rows of the adjacency matrix (u in the general formula). It coincides with the preference vector ifstronglyPreferentialis true. Ifnull, the uniform distribution will be used. -
buckets
If notnull, the set of buckets ofSpectralRanking.graph. -
stronglyPreferential
public boolean stronglyPreferentialDecides whether we use the strongly or weakly (the default) preferential algorithm.
-
-
Constructor Details
-
PageRank
Creates a new instance.- Parameters:
g- the graph.logger- a logger.
-
-
Method Details
-
buildProperties
public Properties buildProperties(String graphBasename, String preferenceFilename, String danglingFilename)Returns aPropertiesobject that contains all the parameters used by the computation.- Parameters:
graphBasename- the basename of the graph.preferenceFilename- the filename of preference vector. It can benull.danglingFilename- the filename of dangling-node distribution. It can benull.- Returns:
- a properties object that represent all the parameters used to calculate the rank.
-
init
Basic initialization: we log the damping factor, check that the preference vector is correctly sized and stochastic, fillSpectralRanking.rankwith the preference vector and set the dangling-node distribution depending on the value ofstronglyPreferential.- Overrides:
initin classSpectralRanking- Throws:
IOException
-