public abstract class AbstractRanker extends IterativeProcess
By default, all rank scores are removed from the vertices (or edges) being ranked.
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
DEFAULT_EDGE_WEIGHT_KEY |
Constructor and Description |
---|
AbstractRanker() |
Modifier and Type | Method and Description |
---|---|
protected void |
assignDefaultEdgeTransitionWeights() |
protected void |
finalizeIterations()
Perform eventual clean-up operations
(must be implement by subclass when needed).
|
protected double |
getEdgeWeight(Edge e) |
java.lang.String |
getEdgeWeightKeyName()
the user datum key used to store the edge weight, if any
|
protected Graph |
getGraph() |
java.util.List |
getRankings()
Retrieves the list of ranking instances in descending sorted order by rank score
If the algorithm is ranking edges, the instances will be of type
EdgeRanking , otherwise
if the algorithm is ranking nodes the instances will be of type NodeRanking |
double |
getRankScore(Element e)
Given an edge or node, returns the corresponding rank score.
|
abstract java.lang.String |
getRankScoreKey()
The user datum key used to store the rank score.
|
cern.colt.list.DoubleArrayList |
getRankScores(int topKRankings)
Return a list of the top k rank scores.
|
protected java.util.Set |
getVertices() |
protected void |
initialize(Graph graph,
boolean isNodeRanker,
boolean isEdgeRanker) |
boolean |
isRankingEdges()
Returns
true if this ranker ranks edges, and
false otherwise. |
boolean |
isRankingNodes()
Returns
true if this ranker ranks nodes, and
false otherwise. |
protected void |
normalizeEdgeTransitionWeights() |
protected void |
normalizeRankings() |
protected void |
onFinalize(Element e) |
void |
printRankings(boolean verbose,
boolean printScore)
Print the rankings to standard out in descending order of rank score
|
protected void |
reinitialize() |
protected void |
setEdgeWeight(Edge e,
double weight) |
void |
setNormalizeRankings(boolean normalizeRankings)
Allows the user to specify whether or not s/he wants the rankings to be normalized.
|
protected void |
setRankScore(Element e,
double rankValue) |
void |
setRemoveRankScoresOnFinalize(boolean removeRankScoresOnFinalize)
Instructs the ranker whether or not it should remove the rank scores from the nodes (or edges) once the ranks
have been computed.
|
void |
setUserDefinedEdgeWeightKey(java.lang.String keyName)
Allows the user to provide his own set of data instances as edge weights by giving the ranker
the
UserDatum key where those instances can be found. |
evaluate, evaluateIteration, getDesiredPrecision, getIterations, getMaximumIterations, getPrecision, hasConverged, initializeIterations, relativePrecision, setDesiredPrecision, setMaximumIterations
public static final java.lang.String DEFAULT_EDGE_WEIGHT_KEY
protected void initialize(Graph graph, boolean isNodeRanker, boolean isEdgeRanker)
protected java.util.Set getVertices()
protected Graph getGraph()
protected void reinitialize()
reinitialize
in class IterativeProcess
public boolean isRankingNodes()
true
if this ranker ranks nodes, and
false
otherwise.public boolean isRankingEdges()
true
if this ranker ranks edges, and
false
otherwise.public void setRemoveRankScoresOnFinalize(boolean removeRankScoresOnFinalize)
removeRankScoresOnFinalize
- true
if the rank scores are to be removed, false
otherwiseprotected void onFinalize(Element e)
protected void finalizeIterations()
IterativeProcess
finalizeIterations
in class IterativeProcess
public java.util.List getRankings()
EdgeRanking
, otherwise
if the algorithm is ranking nodes the instances will be of type NodeRanking
public cern.colt.list.DoubleArrayList getRankScores(int topKRankings)
topKRankings
- the value of k to usepublic abstract java.lang.String getRankScoreKey()
public double getRankScore(Element e)
setRemoveRankScoresOnFinalize(false)
was called
prior to evaluate()
.protected void setRankScore(Element e, double rankValue)
protected double getEdgeWeight(Edge e)
public java.lang.String getEdgeWeightKeyName()
protected void setEdgeWeight(Edge e, double weight)
protected void assignDefaultEdgeTransitionWeights()
protected void normalizeEdgeTransitionWeights()
protected void normalizeRankings()
public void printRankings(boolean verbose, boolean printScore)
verbose
- if true
, include information about the actual rank order as well as
the original position of the vertex before it was rankedprintScore
- if true
, include the actual value of the rank scorepublic void setNormalizeRankings(boolean normalizeRankings)
normalizeRankings
- public void setUserDefinedEdgeWeightKey(java.lang.String keyName)
UserDatum
key where those instances can be found.keyName
- the name of the UserDatum
key where the data instance representing an edge weight
can be found