Class StandardMutableGraph<N>

    • Constructor Detail

    • Method Detail

      • addNode

        public boolean addNode​(N node)
        Description copied from interface: MutableGraph
        Adds node if it is not already present.

        Nodes must be unique, just as Map keys must be. They must also be non-null.

        Specified by:
        addNode in interface MutableGraph<N>
        Returns:
        true if the graph was modified as a result of this call
      • putEdge

        public boolean putEdge​(N nodeU,
                               N nodeV)
        Description copied from interface: MutableGraph
        Adds an edge connecting nodeU to nodeV if one is not already present.

        If the graph is directed, the resultant edge will be directed; otherwise, it will be undirected.

        If nodeU and nodeV are not already present in this graph, this method will silently add nodeU and nodeV to the graph.

        Specified by:
        putEdge in interface MutableGraph<N>
        Returns:
        true if the graph was modified as a result of this call
      • putEdge

        public boolean putEdge​(EndpointPair<N> endpoints)
        Description copied from interface: MutableGraph
        Adds an edge connecting endpoints (in the order, if any, specified by endpoints) if one is not already present.

        If this graph is directed, endpoints must be ordered and the added edge will be directed; if it is undirected, the added edge will be undirected.

        If this graph is directed, endpoints must be ordered.

        If either or both endpoints are not already present in this graph, this method will silently add each missing endpoint to the graph.

        Specified by:
        putEdge in interface MutableGraph<N>
        Returns:
        true if the graph was modified as a result of this call
      • removeNode

        public boolean removeNode​(N node)
        Description copied from interface: MutableGraph
        Removes node if it is present; all edges incident to node will also be removed.
        Specified by:
        removeNode in interface MutableGraph<N>
        Returns:
        true if the graph was modified as a result of this call
      • removeEdge

        public boolean removeEdge​(N nodeU,
                                  N nodeV)
        Description copied from interface: MutableGraph
        Removes the edge connecting nodeU to nodeV, if it is present.
        Specified by:
        removeEdge in interface MutableGraph<N>
        Returns:
        true if the graph was modified as a result of this call
      • removeEdge

        public boolean removeEdge​(EndpointPair<N> endpoints)
        Description copied from interface: MutableGraph
        Removes the edge connecting endpoints, if it is present.

        If this graph is directed, endpoints must be ordered.

        Specified by:
        removeEdge in interface MutableGraph<N>
        Returns:
        true if the graph was modified as a result of this call