Class WeightedNIPaths<V,E>
java.lang.Object
edu.uci.ics.jung.algorithms.util.IterativeProcess
edu.uci.ics.jung.algorithms.importance.AbstractRanker<V,E>
edu.uci.ics.jung.algorithms.importance.WeightedNIPaths<V,E>
- All Implemented Interfaces:
IterativeContext
This algorithm measures the importance of nodes based upon both the number and length of disjoint paths that lead
to a given node from each of the nodes in the root set. Specifically the formula for measuring the importance of a
node is given by: I(t|R) = sum_i=1_|P(r,t)|_{alpha^|p_i|} where alpha is the path decay coefficient, p_i is path i
and P(r,t) is a set of maximum-sized node-disjoint paths from r to t.
This algorithm uses heuristic breadth-first search to try and find the maximum-sized set of node-disjoint paths between two nodes. As such, it is not guaranteed to give exact answers.
A simple example of usage is:
WeightedNIPaths ranker = new WeightedNIPaths(someGraph,2.0,6,rootSet); ranker.evaluate(); ranker.printRankings();
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate com.google.common.base.Supplier
<E> private double
private int
private com.google.common.base.Supplier
<V> static final String
Fields inherited from class edu.uci.ics.jung.algorithms.importance.AbstractRanker
edgeRankScores, vertexRankScores
-
Constructor Summary
ConstructorsConstructorDescriptionWeightedNIPaths
(DirectedGraph<V, E> graph, com.google.common.base.Supplier<V> vertexFactory, com.google.common.base.Supplier<E> edgeFactory, double alpha, int maxDepth, Set<V> priors) Constructs and initializes the algorithm. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
computeWeightedPathsFromSource
(V root, int depth) Given a node, returns the corresponding rank score.protected void
incrementRankScore
(V v, double rankValue) private void
newVertexEncountered
(int sourcePathIndex, V dest, V root) protected void
onFinalize
(Object udc) void
step()
Evaluate the result of the current iteration.Methods inherited from class edu.uci.ics.jung.algorithms.importance.AbstractRanker
assignDefaultEdgeTransitionWeights, finalizeIterations, getEdgeRankScore, getEdgeRankScore, getEdgeRankScores, getEdgeRankScores, getEdgeWeight, getEdgeWeights, getGraph, getRankings, getRankScores, getVertexCount, getVertexRankScore, getVertexRankScore, getVertexRankScores, getVertexRankScores, getVertices, initialize, isRankingEdges, isRankingNodes, normalizeEdgeTransitionWeights, normalizeRankings, printRankings, removeEdgeRankScore, removeEdgeRankScore, removeVertexRankScore, removeVertexRankScore, reset, setEdgeRankScore, setEdgeRankScore, setEdgeWeight, setEdgeWeights, setNormalizeRankings, setRemoveRankScoresOnFinalize, setVertexRankScore, setVertexRankScore
Methods inherited from class edu.uci.ics.jung.algorithms.util.IterativeProcess
done, evaluate, getDesiredPrecision, getIterations, getMaximumIterations, getPrecision, hasConverged, initializeIterations, relativePrecision, setDesiredPrecision, setMaximumIterations, setPrecision
-
Field Details
-
WEIGHTED_NIPATHS_KEY
- See Also:
-
mAlpha
private double mAlpha -
mMaxDepth
private int mMaxDepth -
mPriors
-
pathIndices
-
roots
-
pathsSeenMap
-
vertexFactory
-
edgeFactory
-
-
Constructor Details
-
WeightedNIPaths
public WeightedNIPaths(DirectedGraph<V, E> graph, com.google.common.base.Supplier<V> vertexFactory, com.google.common.base.Supplier<E> edgeFactory, double alpha, int maxDepth, Set<V> priors) Constructs and initializes the algorithm.- Parameters:
graph
- the graph whose nodes are being measured for their importancevertexFactory
- used to generate instances of VedgeFactory
- used to generate instances of Ealpha
- the path decay coefficient (≥1); 2 is recommendedmaxDepth
- the maximal depth to search out from the root setpriors
- the root set (starting vertices)
-
-
Method Details
-
incrementRankScore
-
computeWeightedPathsFromSource
-
newVertexEncountered
-
step
public void step()Description copied from class:IterativeProcess
Evaluate the result of the current iteration.- Specified by:
step
in interfaceIterativeContext
- Specified by:
step
in classIterativeProcess
-
getRankScoreKey
Given a node, returns the corresponding rank score. This implementation ofgetRankScore
assumes the decoration representing the rank score is of typeMutableDouble
.- Specified by:
getRankScoreKey
in classAbstractRanker<V,
E> - Returns:
- the rank score for this node
-
onFinalize
- Overrides:
onFinalize
in classAbstractRanker<V,
E>
-