Top Description Constructors Methods
com.google.common.graph

pack-priv abstract Class ForwardingNetwork<N, E>

extends AbstractNetwork<N, E>
Class Inheritance
Known Direct Subclasses
com.google.common.graph.Graphs.TransposedNetwork
Annotations
@ElementTypesAreNonnullByDefault
Imports
java.util.Optional, .Set, javax.annotation.CheckForNull

A class to allow Network implementations to be backed by a provided delegate. This is not currently planned to be released as a general-purpose forwarding class.
Authors
James Sexton, Joshua O'Madadhain

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public Set<E>
adjacentEdges(E edge)

Overrides com.google.common.graph.AbstractNetwork.adjacentEdges.

Implements com.google.common.graph.Network.adjacentEdges.

Returns the edges which have an incident node in common with edge.
public Set<N>
adjacentNodes(N node)

Implements com.google.common.graph.Network.adjacentNodes.

Returns the nodes which have an incident edge in common with node in this network.
public boolean
allowsParallelEdges()

Implements com.google.common.graph.Network.allowsParallelEdges.

Returns true if this network allows parallel edges.
public boolean
allowsSelfLoops()

Implements com.google.common.graph.Network.allowsSelfLoops.

Returns true if this network allows self-loops (edges that connect a node to itself).
public int
degree(N node)

Overrides com.google.common.graph.AbstractNetwork.degree.

Implements com.google.common.graph.Network.degree.

Returns the count of node's incident edges, counting self-loops twice (equivalently, the number of times an edge touches node).
pack-priv abstract Network<N, E>
public Optional<E>
edgeConnecting(N nodeU, N nodeV)

Overrides com.google.common.graph.AbstractNetwork.edgeConnecting.

Implements com.google.common.graph.Network.edgeConnecting.

Returns the single edge that directly connects nodeU to nodeV, if one is present, or Optional.empty() if no such edge exists.
public Optional<E>
edgeConnecting(EndpointPair<N> endpoints)

Overrides com.google.common.graph.AbstractNetwork.edgeConnecting.

Implements com.google.common.graph.Network.edgeConnecting.

Returns the single edge that directly connects endpoints (in the order, if any, specified by endpoints), if one is present, or Optional.empty() if no such edge exists.
public E
edgeConnectingOrNull(N nodeU, N nodeV)

Overrides com.google.common.graph.AbstractNetwork.edgeConnectingOrNull.

Implements com.google.common.graph.Network.edgeConnectingOrNull.

Returns the single edge that directly connects nodeU to nodeV, if one is present, or null if no such edge exists.
public E
edgeConnectingOrNull(EndpointPair<N> endpoints)

Overrides com.google.common.graph.AbstractNetwork.edgeConnectingOrNull.

Implements com.google.common.graph.Network.edgeConnectingOrNull.

Returns the single edge that directly connects endpoints (in the order, if any, specified by endpoints), if one is present, or null if no such edge exists.
public ElementOrder<E>
edgeOrder()

Implements com.google.common.graph.Network.edgeOrder.

Returns the order of iteration for the elements of edges().
public Set<E>
edges()

Implements com.google.common.graph.Network.edges.

Returns all edges in this network, in the order specified by edgeOrder().
public Set<E>
edgesConnecting(N nodeU, N nodeV)

Overrides com.google.common.graph.AbstractNetwork.edgesConnecting.

Implements com.google.common.graph.Network.edgesConnecting.

Returns the set of edges that each directly connect nodeU to nodeV.
public Set<E>
edgesConnecting(EndpointPair<N> endpoints)

Overrides com.google.common.graph.AbstractNetwork.edgesConnecting.

Implements com.google.common.graph.Network.edgesConnecting.

Returns the set of edges that each directly connect endpoints (in the order, if any, specified by endpoints).
public boolean
hasEdgeConnecting(N nodeU, N nodeV)

Overrides com.google.common.graph.AbstractNetwork.hasEdgeConnecting.

Implements com.google.common.graph.Network.hasEdgeConnecting.

Returns true if there is an edge that directly connects nodeU to nodeV.
public boolean
hasEdgeConnecting(EndpointPair<N> endpoints)

Overrides com.google.common.graph.AbstractNetwork.hasEdgeConnecting.

Implements com.google.common.graph.Network.hasEdgeConnecting.

Returns true if there is an edge that directly connects endpoints (in the order, if any, specified by endpoints).
public Set<E>
incidentEdges(N node)

Implements com.google.common.graph.Network.incidentEdges.

Returns the edges whose incident nodes in this network include node.
public EndpointPair<N>
incidentNodes(E edge)

Implements com.google.common.graph.Network.incidentNodes.

Returns the nodes which are the endpoints of edge in this network.
public int
inDegree(N node)

Overrides com.google.common.graph.AbstractNetwork.inDegree.

Implements com.google.common.graph.Network.inDegree.

Returns the count of node's incoming edges in a directed network.
public Set<E>
inEdges(N node)

Implements com.google.common.graph.Network.inEdges.

