Class AbstractGraph<N>

    • Constructor Detail

      • AbstractGraph

        public AbstractGraph()
        Constructor for use by subclasses.
    • Method Detail

      • equals

        public final boolean equals​(@CheckForNull
                                    Object obj)
        Description copied from interface: Graph
        Returns true iff object is a Graph that has the same elements and the same structural relationships as those in this graph.

        Thus, two graphs A and B are equal if all of the following are true:

        Graph properties besides directedness do not affect equality. For example, two graphs may be considered equal even if one allows self-loops and the other doesn't. Additionally, the order in which nodes or edges are added to the graph, and the order in which they are iterated over, are irrelevant.

        A reference implementation of this is provided by equals(Object).

        Specified by:
        equals in interface Graph<N>
        Overrides:
        equals in class Object
      • hashCode

        public final int hashCode()
        Description copied from interface: Graph
        Returns the hash code for this graph. The hash code of a graph is defined as the hash code of the set returned by Graph.edges().

        A reference implementation of this is provided by hashCode().

        Specified by:
        hashCode in interface Graph<N>
        Overrides:
        hashCode in class Object
      • edgeCount

        protected long edgeCount()
        Returns the number of edges in this graph; used to calculate the size of Graph.edges(). This implementation requires O(|N|) time. Classes extending this one may manually keep track of the number of edges as the graph is updated, and override this method for better performance.
      • incidentEdgeOrder

        public ElementOrder<N> incidentEdgeOrder()
      • degree

        public int degree​(N node)
      • inDegree

        public int inDegree​(N node)
      • outDegree

        public int outDegree​(N node)
      • hasEdgeConnecting

        public boolean hasEdgeConnecting​(N nodeU,
                                         N nodeV)
      • hasEdgeConnecting

        public boolean hasEdgeConnecting​(EndpointPair<N> endpoints)
      • validateEndpoints

        protected final void validateEndpoints​(EndpointPair<?> endpoints)
        Throws IllegalArgumentException if the ordering of endpoints is not compatible with the directionality of this graph.
      • isOrderingCompatible

        protected final boolean isOrderingCompatible​(EndpointPair<?> endpoints)
        Returns true iff endpoints' ordering is compatible with the directionality of this graph.
      • nodeInvalidatableSet

        protected final <T> Set<T> nodeInvalidatableSet​(Set<T> set,
                                                        N node)
      • nodePairInvalidatableSet

        protected final <T> Set<T> nodePairInvalidatableSet​(Set<T> set,
                                                            N nodeU,
                                                            N nodeV)