Class AbstractGraph<V,​E>

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

    public abstract class AbstractGraph<V,​E>
    extends java.lang.Object
    implements edu.uci.ics.jung.graph.Graph<V,​E>, java.io.Serializable
    Abstract implementation of the Graph interface. Designed to simplify implementation of new graph classes.
    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor Description
      AbstractGraph()  
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      boolean addEdge​(E edge, edu.uci.ics.jung.graph.util.Pair<? extends V> endpoints)
      Adds edge to this graph with the specified endpoints, with the default edge type.
      abstract boolean addEdge​(E edge, edu.uci.ics.jung.graph.util.Pair<? extends V> endpoints, edu.uci.ics.jung.graph.util.EdgeType edgeType)
      Adds edge to this graph with the specified endpoints and EdgeType.
      boolean addEdge​(E edge, java.util.Collection<? extends V> vertices)  
      boolean addEdge​(E edge, java.util.Collection<? extends V> vertices, edu.uci.ics.jung.graph.util.EdgeType edgeType)  
      boolean addEdge​(E e, V v1, V v2)  
      boolean addEdge​(E e, V v1, V v2, edu.uci.ics.jung.graph.util.EdgeType edge_type)  
      int degree​(V vertex)  
      E findEdge​(V v1, V v2)  
      java.util.Collection<E> findEdgeSet​(V v1, V v2)  
      int getIncidentCount​(E edge)  
      java.util.Collection<V> getIncidentVertices​(E edge)  
      int getNeighborCount​(V vertex)  
      V getOpposite​(V vertex, E edge)  
      int getPredecessorCount​(V vertex)  
      int getSuccessorCount​(V vertex)  
      protected edu.uci.ics.jung.graph.util.Pair<V> getValidatedEndpoints​(E edge, edu.uci.ics.jung.graph.util.Pair<? extends V> endpoints)  
      int inDegree​(V vertex)  
      boolean isIncident​(V vertex, E edge)  
      boolean isNeighbor​(V v1, V v2)  
      boolean isPredecessor​(V v1, V v2)  
      boolean isSuccessor​(V v1, V v2)  
      int outDegree​(V vertex)  
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface edu.uci.ics.jung.graph.Graph

        getDest, getEndpoints, getInEdges, getOutEdges, getPredecessors, getSource, getSuccessors, isDest, isSource
      • Methods inherited from interface edu.uci.ics.jung.graph.Hypergraph

        addVertex, containsEdge, containsVertex, getDefaultEdgeType, getEdgeCount, getEdgeCount, getEdges, getEdges, getEdgeType, getIncidentEdges, getNeighbors, getVertexCount, getVertices, removeEdge, removeVertex
    • Constructor Detail

      • AbstractGraph

        public AbstractGraph()
    • Method Detail

      • addEdge

        public boolean addEdge​(E edge,
                               java.util.Collection<? extends V> vertices)
        Specified by:
        addEdge in interface edu.uci.ics.jung.graph.Hypergraph<V,​E>
      • addEdge

        public boolean addEdge​(E edge,
                               java.util.Collection<? extends V> vertices,
                               edu.uci.ics.jung.graph.util.EdgeType edgeType)
        Specified by:
        addEdge in interface edu.uci.ics.jung.graph.Hypergraph<V,​E>
      • addEdge

        public boolean addEdge​(E e,
                               V v1,
                               V v2)
        Specified by:
        addEdge in interface edu.uci.ics.jung.graph.Graph<V,​E>
      • addEdge

        public boolean addEdge​(E e,
                               V v1,
                               V v2,
                               edu.uci.ics.jung.graph.util.EdgeType edge_type)
        Specified by:
        addEdge in interface edu.uci.ics.jung.graph.Graph<V,​E>
      • addEdge

        public boolean addEdge​(E edge,
                               edu.uci.ics.jung.graph.util.Pair<? extends V> endpoints)
        Adds edge to this graph with the specified endpoints, with the default edge type.
        Returns:
        true iff the graph was modified as a result of this call
      • addEdge

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

        protected edu.uci.ics.jung.graph.util.Pair<V> getValidatedEndpoints​(E edge,
                                                                            edu.uci.ics.jung.graph.util.Pair<? extends V> endpoints)
      • inDegree

        public int inDegree​(V vertex)
        Specified by:
        inDegree in interface edu.uci.ics.jung.graph.Graph<V,​E>
        Specified by:
        inDegree in interface edu.uci.ics.jung.graph.Hypergraph<V,​E>
      • outDegree

        public int outDegree​(V vertex)
        Specified by:
        outDegree in interface edu.uci.ics.jung.graph.Graph<V,​E>
        Specified by:
        outDegree in interface edu.uci.ics.jung.graph.Hypergraph<V,​E>
      • isPredecessor

        public boolean isPredecessor​(V v1,
                                     V v2)
        Specified by:
        isPredecessor in interface edu.uci.ics.jung.graph.Graph<V,​E>
      • isSuccessor

        public boolean isSuccessor​(V v1,
                                   V v2)
        Specified by:
        isSuccessor in interface edu.uci.ics.jung.graph.Graph<V,​E>
      • getPredecessorCount

        public int getPredecessorCount​(V vertex)
        Specified by:
        getPredecessorCount in interface edu.uci.ics.jung.graph.Graph<V,​E>
      • getSuccessorCount

        public int getSuccessorCount​(V vertex)
        Specified by:
        getSuccessorCount in interface edu.uci.ics.jung.graph.Graph<V,​E>
      • isNeighbor

        public boolean isNeighbor​(V v1,
                                  V v2)
        Specified by:
        isNeighbor in interface edu.uci.ics.jung.graph.Hypergraph<V,​E>
      • isIncident

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

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

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

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

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

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

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

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

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object