Returns all edges in this network which can be traversed in the direction (if any) of the edge to end at node.
public boolean
isDirected()

Implements com.google.common.graph.Network.isDirected.

Returns true if the edges in this network are directed.
public ElementOrder<N>
nodeOrder()

Implements com.google.common.graph.Network.nodeOrder.

Returns the order of iteration for the elements of nodes().
public Set<N>
nodes()

Implements com.google.common.graph.Network.nodes.

Returns all nodes in this network, in the order specified by nodeOrder().
public int
outDegree(N node)

Overrides com.google.common.graph.AbstractNetwork.outDegree.

Implements com.google.common.graph.Network.outDegree.

Returns the count of node's outgoing edges in a directed network.
public Set<E>
outEdges(N node)

Implements com.google.common.graph.Network.outEdges.

Returns all edges in this network which can be traversed in the direction (if any) of the edge starting from node.
public Set<N>
predecessors(N node)

Implements com.google.common.graph.Network.predecessors.

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.
public Set<N>
successors(N node)

Implements com.google.common.graph.Network.successors.

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.
Inherited from com.google.common.graph.AbstractNetwork:
asGraphequalshashCodeisOrderingCompatibletoStringvalidateEndpoints

Constructor Detail

ForwardingNetworkback to summary
pack-priv ForwardingNetwork()

Method Detail

adjacentEdgesback to summary
public Set<E> adjacentEdges(E edge)

Overrides com.google.common.graph.AbstractNetwork.adjacentEdges.

Implements com.google.common.graph.Network.adjacentEdges.

Doc from com.google.common.graph.Network.adjacentEdges.

Returns the edges which have an incident node in common with edge. An edge is not considered adjacent to itself.

Annotations
@Override
adjacentNodesback to summary
public Set<N> adjacentNodes(N node)

Implements com.google.common.graph.Network.adjacentNodes.

Doc from com.google.common.graph.Network.adjacentNodes.

Returns the nodes which have an incident edge in common with node in this network.

This is equal to the union of predecessors(Object) and successors(Object).

Annotations
@Override
allowsParallelEdgesback to summary
public boolean allowsParallelEdges()

Implements com.google.common.graph.Network.allowsParallelEdges.

Doc from com.google.common.graph.Network.allowsParallelEdges.

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.

Annotations
@Override
allowsSelfLoopsback to summary
public boolean allowsSelfLoops()

Implements com.google.common.graph.Network.allowsSelfLoops.

Doc from com.google.common.graph.Network.allowsSelfLoops.

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.

Annotations
@Override
degreeback to summary
public int degree(N node)

Overrides com.google.common.graph.AbstractNetwork.degree.

Implements com.google.common.graph.Network.degree.

Doc from com.google.common.graph.Network.degree.

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.

Annotations
@Override
delegateback to summary
pack-priv abstract Network<N, E> delegate()
edgeConnectingback to summary
public Optional<E> edgeConnecting(N nodeU, N nodeV)

Overrides com.google.common.graph.AbstractNetwork.edgeConnecting.

Implements com.google.common.graph.Network.edgeConnecting.

Doc from com.google.common.graph.Network.edgeConnecting.

Returns the single edge that directly connects 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).

Annotations
@Override
edgeConnectingback to summary
public Optional<E> edgeConnecting(EndpointPair<N> endpoints)

Overrides com.google.common.graph.AbstractNetwork.edgeConnecting.

Implements com.google.common.graph.Network.edgeConnecting.

Doc from com.google.common.graph.Network.edgeConnecting.

Returns the single edge that directly connects endpoints (in the order, if any, specified by endpoints), if one is present, or Optional.empty() if no such edge exists.

If this graph is directed, the endpoints must be ordered.

Annotations
@Override
edgeConnectingOrNullback to summary
public E edgeConnectingOrNull(N nodeU, N nodeV)

Overrides com.google.common.graph.AbstractNetwork.edgeConnectingOrNull.

Implements com.google.common.graph.Network.edgeConnectingOrNull.

Doc from com.google.common.graph.Network.edgeConnectingOrNull.

Returns the single edge that directly connects 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).

Annotations
@Override
@CheckForNull
edgeConnectingOrNullback to summary
public E edgeConnectingOrNull(EndpointPair<N> endpoints)

Overrides com.google.common.graph.AbstractNetwork.edgeConnectingOrNull.

Implements com.google.common.graph.Network.edgeConnectingOrNull.

Doc from com.google.common.graph.Network.edgeConnectingOrNull.

Returns the single edge that directly connects endpoints (in the order, if any, specified by endpoints), if one is present, or null if no such edge exists.

If this graph is directed, the endpoints must be ordered.

Annotations
@Override
@CheckForNull
edgeOrderback to summary
public ElementOrder<E> edgeOrder()

Implements com.google.common.graph.Network.edgeOrder.

Doc from com.google.common.graph.Network.edgeOrder.

Returns the order of iteration for the elements of edges().

Annotations
@Override
edgesback to summary
public Set<E> edges()

