|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object edu.uci.ics.jung.algorithms.util.IterativeProcess edu.uci.ics.jung.algorithms.importance.AbstractRanker<V,E>
public abstract class AbstractRanker<V,E>
Abstract class for algorithms that rank nodes or edges by some "importance" metric. Provides a common set of services such as:
By default, all rank scores are removed from the vertices (or edges) being ranked.
Field Summary | |
---|---|
protected Map<Object,Map<E,Number>> |
edgeRankScores
|
protected Map<Object,Map<V,Number>> |
vertexRankScores
|
Constructor Summary | |
---|---|
AbstractRanker()
|
Method Summary | |
---|---|
protected void |
assignDefaultEdgeTransitionWeights()
|
protected void |
finalizeIterations()
Perform eventual clean-up operations (must be implement by subclass when needed). |
double |
getEdgeRankScore(E e)
|
double |
getEdgeRankScore(E e,
Object key)
|
Map<Object,Map<E,Number>> |
getEdgeRankScores()
|
Map<E,Number> |
getEdgeRankScores(Object key)
|
protected double |
getEdgeWeight(E e)
|
Map<E,Number> |
getEdgeWeights()
|
protected Graph<V,E> |
getGraph()
|
List<Ranking<?>> |
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 |
abstract Object |
getRankScoreKey()
The user datum key used to store the rank score. |
List<Double> |
getRankScores(int topKRankings)
Return a list of the top k rank scores. |
protected int |
getVertexCount()
|
double |
getVertexRankScore(V v)
Given an edge or node, returns the corresponding rank score. |
double |
getVertexRankScore(V v,
Object key)
|
Map<Object,Map<V,Number>> |
getVertexRankScores()
|
Map<V,Number> |
getVertexRankScores(Object key)
|
protected Collection<V> |
getVertices()
|
protected void |
initialize(Graph<V,E> 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(Object e)
|
void |
printRankings(boolean verbose,
boolean printScore)
Print the rankings to standard out in descending order of rank score |
protected void |
removeEdgeRankScore(E e)
|
protected void |
removeEdgeRankScore(E e,
Object key)
|
protected void |
removeVertexRankScore(V v)
|
protected void |
removeVertexRankScore(V v,
Object key)
|
void |
reset()
|
protected void |
setEdgeRankScore(E e,
double rankValue)
|
protected void |
setEdgeRankScore(E e,
double rankValue,
Object key)
|
protected void |
setEdgeWeight(E e,
double weight)
|
void |
setEdgeWeights(Map<E,Number> edgeWeights)
|
void |
setNormalizeRankings(boolean normalizeRankings)
Allows the user to specify whether or not s/he wants the rankings to be normalized. |
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. |
protected void |
setVertexRankScore(V v,
double rankValue)
|
protected void |
setVertexRankScore(V v,
double rankValue,
Object key)
|
Methods inherited from class edu.uci.ics.jung.algorithms.util.IterativeProcess |
---|
done, evaluate, getDesiredPrecision, getIterations, getMaximumIterations, getPrecision, hasConverged, initializeIterations, relativePrecision, setDesiredPrecision, setMaximumIterations, setPrecision, step |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected Map<Object,Map<V,Number>> vertexRankScores
protected Map<Object,Map<E,Number>> edgeRankScores
Constructor Detail |
---|
public AbstractRanker()
Method Detail |
---|
protected void initialize(Graph<V,E> graph, boolean isNodeRanker, boolean isEdgeRanker)
public Map<Object,Map<V,Number>> getVertexRankScores()
public Map<Object,Map<E,Number>> getEdgeRankScores()
public Map<V,Number> getVertexRankScores(Object key)
public Map<E,Number> getEdgeRankScores(Object key)
protected Collection<V> getVertices()
protected int getVertexCount()
protected Graph<V,E> getGraph()
public void reset()
reset
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(Object e)
public abstract Object getRankScoreKey()
protected void finalizeIterations()
IterativeProcess
finalizeIterations
in class IterativeProcess
public List<Ranking<?>> getRankings()
EdgeRanking
, otherwise
if the algorithm is ranking nodes the instances will be of type NodeRanking
public List<Double> getRankScores(int topKRankings)
topKRankings
- the value of k to use
public double getVertexRankScore(V v)
setRemoveRankScoresOnFinalize(false)
was called
prior to evaluate()
.
public double getVertexRankScore(V v, Object key)
public double getEdgeRankScore(E e)
public double getEdgeRankScore(E e, Object key)
protected void setVertexRankScore(V v, double rankValue, Object key)
protected void setEdgeRankScore(E e, double rankValue, Object key)
protected void setVertexRankScore(V v, double rankValue)
protected void setEdgeRankScore(E e, double rankValue)
protected void removeVertexRankScore(V v, Object key)
protected void removeEdgeRankScore(E e, Object key)
protected void removeVertexRankScore(V v)
protected void removeEdgeRankScore(E e)
protected double getEdgeWeight(E e)
protected void setEdgeWeight(E e, double weight)
public void setEdgeWeights(Map<E,Number> edgeWeights)
public Map<E,Number> getEdgeWeights()
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
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |