Class DirectedSparseMultigraph<V,​E>

  • All Implemented Interfaces:
    edu.uci.ics.jung.graph.DirectedGraph<V,​E>, edu.uci.ics.jung.graph.Graph<V,​E>, edu.uci.ics.jung.graph.Hypergraph<V,​E>, edu.uci.ics.jung.graph.MultiGraph<V,​E>, java.io.Serializable
    Direct Known Subclasses:
    DirectedOrderedSparseMultigraph

    public class DirectedSparseMultigraph<V,​E>
    extends AbstractTypedGraph<V,​E>
    implements edu.uci.ics.jung.graph.DirectedGraph<V,​E>, edu.uci.ics.jung.graph.MultiGraph<V,​E>
    An implementation of DirectedGraph, suitable for sparse graphs, that permits parallel edges.
    See Also:
    Serialized Form
    • Field Detail

      • vertices

        protected java.util.Map<V,​edu.uci.ics.jung.graph.util.Pair<java.util.Set<E>>> vertices
      • edges

        protected java.util.Map<E,​edu.uci.ics.jung.graph.util.Pair<V>> edges
    • Constructor Detail

      • DirectedSparseMultigraph

        public DirectedSparseMultigraph()
        Creates a new instance.
    • Method Detail

      • getFactory

        public static <V,​E> org.apache.commons.collections4.Factory<edu.uci.ics.jung.graph.DirectedGraph<V,​E>> getFactory()
        Returns a Factory that creates an instance of this graph type.
        Type Parameters:
        V - the vertex type for the graph factory
        E - the edge type for the graph factory
      • getEdges

        public java.util.Collection<E> getEdges()
        Specified by:
        getEdges in interface edu.uci.ics.jung.graph.Hypergraph<V,​E>
      • getVertices

        public java.util.Collection<V> getVertices()
        Specified by:
        getVertices in interface edu.uci.ics.jung.graph.Hypergraph<V,​E>
      • containsVertex

        public boolean containsVertex​(V vertex)
        Specified by:
        containsVertex in interface edu.uci.ics.jung.graph.Hypergraph<V,​E>
      • containsEdge

        public boolean containsEdge​(E edge)
        Specified by:
        containsEdge in interface edu.uci.ics.jung.graph.Hypergraph<V,​E>
      • getIncoming_internal

        protected java.util.Collection<E> getIncoming_internal​(V vertex)
      • getOutgoing_internal

        protected java.util.Collection<E> getOutgoing_internal​(V vertex)
      • addVertex

        public boolean addVertex​(V vertex)
        Specified by:
        addVertex in interface edu.uci.ics.jung.graph.Hypergraph<V,​E>
      • removeVertex

        public boolean removeVertex​(V vertex)
        Specified by:
        removeVertex in interface edu.uci.ics.jung.graph.Hypergraph<V,​E>
      • removeEdge

        public boolean removeEdge​(E edge)
        Specified by:
        removeEdge in interface edu.uci.ics.jung.graph.Hypergraph<V,​E>
      • getInEdges

        public java.util.Collection<E> getInEdges​(V vertex)
        Specified by:
        getInEdges in interface edu.uci.ics.jung.graph.Graph<V,​E>
        Specified by:
        getInEdges in interface edu.uci.ics.jung.graph.Hypergraph<V,​E>
      • getOutEdges

        public java.util.Collection<E> getOutEdges​(V vertex)
        Specified by:
        getOutEdges in interface edu.uci.ics.jung.graph.Graph<V,​E>
        Specified by:
        getOutEdges in interface edu.uci.ics.jung.graph.Hypergraph<V,​E>
      • getPredecessors

        public java.util.Collection<V> getPredecessors​(V vertex)
        Specified by:
        getPredecessors in interface edu.uci.ics.jung.graph.Graph<V,​E>
        Specified by:
        getPredecessors in interface edu.uci.ics.jung.graph.Hypergraph<V,​E>
      • getSuccessors

        public java.util.Collection<V> getSuccessors​(V vertex)
        Specified by:
        getSuccessors in interface edu.uci.ics.jung.graph.Graph<V,​E>
        Specified by:
        getSuccessors in interface edu.uci.ics.jung.graph.Hypergraph<V,​E>
      • getNeighbors

        public java.util.Collection<V> getNeighbors​(V vertex)
        Specified by:
        getNeighbors in interface edu.uci.ics.jung.graph.Hypergraph<V,​E>
      • getIncidentEdges

        public java.util.Collection<E> getIncidentEdges​(V vertex)
        Specified by:
        getIncidentEdges in interface edu.uci.ics.jung.graph.Hypergraph<V,​E>
      • findEdge

        public E findEdge​(V v1,
                          V v2)
        Specified by:
        findEdge in interface edu.uci.ics.jung.graph.Hypergraph<V,​E>
        Overrides:
        findEdge in class AbstractGraph<V,​E>
      • addEdge

        public boolean addEdge​(E edge,
                               edu.uci.ics.jung.graph.util.Pair<? extends V> endpoints,
                               edu.uci.ics.jung.graph.util.EdgeType edgeType)
        Description copied from class: AbstractGraph
        Adds edge to this graph with the specified endpoints and EdgeType.
        Specified by:
        addEdge in class AbstractGraph<V,​E>
        Returns:
        true iff the graph was modified as a result of this call
      • getSource

        public V getSource​(E edge)
        Specified by:
        getSource in interface edu.uci.ics.jung.graph.Graph<V,​E>
        Specified by:
        getSource in interface edu.uci.ics.jung.graph.Hypergraph<V,​E>
      • getDest

        public V getDest​(E edge)
        Specified by:
        getDest in interface edu.uci.ics.jung.graph.Graph<V,​E>
        Specified by:
        getDest in interface edu.uci.ics.jung.graph.Hypergraph<V,​E>
      • isSource

        public boolean isSource​(V vertex,
                                E edge)
        Specified by:
        isSource in interface edu.uci.ics.jung.graph.Graph<V,​E>
      • isDest

        public boolean isDest​(V vertex,
                              E edge)
        Specified by:
        isDest in interface edu.uci.ics.jung.graph.Graph<V,​E>
      • getEndpoints

        public edu.uci.ics.jung.graph.util.Pair<V> getEndpoints​(E edge)
        Specified by:
        getEndpoints in interface edu.uci.ics.jung.graph.Graph<V,​E>
      • getEdgeCount

        public int getEdgeCount()
        Specified by:
        getEdgeCount in interface edu.uci.ics.jung.graph.Hypergraph<V,​E>
      • getVertexCount

        public int getVertexCount()
        Specified by:
        getVertexCount in interface edu.uci.ics.jung.graph.Hypergraph<V,​E>