Implements com.google.common.graph.Network.edges.

Doc from com.google.common.graph.Network.edges.

Returns all edges in this network, in the order specified by edgeOrder().

Annotations
@Override
edgesConnectingback to summary
public Set<E> edgesConnecting(N nodeU, N nodeV)

Overrides com.google.common.graph.AbstractNetwork.edgesConnecting.

Implements com.google.common.graph.Network.edgesConnecting.

Doc from com.google.common.graph.Network.edgesConnecting.

Returns the set of edges that each directly connect 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 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()).

Annotations
@Override
edgesConnectingback to summary
public Set<E> edgesConnecting(EndpointPair<N> endpoints)

Overrides com.google.common.graph.AbstractNetwork.edgesConnecting.

Implements com.google.common.graph.Network.edgesConnecting.

Doc from com.google.common.graph.Network.edgesConnecting.

Returns the set of edges that each directly connect endpoints (in the order, if any, specified by endpoints).

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

If this network is directed, endpoints must be ordered.

Annotations
@Override
hasEdgeConnectingback to summary
public boolean hasEdgeConnecting(N nodeU, N nodeV)

Overrides com.google.common.graph.AbstractNetwork.hasEdgeConnecting.

Implements com.google.common.graph.Network.hasEdgeConnecting.

Doc from com.google.common.graph.Network.hasEdgeConnecting.

Returns true if there is an edge that directly connects 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).

Annotations
@Override
hasEdgeConnectingback to summary
public boolean hasEdgeConnecting(EndpointPair<N> endpoints)

Overrides com.google.common.graph.AbstractNetwork.hasEdgeConnecting.

Implements com.google.common.graph.Network.hasEdgeConnecting.

Doc from com.google.common.graph.Network.hasEdgeConnecting.

Returns true if there is an edge that directly connects endpoints (in the order, if any, specified by endpoints).

Unlike the other EndpointPair-accepting methods, this method does not throw if the endpoints are unordered and the graph is directed; it simply returns false. This is for consistency with Graph#hasEdgeConnecting(EndpointPair) and ValueGraph#hasEdgeConnecting(EndpointPair).

Annotations
@Override
incidentEdgesback to summary
public Set<E> incidentEdges(N node)

Implements com.google.common.graph.Network.incidentEdges.

Doc from com.google.common.graph.Network.incidentEdges.

Returns the edges whose incident nodes in this network include node.

This is equal to the union of inEdges(Object) and outEdges(Object).

Annotations
@Override
incidentNodesback to summary
public EndpointPair<N> incidentNodes(E edge)

Implements com.google.common.graph.Network.incidentNodes.

Doc from com.google.common.graph.Network.incidentNodes.

Returns the nodes which are the endpoints of edge in this network.

Annotations
@Override
inDegreeback to summary
public int inDegree(N node)

Overrides com.google.common.graph.AbstractNetwork.inDegree.

Implements com.google.common.graph.Network.inDegree.

Doc from com.google.common.graph.Network.inDegree.

Returns the count of node's incoming edges in a directed network. In an undirected network, returns the degree(Object).

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

Annotations
@Override
inEdgesback to summary
public Set<E> inEdges(N node)

Implements com.google.common.graph.Network.inEdges.

Doc from com.google.common.graph.Network.inEdges.

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 incidentEdges(Object).

Annotations
@Override
isDirectedback to summary
public boolean isDirected()

Implements com.google.common.graph.Network.isDirected.

Doc from com.google.common.graph.Network.isDirected.

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.

Annotations
@Override
nodeOrderback to summary
public ElementOrder<N> nodeOrder()

Implements com.google.common.graph.Network.nodeOrder.

Doc from com.google.common.graph.Network.nodeOrder.

Returns the order of iteration for the elements of nodes().

Annotations
@Override
nodesback to summary
public Set<N> nodes()

Implements com.google.common.graph.Network.nodes.

Doc from com.google.common.graph.Network.nodes.

Returns all nodes in this network, in the order specified by nodeOrder().

Annotations
@Override
outDegreeback to summary
public int outDegree(N node)

Overrides com.google.common.graph.AbstractNetwork.outDegree.

Implements com.google.common.graph.Network.outDegree.

Doc from com.google.common.graph.Network.outDegree.

Returns the count of node's outgoing edges in a directed network. In an undirected network, returns the degree(Object).

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

Annotations
@Override
outEdgesback to summary
public Set<E> outEdges(N node)

Implements com.google.common.graph.Network.outEdges.

Doc from com.google.common.graph.Network.outEdges.

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 incidentEdges(Object).

Annotations
@Override
predecessorsback to summary
public Set<N> predecessors(N node)

Implements com.google.common.graph.Network.predecessors.

Doc from com.google.common.graph.Network.predecessors.

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 adjacentNodes(Object).

Annotations
@Override
successorsback to summary
public Set<N> successors(N node)

Implements com.google.common.graph.Network.successors.

Doc from com.google.common.graph.Network.successors.

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 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).

Annotations
@Override