Class PredicatedParallelEdgeIndexFunction<V,​E>

  • All Implemented Interfaces:
    EdgeIndexFunction<V,​E>

    public class PredicatedParallelEdgeIndexFunction<V,​E>
    extends java.lang.Object
    implements EdgeIndexFunction<V,​E>
    A class which creates and maintains indices for parallel edges. Edges are evaluated by a Predicate function and those that evaluate to true are excluded from computing a parallel offset
    • Field Detail

      • edge_index

        protected java.util.Map<E,​java.lang.Integer> edge_index
      • predicate

        protected com.google.common.base.Predicate<E> predicate
    • Constructor Detail

      • PredicatedParallelEdgeIndexFunction

        private PredicatedParallelEdgeIndexFunction()
        Parameters:
        graph - the graph with respect to which the index is calculated
    • Method Detail

      • getIndex

        public int getIndex​(Graph<V,​E> graph,
                            E e)
        Returns the index for the specified edge. Calculates the indices for e and for all edges parallel to e.
        Specified by:
        getIndex in interface EdgeIndexFunction<V,​E>
        Parameters:
        graph - the graph with respect to which the index is calculated
        e - the edge whose index is to be calculated
        Returns:
        the index of the edge with respect to this index function
      • getIndex

        protected int getIndex​(Graph<V,​E> graph,
                               E e,
                               V v,
                               V u)
      • getIndex

        protected int getIndex​(Graph<V,​E> graph,
                               E e,
                               V v)
      • getPredicate

        public com.google.common.base.Predicate<E> getPredicate()
      • setPredicate

        public void setPredicate​(com.google.common.base.Predicate<E> predicate)
      • reset

        public void reset​(Graph<V,​E> graph,
                          E e)
        Resets the indices for this edge and its parallel edges. Should be invoked when an edge parallel to e has been added or removed in this graph.
        Specified by:
        reset in interface EdgeIndexFunction<V,​E>
        Parameters:
        graph - the graph with respect to which the index is calculated
        e - the edge whose indices are to be reset for graph
      • reset

        public void reset()
        Clears all edge indices for all edges in all graphs. Does not recalculate the indices.
        Specified by:
        reset in interface EdgeIndexFunction<V,​E>