public class KStepMarkov<V,E> extends PageRankWithPriors<V,E>
PageRankWithPriors
in which the final scores
represent a probability distribution over position assuming a random (Markovian)
walk of exactly k steps, based on the initial distribution specified by the priors.
NOTE: The version of KStepMarkov
in algorithms.importance
(and in JUNG 1.x) is believed to be incorrect: rather than returning
a score which represents a probability distribution over position assuming
a k-step random walk, it returns a score which represents the sum over all steps
of the probability for each step. If you want that behavior, set the
'cumulative' flag as follows before calling evaluate()
:
KStepMarkov ksm = new KStepMarkov(...); ksm.setCumulative(true); ksm.evaluate();By default, the 'cumulative' flag is set to false. NOTE: THIS CLASS IS NOT YET COMPLETE. USE AT YOUR OWN RISK. (The original behavior is captured by the version still available in
algorithms.importance
.)PageRank
,
PageRankWithPriors
disappearing_potential
alpha, vertex_priors
edge_weights, graph, hyperedges_are_self_loops, max_delta, max_iterations, output_reversed, tolerance, total_iterations
Constructor and Description |
---|
KStepMarkov(Hypergraph<V,E> graph,
com.google.common.base.Function<E,? extends Number> edge_weights,
com.google.common.base.Function<V,Double> vertex_priors,
int steps)
Creates an instance based on the specified graph, edge weights, vertex
priors (initial scores), and number of steps to take.
|
KStepMarkov(Hypergraph<V,E> graph,
com.google.common.base.Function<V,Double> vertex_priors,
int steps)
Creates an instance based on the specified graph, vertex
priors (initial scores), and number of steps to take.
|
KStepMarkov(Hypergraph<V,E> graph,
int steps)
Creates an instance based on the specified graph and number of steps to
take.
|
Modifier and Type | Method and Description |
---|---|
void |
setCumulative(boolean cumulative)
Specifies whether this instance should assign a score to each vertex
based on the sum over all steps of the probability for each step.
|
double |
update(V v)
Updates the value for this vertex.
|
afterStep, collectDisappearingPotential
getAlpha, getVertexPrior, getVertexPriors, initialize
acceptDisconnectedGraph, done, evaluate, getAdjustedIncidentCount, getCurrentValue, getEdgeWeight, getEdgeWeights, getIterations, getMaxIterations, getOutputValue, getTolerance, getVertexScore, isDisconnectedGraphOK, setCurrentValue, setEdgeWeights, setHyperedgesAreSelfLoops, setMaxIterations, setOutputValue, setTolerance, step, swapOutputForCurrent, updateMaxDelta
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getVertexScore
public KStepMarkov(Hypergraph<V,E> graph, com.google.common.base.Function<E,? extends Number> edge_weights, com.google.common.base.Function<V,Double> vertex_priors, int steps)
graph
- the input graphedge_weights
- the edge weights (transition probabilities)vertex_priors
- the initial probability distribution (score assignment)steps
- the number of times that step()
will be called by evaluate
public KStepMarkov(Hypergraph<V,E> graph, com.google.common.base.Function<V,Double> vertex_priors, int steps)
graph
- the input graphvertex_priors
- the initial probability distribution (score assignment)steps
- the number of times that step()
will be called by evaluate
public KStepMarkov(Hypergraph<V,E> graph, int steps)
graph
- the input graphsteps
- the number of times that step()
will be called by evaluate
public void setCumulative(boolean cumulative)
cumulative
- true if this instance should assign a cumulative score to each vertexpublic double update(V v)
step()
.update
in class PageRankWithPriors<V,E>
v
- the vertex whose value is to be updatedCopyright © 2015. All rights reserved.