private static class Graphs.TransposedNetwork<N,E> extends ForwardingNetwork<N,E>
Constructor and Description |
---|
TransposedNetwork(Network<N,E> network) |
Modifier and Type | Method and Description |
---|---|
protected 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. |
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 . |
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 . |
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. |
adjacentEdges, adjacentNodes, allowsParallelEdges, allowsSelfLoops, degree, edgeOrder, edges, incidentEdges, isDirected, nodeOrder, nodes
asGraph, equals, hashCode, toString
public java.util.Set<N> predecessors(N node)
Network
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)
.
predecessors
in interface Network<N,E>
predecessors
in interface PredecessorsFunction<N>
predecessors
in class ForwardingNetwork<N,E>
public java.util.Set<N> successors(N node)
Network
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)
.
successors
in interface Network<N,E>
successors
in interface SuccessorsFunction<N>
successors
in class ForwardingNetwork<N,E>
public int inDegree(N node)
Network
node
's incoming edges
in a directed
network. In an undirected network, returns the Network.degree(Object)
.
If the count is greater than Integer.MAX_VALUE
, returns Integer.MAX_VALUE
.
public int outDegree(N node)
Network
node
's outgoing edges
in a directed
network. In an undirected network, returns the Network.degree(Object)
.
If the count is greater than Integer.MAX_VALUE
, returns Integer.MAX_VALUE
.
public java.util.Set<E> inEdges(N node)
Network
node
.
In a directed network, an incoming edge's EndpointPair.target()
equals node
.
In an undirected network, this is equivalent to Network.incidentEdges(Object)
.
public java.util.Set<E> outEdges(N node)
Network
node
.
In a directed network, an outgoing edge's EndpointPair.source()
equals node
.
In an undirected network, this is equivalent to Network.incidentEdges(Object)
.
public EndpointPair<N> incidentNodes(E edge)
Network
edge
in this network.incidentNodes
in interface Network<N,E>
incidentNodes
in class ForwardingNetwork<N,E>
public java.util.Set<E> edgesConnecting(N nodeU, N nodeV)
Network
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()
).
edgesConnecting
in interface Network<N,E>
edgesConnecting
in class ForwardingNetwork<N,E>
public java.util.Optional<E> edgeConnecting(N nodeU, N nodeV)
Network
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)
.
edgeConnecting
in interface Network<N,E>
edgeConnecting
in class ForwardingNetwork<N,E>
public E edgeConnectingOrNull(N nodeU, N nodeV)
Network
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)
.
edgeConnectingOrNull
in interface Network<N,E>
edgeConnectingOrNull
in class ForwardingNetwork<N,E>
public boolean hasEdgeConnecting(N nodeU, N nodeV)
Network
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)
.
hasEdgeConnecting
in interface Network<N,E>
hasEdgeConnecting
in class ForwardingNetwork<N,E>