Class PageRankWithPriors<V,​E>

  • All Implemented Interfaces:
    VertexScorer<V,​java.lang.Double>, IterativeContext
    Direct Known Subclasses:
    KStepMarkov, PageRank

    public class PageRankWithPriors<V,​E>
    extends AbstractIterativeScorerWithPriors<V,​E,​java.lang.Double>
    A generalization of PageRank that permits non-uniformly-distributed random jumps. The 'vertex_priors' (that is, prior probabilities for each vertex) may be thought of as the fraction of the total 'potential' that is assigned to that vertex at each step out of the portion that is assigned according to random jumps (this portion is specified by 'alpha').
    See Also:
    "Algorithms for Estimating Relative Importance in Graphs by Scott White and Padhraic Smyth, 2003", PageRank
    • Field Detail

      • disappearing_potential

        protected double disappearing_potential
        Maintains the amount of potential associated with vertices with no out-edges.
    • Constructor Detail

      • PageRankWithPriors

        public PageRankWithPriors​(Hypergraph<V,​E> graph,
                                  com.google.common.base.Function<E,​? extends java.lang.Number> edge_weights,
                                  com.google.common.base.Function<V,​java.lang.Double> vertex_priors,
                                  double alpha)
        Creates an instance with the specified graph, edge weights, vertex priors, and 'random jump' probability (alpha).
        Parameters:
        graph - the input graph
        edge_weights - the edge weights, denoting transition probabilities from source to destination
        vertex_priors - the prior probabilities for each vertex
        alpha - the probability of executing a 'random jump' at each step
      • PageRankWithPriors

        public PageRankWithPriors​(Hypergraph<V,​E> graph,
                                  com.google.common.base.Function<V,​java.lang.Double> vertex_priors,
                                  double alpha)
        Creates an instance with the specified graph, vertex priors, and 'random jump' probability (alpha). The outgoing edge weights for each vertex will be equal and sum to 1.
        Parameters:
        graph - the input graph
        vertex_priors - the prior probabilities for each vertex
        alpha - the probability of executing a 'random jump' at each step
    • Method Detail

      • update

        public double update​(V v)
        Updates the value for this vertex. Called by step().
        Specified by:
        update in class AbstractIterativeScorer<V,​E,​java.lang.Double>
        Parameters:
        v - the vertex whose value is to be updated
        Returns:
        the updated value
      • afterStep

        protected void afterStep()
        Cleans up after each step. In this case that involves allocating the disappearing potential (thus maintaining normalization of the scores) according to the vertex probability priors, and then calling super.afterStep.
        Overrides:
        afterStep in class AbstractIterativeScorer<V,​E,​java.lang.Double>
      • collectDisappearingPotential

        protected void collectDisappearingPotential​(V v)
        Collects the "disappearing potential" associated with vertices that have no outgoing edges. Vertices that have no outgoing edges do not directly contribute to the scores of other vertices. These values are collected at each step and then distributed across all vertices as a part of the normalization process.
        Overrides:
        collectDisappearingPotential in class AbstractIterativeScorer<V,​E,​java.lang.Double>
        Parameters:
        v - the vertex whose potential is being collected