Class IncidentEdgeIndexFunction<V,​E>

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

    public class IncidentEdgeIndexFunction<V,​E>
    extends java.lang.Object
    implements EdgeIndexFunction<V,​E>
    A class which creates and maintains indices for incident edges.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected java.util.Map<E,​java.lang.Integer> edge_index  
    • Field Detail

      • edge_index

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

      • getInstance

        public static <V,​E> IncidentEdgeIndexFunction<V,​E> getInstance()
        Returns an instance of this type.
        Type Parameters:
        V - the vertex type
        E - the edge type
      • 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 in which the edge is to be queried
        e - the edge whose index is to be queried
        Returns:
        e's index in graph
      • getIndex

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

        protected int getIndex​(Graph<V,​E> graph,
                               E e,
                               V v)
      • 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.
        Specified by:
        reset in interface EdgeIndexFunction<V,​E>
        Parameters:
        e -
        graph - the graph in which edge's index is to be reset
      • 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>