Interface GraphConnections<N,​V>

  • Type Parameters:
    N - Node parameter type
    V - Value parameter type
    All Known Implementing Classes:
    DirectedGraphConnections, UndirectedGraphConnections

    interface GraphConnections<N,​V>
    An interface for representing and manipulating an origin node's adjacent nodes and edge values in a Graph.
    • Method Detail

      • adjacentNodes

        java.util.Set<N> adjacentNodes()
      • predecessors

        java.util.Set<N> predecessors()
      • successors

        java.util.Set<N> successors()
      • value

        @Nullable
        V value​(java.lang.Object node)
        Returns the value associated with the edge connecting the origin node to node, or null if there is no such edge.
      • removePredecessor

        void removePredecessor​(java.lang.Object node)
        Remove node from the set of predecessors.
      • removeSuccessor

        V removeSuccessor​(java.lang.Object node)
        Remove node from the set of successors. Returns the value previously associated with the edge connecting the two nodes.
      • addPredecessor

        void addPredecessor​(N node,
                            V value)
        Add node as a predecessor to the origin node. In the case of an undirected graph, it also becomes a successor. Associates value with the edge connecting the two nodes.
      • addSuccessor

        V addSuccessor​(N node,
                       V value)
        Add node as a successor to the origin node. In the case of an undirected graph, it also becomes a predecessor. Associates value with the edge connecting the two nodes. Returns the value previously associated with the edge connecting the two nodes.