private static class Graphs.TransposedGraph<N> extends ForwardingGraph<N>
Constructor and Description |
---|
TransposedGraph(Graph<N> graph) |
Modifier and Type | Method and Description |
---|---|
(package private) Graph<N> |
delegate() |
boolean |
hasEdgeConnecting(EndpointPair<N> endpoints)
Returns true if there is an edge that directly connects
endpoints (in the order, if
any, specified by endpoints ). |
boolean |
hasEdgeConnecting(N nodeU,
N nodeV)
Returns true if there is an edge that directly connects
nodeU to nodeV . |
java.util.Set<EndpointPair<N>> |
incidentEdges(N node)
Returns the edges in this graph whose endpoints include
node . |
int |
inDegree(N node)
Returns the count of
node 's incoming edges (equal to predecessors(node).size() )
in a directed graph. |
int |
outDegree(N node)
Returns the count of
node 's outgoing edges (equal to successors(node).size() )
in a directed graph. |
java.util.Set<N> |
predecessors(N node)
Returns all nodes in this graph 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 graph adjacent to
node which can be reached by traversing
node 's outgoing edges in the direction (if any) of the edge. |
adjacentNodes, allowsSelfLoops, degree, edgeCount, incidentEdgeOrder, isDirected, nodeOrder, nodes
equals, hashCode, toString
edges, isOrderingCompatible, validateEndpoints
Graph<N> delegate()
delegate
in class ForwardingGraph<N>
public java.util.Set<N> predecessors(N node)
Graph
node
which can be reached by traversing
node
's incoming edges against the direction (if any) of the edge.
In an undirected graph, this is equivalent to Graph.adjacentNodes(Object)
.
predecessors
in interface BaseGraph<N>
predecessors
in interface Graph<N>
predecessors
in interface PredecessorsFunction<N>
predecessors
in class ForwardingGraph<N>
public java.util.Set<N> successors(N node)
Graph
node
which can be reached by traversing
node
's outgoing edges in the direction (if any) of the edge.
In an undirected graph, this is equivalent to Graph.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 BaseGraph<N>
successors
in interface Graph<N>
successors
in interface SuccessorsFunction<N>
successors
in class ForwardingGraph<N>
public java.util.Set<EndpointPair<N>> incidentEdges(N node)
BaseGraph
node
.
This is equal to the union of incoming and outgoing edges.
incidentEdges
in interface BaseGraph<N>
incidentEdges
in interface Graph<N>
incidentEdges
in class ForwardingGraph<N>
public int inDegree(N node)
BaseGraph
node
's incoming edges (equal to predecessors(node).size()
)
in a directed graph. In an undirected graph, returns the BaseGraph.degree(Object)
.
If the count is greater than Integer.MAX_VALUE
, returns Integer.MAX_VALUE
.
public int outDegree(N node)
BaseGraph
node
's outgoing edges (equal to successors(node).size()
)
in a directed graph. In an undirected graph, returns the BaseGraph.degree(Object)
.
If the count is greater than Integer.MAX_VALUE
, returns Integer.MAX_VALUE
.
public boolean hasEdgeConnecting(N nodeU, N nodeV)
BaseGraph
nodeU
to nodeV
. This is
equivalent to nodes().contains(nodeU) && successors(nodeU).contains(nodeV)
.
In an undirected graph, this is equal to hasEdgeConnecting(nodeV, nodeU)
.
hasEdgeConnecting
in interface BaseGraph<N>
hasEdgeConnecting
in interface Graph<N>
hasEdgeConnecting
in class ForwardingGraph<N>
public boolean hasEdgeConnecting(EndpointPair<N> endpoints)
BaseGraph
endpoints
(in the order, if
any, specified by endpoints
). This is equivalent to edges().contains(endpoints)
.
Unlike the other EndpointPair
-accepting methods, this method does not throw if the
endpoints are unordered; it simply returns false. This is for consistency with the behavior of
Collection#contains(Object)
(which does not generally throw if the object cannot be
present in the collection), and the desire to have this method's behavior be compatible with
edges().contains(endpoints)
.
hasEdgeConnecting
in interface BaseGraph<N>
hasEdgeConnecting
in interface Graph<N>
hasEdgeConnecting
in class ForwardingGraph<N>