Class FastLookupDirectedSpecifics<V,​E>

  • Type Parameters:
    V - the graph vertex type
    E - the graph edge type
    All Implemented Interfaces:
    java.io.Serializable, Specifics<V,​E>

    public class FastLookupDirectedSpecifics<V,​E>
    extends DirectedSpecifics<V,​E>
    Fast implementation of DirectedSpecifics. This class uses additional data structures to improve the performance of methods which depend on edge retrievals, e.g. getEdge(V u, V v), containsEdge(V u, V v),addEdge(V u, V v). A disadvantage is an increase in memory consumption. If memory utilization is an issue, use a DirectedSpecifics instead.
    See Also:
    Serialized Form
    • Constructor Detail

      • FastLookupDirectedSpecifics

        public FastLookupDirectedSpecifics​(AbstractBaseGraph<V,​E> abstractBaseGraph)
        Construct a new fast lookup directed specifics.
        Parameters:
        abstractBaseGraph - the graph for which these specifics are for
      • FastLookupDirectedSpecifics

        public FastLookupDirectedSpecifics​(AbstractBaseGraph<V,​E> abstractBaseGraph,
                                           java.util.Map<V,​DirectedEdgeContainer<V,​E>> vertexMap)
        Construct a new fast lookup directed specifics.
        Parameters:
        abstractBaseGraph - the graph for which these specifics are for
        vertexMap - map for the storage of vertex edge sets
      • FastLookupDirectedSpecifics

        public FastLookupDirectedSpecifics​(AbstractBaseGraph<V,​E> abstractBaseGraph,
                                           java.util.Map<V,​DirectedEdgeContainer<V,​E>> vertexMap,
                                           EdgeSetFactory<V,​E> edgeSetFactory)
        Construct a new fast lookup directed specifics.
        Parameters:
        abstractBaseGraph - the graph for which these specifics are for
        vertexMap - map for the storage of vertex edge sets
        edgeSetFactory - factory for the creation of vertex edge sets
    • Method Detail

      • getAllEdges

        public java.util.Set<E> getAllEdges​(V sourceVertex,
                                            V targetVertex)
        Returns a set of all edges connecting source vertex to target vertex if such vertices exist in this graph. If any of the vertices does not exist or is null, returns null. If both vertices exist but no edges found, returns an empty set.
        Specified by:
        getAllEdges in interface Specifics<V,​E>
        Overrides:
        getAllEdges in class DirectedSpecifics<V,​E>
        Parameters:
        sourceVertex - source vertex of the edge.
        targetVertex - target vertex of the edge.
        Returns:
        a set of all edges connecting source vertex to target vertex.
      • getEdge

        public E getEdge​(V sourceVertex,
                         V targetVertex)
        Returns an edge connecting source vertex to target vertex if such vertices and such edge exist in this graph. Otherwise returns null. If any of the specified vertices is null returns null

        In undirected graphs, the returned edge may have its source and target vertices in the opposite order.

        Specified by:
        getEdge in interface Specifics<V,​E>
        Overrides:
        getEdge in class DirectedSpecifics<V,​E>
        Parameters:
        sourceVertex - source vertex of the edge.
        targetVertex - target vertex of the edge.
        Returns:
        an edge connecting source vertex to target vertex.