Class Graphs.TransposedNetwork<N,E>
- java.lang.Object
-
- com.google.common.graph.AbstractNetwork<N,E>
-
- com.google.common.graph.Graphs.TransposedNetwork<N,E>
-
- All Implemented Interfaces:
Network<N,E>
- Enclosing class:
- Graphs
private static class Graphs.TransposedNetwork<N,E> extends AbstractNetwork<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 java.util.Set<E>
adjacentEdges(java.lang.Object edge)
Returns the edges which have anincident node
in common withedge
.java.util.Set<N>
adjacentNodes(java.lang.Object node)
Returns the nodes which have an incident edge in common withnode
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).ElementOrder<E>
edgeOrder()
Returns the order of iteration for the elements ofNetwork.edges()
.java.util.Set<E>
edges()
Returns all edges in this network, in the order specified byNetwork.edgeOrder()
.java.util.Set<E>
edgesConnecting(java.lang.Object nodeU, java.lang.Object nodeV)
Returns the set of edges directly connectingnodeU
tonodeV
.java.util.Set<E>
incidentEdges(java.lang.Object node)
Returns the edges whoseincident nodes
in this network includenode
.EndpointPair<N>
incidentNodes(java.lang.Object edge)
Returns the nodes which are the endpoints ofedge
in this network.java.util.Set<E>
inEdges(java.lang.Object node)
Returns all edges in this network which can be traversed in the direction (if any) of the edge to end atnode
.boolean
isDirected()
Returns true if the edges in this network are directed.ElementOrder<N>
nodeOrder()
Returns the order of iteration for the elements ofNetwork.nodes()
.java.util.Set<N>
nodes()
Returns all nodes in this network, in the order specified byNetwork.nodeOrder()
.java.util.Set<E>
outEdges(java.lang.Object 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(java.lang.Object 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(java.lang.Object 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.AbstractNetwork
asGraph, degree, inDegree, outDegree, toString
-
-
-
-
Method Detail
-
nodes
public java.util.Set<N> nodes()
Description copied from interface:Network
Returns all nodes in this network, in the order specified byNetwork.nodeOrder()
.
-
edges
public java.util.Set<E> edges()
Description copied from interface:Network
Returns all edges in this network, in the order specified byNetwork.edgeOrder()
.
-
isDirected
public boolean isDirected()
Description copied from interface:Network
Returns true if the edges in this network are directed. Directed edges connect asource node
to atarget 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 anUnsupportedOperationException
.
-
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 anUnsupportedOperationException
.
-
nodeOrder
public ElementOrder<N> nodeOrder()
Description copied from interface:Network
Returns the order of iteration for the elements ofNetwork.nodes()
.
-
edgeOrder
public ElementOrder<E> edgeOrder()
Description copied from interface:Network
Returns the order of iteration for the elements ofNetwork.edges()
.
-
adjacentNodes
public java.util.Set<N> adjacentNodes(java.lang.Object node)
Description copied from interface:Network
Returns the nodes which have an incident edge in common withnode
in this network.
-
predecessors
public java.util.Set<N> predecessors(java.lang.Object 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)
.
-
successors
public java.util.Set<N> successors(java.lang.Object 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)
.
-
incidentEdges
public java.util.Set<E> incidentEdges(java.lang.Object node)
Description copied from interface:Network
Returns the edges whoseincident nodes
in this network includenode
.
-
inEdges
public java.util.Set<E> inEdges(java.lang.Object 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(java.lang.Object 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(java.lang.Object edge)
Description copied from interface:Network
Returns the nodes which are the endpoints ofedge
in this network.
-
adjacentEdges
public java.util.Set<E> adjacentEdges(java.lang.Object edge)
Description copied from interface:Network
Returns the edges which have anincident node
in common withedge
. An edge is not considered adjacent to itself.- Specified by:
adjacentEdges
in interfaceNetwork<N,E>
- Overrides:
adjacentEdges
in classAbstractNetwork<N,E>
-
edgesConnecting
public java.util.Set<E> edgesConnecting(java.lang.Object nodeU, java.lang.Object 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.
-
-