public class PageRank extends RelativeAuthorityRanker
A simple example of usage is:
PageRank ranker = new PageRank(someGraph,0.15); ranker.evaluate(); ranker.printRankings();
Running time: O(|E|*I) where |E| is the number of edges and I is the number of iterations until convergence
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
KEY |
PRIOR_KEY
DEFAULT_EDGE_WEIGHT_KEY
Modifier | Constructor and Description |
---|---|
|
PageRank(DirectedGraph graph,
double bias)
Basic constructor which initializes the algorithm
|
|
PageRank(DirectedGraph graph,
double bias,
java.lang.String edgeWeightKeyName)
Specialized constructor that allows the user to specify an edge key if edges already have user-defined
weights assigned to them.
|
protected |
PageRank(DirectedGraph graph,
double bias,
java.lang.String edgeWeightKeyName,
Pair reachables) |
Modifier and Type | Method and Description |
---|---|
protected double |
evaluateIteration()
Evaluate the result of the current interation.
|
java.lang.String |
getRankScoreKey()
The user datum key used to store the rank scores.
|
protected void |
initialize(DirectedGraph graph,
double bias,
java.lang.String edgeWeightKeyName) |
protected void |
initializeRankings(java.util.Set reachableVertices,
java.util.Set unreachableVertices) |
protected void |
reinitialize() |
protected void |
updateRankings() |
finalizeIterations, getPriorRankScore, getPriorRankScoreKey, getPriors, setPriorRankScore, setPriors
assignDefaultEdgeTransitionWeights, getEdgeWeight, getEdgeWeightKeyName, getGraph, getRankings, getRankScore, getRankScores, getVertices, initialize, isRankingEdges, isRankingNodes, normalizeEdgeTransitionWeights, normalizeRankings, onFinalize, printRankings, setEdgeWeight, setNormalizeRankings, setRankScore, setRemoveRankScoresOnFinalize, setUserDefinedEdgeWeightKey
evaluate, getDesiredPrecision, getIterations, getMaximumIterations, getPrecision, hasConverged, initializeIterations, relativePrecision, setDesiredPrecision, setMaximumIterations
public static final java.lang.String KEY
public PageRank(DirectedGraph graph, double bias)
graph
- the graph whose nodes are to be rankedbias
- the value (between 0 and 1) that indicates how much to dampen the underlying markov chain
with underlying uniform transitions over all nodes. Generally, values between 0.0-0.3 are used.public PageRank(DirectedGraph graph, double bias, java.lang.String edgeWeightKeyName)
graph
- the graph whose nodes are to be rankedbias
- the value (between 0 and 1) that indicates how much to dampen the underlying markov chain
with underlying uniform transitions over all nodes. Generally, values between 0.0-0.3 are used.edgeWeightKeyName
- if non-null, uses the user-defined weights to compute the transition probabilities;
if null then default transition probabilities (1/outdegree(u)) are usedprotected PageRank(DirectedGraph graph, double bias, java.lang.String edgeWeightKeyName, Pair reachables)
protected void initialize(DirectedGraph graph, double bias, java.lang.String edgeWeightKeyName)
protected void initializeRankings(java.util.Set reachableVertices, java.util.Set unreachableVertices)
protected void reinitialize()
reinitialize
in class AbstractRanker
protected void updateRankings()
protected double evaluateIteration()
IterativeProcess
evaluateIteration
in class IterativeProcess
public java.lang.String getRankScoreKey()
getRankScoreKey
in class AbstractRanker