Class ForwardingNetwork<N,​E>

    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      java.util.Set<E> adjacentEdges​(E edge)
      Returns the edges which have an incident node in common with edge.
      java.util.Set<N> adjacentNodes​(N node)
      Returns the nodes which have an incident edge in common with node in this network.
      boolean allowsParallelEdges()
      Returns true if this network allows parallel edges.
      boolean allowsSelfLoops()
      Returns true if this network allows self-loops (edges that connect a node to itself).
      int degree​(N node)
      Returns the count of node's incident edges, counting self-loops twice (equivalently, the number of times an edge touches node).
      protected abstract Network<N,​E> delegate()  
      java.util.Optional<E> edgeConnecting​(N nodeU, N nodeV)
      Returns the single edge directly connecting nodeU to nodeV, if one is present, or Optional.empty() if no such edge exists.
      E edgeConnectingOrNull​(N nodeU, N nodeV)
      Returns the single edge directly connecting nodeU to nodeV, if one is present, or null if no such edge exists.
      ElementOrder<E> edgeOrder()
      Returns the order of iteration for the elements of Network.edges().
      java.util.Set<E> edges()
      Returns all edges in this network, in the order specified by Network.edgeOrder().
      java.util.Set<E> edgesConnecting​(N nodeU, N nodeV)
      Returns the set of edges directly connecting nodeU to nodeV.
      boolean hasEdgeConnecting​(N nodeU, N nodeV)
      Returns true if there is an edge directly connecting nodeU to nodeV.
      java.util.Set<E> incidentEdges​(N node)
      Returns the edges whose incident nodes in this network include node.
      EndpointPair<N> incidentNodes​(E edge)
      Returns the nodes which are the endpoints of edge in this network.
      int inDegree​(N node)
      Returns the count of node's incoming edges in a directed network.
      java.util.Set<E> inEdges​(N node)
      Returns all edges in this network which can be traversed in the direction (if any) of the edge to end at node.
      boolean isDirected()
      Returns true if the edges in this network are directed.
      ElementOrder<N> nodeOrder()
      Returns the order of iteration for the elements of Network.nodes().
      java.util.Set<N> nodes()
      Returns all nodes in this network, in the order specified by Network.nodeOrder().
      int outDegree​(N node)
      Returns the count of node's outgoing edges in a directed network.
      java.util.Set<E> outEdges​(N node)
      Returns all edges in this network which can be traversed in the direction (if any) of the edge starting from node.
      java.util.Set<N> predecessors​(N node)
      Returns all nodes in this network adjacent to node which can be reached by traversing node's incoming edges against the direction (if any) of the edge.
      java.util.Set<N> successors​(N node)
      Returns all nodes in this network adjacent to node which can be reached by traversing node's outgoing edges in the direction (if any) of the edge.
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • ForwardingNetwork

        ForwardingNetwork()
    • Method Detail

      • delegate

        protected abstract Network<N,​E> delegate()
      • nodes

        public java.util.Set<N> nodes()
        Description copied from interface: Network
        Returns all nodes in this network, in the order specified by Network.nodeOrder().
      • edges

        public java.util.Set<E> edges()
        Description copied from interface: Network
        Returns all edges in this network, in the order specified by Network.edgeOrder().
      • isDirected

        public boolean isDirected()
        Description copied from interface: Network
        Returns true if the edges in this network are directed. Directed edges connect a source node to a target node, while undirected edges connect a pair of nodes to each other.
      • allowsParallelEdges

        public boolean allowsParallelEdges()
        Description copied from interface: Network
        Returns true if this network allows parallel edges. Attempting to add a parallel edge to a network that does not allow them will throw an IllegalArgumentException.
      • allowsSelfLoops

        public boolean allowsSelfLoops()
        Description copied from interface: Network
        Returns true if this network allows self-loops (edges that connect a node to itself). Attempting to add a self-loop to a network that does not allow them will throw an IllegalArgumentException.
      • adjacentNodes

        public java.util.Set<N> adjacentNodes​(N node)
        Description copied from interface: Network
        Returns the nodes which have an incident edge in common with node in this network.
      • predecessors

        public java.util.Set<N> predecessors​(N node)
        Description copied from interface: Network
        Returns all nodes in this network adjacent to node which can be reached by traversing node's incoming edges against the direction (if any) of the edge.

        In an undirected network, this is equivalent to Network.adjacentNodes(Object).

      • successors

        public java.util.Set<N> successors​(N node)
        Description copied from interface: Network
        Returns all nodes in this network adjacent to node which can be reached by traversing node's outgoing edges in the direction (if any) of the edge.

        In an undirected network, this is equivalent to Network.adjacentNodes(Object).

        This is not the same as "all nodes reachable from node by following outgoing edges". For that functionality, see Graphs.reachableNodes(Graph, Object).

      • incidentEdges

        public java.util.Set<E> incidentEdges​(N node)
        Description copied from interface: Network
        Returns the edges whose incident nodes in this network include node.
      • inEdges

        public java.util.Set<E> inEdges​(N node)
        Description copied from interface: Network
        Returns all edges in this network which can be traversed in the direction (if any) of the edge to end at node.

        In a directed network, an incoming edge's EndpointPair.target() equals node.

        In an undirected network, this is equivalent to Network.incidentEdges(Object).

      • outEdges

        public java.util.Set<E> outEdges​(N node)
        Description copied from interface: Network
        Returns all edges in this network which can be traversed in the direction (if any) of the edge starting from node.

        In a directed network, an outgoing edge's EndpointPair.source() equals node.

        In an undirected network, this is equivalent to Network.incidentEdges(Object).

      • incidentNodes

        public EndpointPair<N> incidentNodes​(E edge)
        Description copied from interface: Network
        Returns the nodes which are the endpoints of edge in this network.
      • degree

        public int degree​(N node)
        Description copied from interface: Network
        Returns the count of node's incident edges, counting self-loops twice (equivalently, the number of times an edge touches node).

        For directed networks, this is equal to inDegree(node) + outDegree(node).

        For undirected networks, this is equal to incidentEdges(node).size() + (number of self-loops incident to node).

        If the count is greater than Integer.MAX_VALUE, returns Integer.MAX_VALUE.

        Specified by:
        degree in interface Network<N,​E>
        Overrides:
        degree in class AbstractNetwork<N,​E>
      • edgesConnecting

        public java.util.Set<E> edgesConnecting​(N nodeU,
                                                N nodeV)
        Description copied from interface: Network
        Returns the set of edges directly connecting nodeU to nodeV.

        In an undirected network, this is equal to edgesConnecting(nodeV, nodeU).

        The resulting set of edges will be parallel (i.e. have equal Network.incidentNodes(Object). If this network does not allow parallel edges, the resulting set will contain at most one edge (equivalent to edgeConnecting(nodeU, nodeV).asSet()).

        Specified by:
        edgesConnecting in interface Network<N,​E>
        Overrides:
        edgesConnecting in class AbstractNetwork<N,​E>
      • edgeConnecting

        public java.util.Optional<E> edgeConnecting​(N nodeU,
                                                    N nodeV)
        Description copied from interface: Network
        Returns the single edge directly connecting nodeU to nodeV, if one is present, or Optional.empty() if no such edge exists.

        In an undirected network, this is equal to edgeConnecting(nodeV, nodeU).

        Specified by:
        edgeConnecting in interface Network<N,​E>
        Overrides:
        edgeConnecting in class AbstractNetwork<N,​E>
      • edgeConnectingOrNull

        public E edgeConnectingOrNull​(N nodeU,
                                      N nodeV)
        Description copied from interface: Network
        Returns the single edge directly connecting nodeU to nodeV, if one is present, or null if no such edge exists.

        In an undirected network, this is equal to edgeConnectingOrNull(nodeV, nodeU).

        Specified by:
        edgeConnectingOrNull in interface Network<N,​E>
        Overrides:
        edgeConnectingOrNull in class AbstractNetwork<N,​E>
      • hasEdgeConnecting

        public boolean hasEdgeConnecting​(N nodeU,
                                         N nodeV)
        Description copied from interface: Network
        Returns true if there is an edge directly connecting nodeU to nodeV. This is equivalent to nodes().contains(nodeU) && successors(nodeU).contains(nodeV), and to edgeConnectingOrNull(nodeU, nodeV) != null.

        In an undirected graph, this is equal to hasEdgeConnecting(nodeV, nodeU).

        Specified by:
        hasEdgeConnecting in interface Network<N,​E>
        Overrides:
        hasEdgeConnecting in class AbstractNetwork<N,​E>