Class Graphs.TransposedNetwork<N,E>
- java.lang.Object
-
- com.google.common.graph.AbstractNetwork<N,E>
-
- com.google.common.graph.ForwardingNetwork<N,E>
-
- com.google.common.graph.Graphs.TransposedNetwork<N,E>
-
- All Implemented Interfaces:
Network<N,E>
,PredecessorsFunction<N>
,SuccessorsFunction<N>
- Enclosing class:
- Graphs
private static class Graphs.TransposedNetwork<N,E> extends ForwardingNetwork<N,E>
-
-
Constructor Summary
Constructors Constructor Description TransposedNetwork(Network<N,E> network)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Network<N,E>
delegate()
java.util.Optional<E>
edgeConnecting(N nodeU, N nodeV)
Returns the single edge directly connectingnodeU
tonodeV
, if one is present, orOptional.empty()
if no such edge exists.E
edgeConnectingOrNull(N nodeU, N nodeV)
Returns the single edge directly connectingnodeU
tonodeV
, if one is present, ornull
if no such edge exists.java.util.Set<E>
edgesConnecting(N nodeU, N nodeV)
Returns the set of edges directly connectingnodeU
tonodeV
.boolean
hasEdgeConnecting(N nodeU, N nodeV)
Returns true if there is an edge directly connectingnodeU
tonodeV
.EndpointPair<N>
incidentNodes(E edge)
Returns the nodes which are the endpoints ofedge
in this network.int
inDegree(N node)
Returns the count ofnode
'sincoming 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 atnode
.int
outDegree(N node)
Returns the count ofnode
'soutgoing 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 fromnode
.java.util.Set<N>
predecessors(N node)
Returns all nodes in this network adjacent tonode
which can be reached by traversingnode
'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 tonode
which can be reached by traversingnode
's outgoing edges in the direction (if any) of the edge.-
Methods inherited from class com.google.common.graph.ForwardingNetwork
adjacentEdges, adjacentNodes, allowsParallelEdges, allowsSelfLoops, degree, edgeOrder, edges, incidentEdges, isDirected, nodeOrder, nodes
-
Methods inherited from class com.google.common.graph.AbstractNetwork
asGraph, equals, hashCode, toString
-
-
-
-
Method Detail
-
predecessors
public java.util.Set<N> predecessors(N node)
Description copied from interface:Network
Returns all nodes in this network adjacent tonode
which can be reached by traversingnode
's incoming edges against the direction (if any) of the edge.In an undirected network, this is equivalent to
Network.adjacentNodes(Object)
.- Specified by:
predecessors
in interfaceNetwork<N,E>
- Specified by:
predecessors
in interfacePredecessorsFunction<N>
- Overrides:
predecessors
in classForwardingNetwork<N,E>
-
successors
public java.util.Set<N> successors(N node)
Description copied from interface:Network
Returns all nodes in this network adjacent tonode
which can be reached by traversingnode
'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, seeGraphs.reachableNodes(Graph, Object)
.- Specified by:
successors
in interfaceNetwork<N,E>
- Specified by:
successors
in interfaceSuccessorsFunction<N>
- Overrides:
successors
in classForwardingNetwork<N,E>
-
inDegree
public int inDegree(N node)
Description copied from interface:Network
Returns the count ofnode
'sincoming edges
in a directed network. In an undirected network, returns theNetwork.degree(Object)
.If the count is greater than
Integer.MAX_VALUE
, returnsInteger.MAX_VALUE
.
-
outDegree
public int outDegree(N node)
Description copied from interface:Network
Returns the count ofnode
'soutgoing edges
in a directed network. In an undirected network, returns theNetwork.degree(Object)
.If the count is greater than
Integer.MAX_VALUE
, returnsInteger.MAX_VALUE
.
-
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 atnode
.In a directed network, an incoming edge's
EndpointPair.target()
equalsnode
.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 fromnode
.In a directed network, an outgoing edge's
EndpointPair.source()
equalsnode
.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 ofedge
in this network.- Specified by:
incidentNodes
in interfaceNetwork<N,E>
- Overrides:
incidentNodes
in classForwardingNetwork<N,E>
-
edgesConnecting
public java.util.Set<E> edgesConnecting(N nodeU, N nodeV)
Description copied from interface:Network
Returns the set of edges directly connectingnodeU
tonodeV
.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 notallow parallel edges
, the resulting set will contain at most one edge (equivalent toedgeConnecting(nodeU, nodeV).asSet()
).- Specified by:
edgesConnecting
in interfaceNetwork<N,E>
- Overrides:
edgesConnecting
in classForwardingNetwork<N,E>
-
edgeConnecting
public java.util.Optional<E> edgeConnecting(N nodeU, N nodeV)
Description copied from interface:Network
Returns the single edge directly connectingnodeU
tonodeV
, if one is present, orOptional.empty()
if no such edge exists.In an undirected network, this is equal to
edgeConnecting(nodeV, nodeU)
.- Specified by:
edgeConnecting
in interfaceNetwork<N,E>
- Overrides:
edgeConnecting
in classForwardingNetwork<N,E>
-
edgeConnectingOrNull
public E edgeConnectingOrNull(N nodeU, N nodeV)
Description copied from interface:Network
Returns the single edge directly connectingnodeU
tonodeV
, if one is present, ornull
if no such edge exists.In an undirected network, this is equal to
edgeConnectingOrNull(nodeV, nodeU)
.- Specified by:
edgeConnectingOrNull
in interfaceNetwork<N,E>
- Overrides:
edgeConnectingOrNull
in classForwardingNetwork<N,E>
-
hasEdgeConnecting
public boolean hasEdgeConnecting(N nodeU, N nodeV)
Description copied from interface:Network
Returns true if there is an edge directly connectingnodeU
tonodeV
. This is equivalent tonodes().contains(nodeU) && successors(nodeU).contains(nodeV)
, and toedgeConnectingOrNull(nodeU, nodeV) != null
.In an undirected graph, this is equal to
hasEdgeConnecting(nodeV, nodeU)
.- Specified by:
hasEdgeConnecting
in interfaceNetwork<N,E>
- Overrides:
hasEdgeConnecting
in classForwardingNetwork<N,E>
-
-