Top Description Constructors Methods
com.google.common.graph

pack-priv abstract Class ForwardingValueGraph<N, V>

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

A class to allow ValueGraph 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<N>
adjacentNodes(N node)

Implements com.google.common.graph.ValueGraph.adjacentNodes, com.google.common.graph.BaseGraph.adjacentNodes.

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

Implements com.google.common.graph.ValueGraph.allowsSelfLoops, com.google.common.graph.BaseGraph.allowsSelfLoops.

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

Overrides com.google.common.graph.AbstractBaseGraph.degree.

Implements com.google.common.graph.ValueGraph.degree, com.google.common.graph.BaseGraph.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 ValueGraph<N, V>
protected long
public Optional<V>
edgeValue(N nodeU, N nodeV)

Overrides com.google.common.graph.AbstractValueGraph.edgeValue.

Implements com.google.common.graph.ValueGraph.edgeValue.

Returns the value of the edge that connects nodeU to nodeV (in the order, if any, specified by endpoints), if one is present; otherwise, returns Optional.empty().
public Optional<V>
edgeValue(EndpointPair<N> endpoints)

Overrides com.google.common.graph.AbstractValueGraph.edgeValue.

Implements com.google.common.graph.ValueGraph.edgeValue.

Returns the value of the edge that connects endpoints (in the order, if any, specified by endpoints), if one is present; otherwise, returns Optional.empty().
public V
edgeValueOrDefault(N nodeU, N nodeV, V defaultValue)

Implements com.google.common.graph.ValueGraph.edgeValueOrDefault.

Returns the value of the edge that connects nodeU to nodeV, if one is present; otherwise, returns defaultValue.
public V
edgeValueOrDefault(EndpointPair<N> endpoints, V defaultValue)

Implements com.google.common.graph.ValueGraph.edgeValueOrDefault.

Returns the value of the edge that connects endpoints (in the order, if any, specified by endpoints), if one is present; otherwise, returns defaultValue.
public boolean
public boolean
hasEdgeConnecting(EndpointPair<N> endpoints)

Overrides com.google.common.graph.AbstractBaseGraph.hasEdgeConnecting.

Implements com.google.common.graph.ValueGraph.hasEdgeConnecting, com.google.common.graph.BaseGraph.hasEdgeConnecting.

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

Overrides com.google.common.graph.AbstractBaseGraph.inDegree.

Implements com.google.common.graph.ValueGraph.inDegree, com.google.common.graph.BaseGraph.inDegree.

Returns the count of node's incoming edges (equal to predecessors(node).size()) in a directed graph.
public boolean
isDirected()

Implements com.google.common.graph.ValueGraph.isDirected, com.google.common.graph.BaseGraph.isDirected.

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

Implements com.google.common.graph.ValueGraph.nodeOrder, com.google.common.graph.BaseGraph.nodeOrder.

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

Implements com.google.common.graph.ValueGraph.nodes, com.google.common.graph.BaseGraph.nodes.

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

Overrides com.google.common.graph.AbstractBaseGraph.outDegree.

Implements com.google.common.graph.ValueGraph.outDegree, com.google.common.graph.BaseGraph.outDegree.

Returns the count of node's outgoing edges (equal to successors(node).size()) in a directed graph.
public Set<N>
predecessors(N node)

Implements com.google.common.graph.ValueGraph.predecessors, com.google.common.graph.BaseGraph.predecessors.

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

Implements com.google.common.graph.ValueGraph.successors, com.google.common.graph.BaseGraph.successors.

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

Constructor Detail

ForwardingValueGraphback to summary
pack-priv ForwardingValueGraph()

Method Detail

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

Implements com.google.common.graph.ValueGraph.adjacentNodes, com.google.common.graph.BaseGraph.adjacentNodes.

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

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

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

Annotations
@Override
allowsSelfLoopsback to summary
public boolean allowsSelfLoops()

Implements com.google.common.graph.ValueGraph.allowsSelfLoops, com.google.common.graph.BaseGraph.allowsSelfLoops.

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

Returns true if this graph allows self-loops (edges that connect a node to itself). Attempting to add a self-loop to a graph that does not allow them will throw an IllegalArgumentException.

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

Overrides com.google.common.graph.AbstractBaseGraph.degree.

Implements com.google.common.graph.ValueGraph.degree, com.google.common.graph.BaseGraph.degree.

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

Returns the count of node's incident edges, counting self-loops twice (equivalently, the number of times an edge touches node).

For directed graphs, this is equal to inDegree(node) + outDegree(node).

For undirected graphs, 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 ValueGraph<N, V> delegate()
edgeCountback to summary
protected long edgeCount()

Overrides com.google.common.graph.AbstractBaseGraph.edgeCount.

Defer to AbstractValueGraph#edges() (based on successors(Object)) for full edges() implementation.

Annotations
@Override
edgeValueback to summary
public Optional<V> edgeValue(N nodeU, N nodeV)

Overrides com.google.common.graph.AbstractValueGraph.edgeValue.

Implements com.google.common.graph.ValueGraph.edgeValue.

Doc from com.google.common.graph.ValueGraph.edgeValue.

Returns the value of the edge that connects nodeU to nodeV (in the order, if any, specified by endpoints), if one is present; otherwise, returns Optional.empty().

Annotations
@Override
edgeValueback to summary
public Optional<V> edgeValue(EndpointPair<N> endpoints)

Overrides com.google.common.graph.AbstractValueGraph.edgeValue.

Implements com.google.common.graph.ValueGraph.edgeValue.

Doc from com.google.common.graph.ValueGraph.edgeValue.

Returns the value of the edge that connects endpoints (in the order, if any, specified by endpoints), if one is present; otherwise, returns Optional.empty().

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

Annotations
@Override
edgeValueOrDefaultback to summary
public V edgeValueOrDefault(N nodeU, N nodeV, V defaultValue)

Implements com.google.common.graph.ValueGraph.edgeValueOrDefault.

Doc from com.google.common.graph.ValueGraph.edgeValueOrDefault.

Returns the value of the edge that connects nodeU to nodeV, if one is present; otherwise, returns defaultValue.

In an undirected graph, this is equal to edgeValueOrDefault(nodeV, nodeU, defaultValue).

Annotations
@Override
@CheckForNull
edgeValueOrDefaultback to summary
public V edgeValueOrDefault(EndpointPair<N> endpoints, V defaultValue)

Implements com.google.common.graph.ValueGraph.edgeValueOrDefault.

Doc from com.google.common.graph.ValueGraph.edgeValueOrDefault.

Returns the value of the edge that connects endpoints (in the order, if any, specified by endpoints), if one is present; otherwise, returns defaultValue.

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

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

Overrides com.google.common.graph.AbstractBaseGraph.hasEdgeConnecting.

Implements com.google.common.graph.ValueGraph.hasEdgeConnecting, com.google.common.graph.BaseGraph.hasEdgeConnecting.

Doc from com.google.common.graph.ValueGraph.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).

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.AbstractBaseGraph.hasEdgeConnecting.

Implements com.google.common.graph.ValueGraph.hasEdgeConnecting, com.google.common.graph.BaseGraph.hasEdgeConnecting.

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

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

Annotations
@Override
incidentEdgeOrderback to summary
public ElementOrder<N> incidentEdgeOrder()

Overrides com.google.common.graph.AbstractBaseGraph.incidentEdgeOrder.

Implements com.google.common.graph.ValueGraph.incidentEdgeOrder, com.google.common.graph.BaseGraph.incidentEdgeOrder.

Doc from com.google.common.graph.ValueGraph.incidentEdgeOrder.

Returns an ElementOrder that specifies the order of iteration for the elements of edges(), adjacentNodes(Object), predecessors(Object), successors(Object) and incidentEdges(Object).

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

Overrides com.google.common.graph.AbstractBaseGraph.inDegree.

Implements com.google.common.graph.ValueGraph.inDegree, com.google.common.graph.BaseGraph.inDegree.

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

Returns the count of node's incoming edges (equal to predecessors(node).size()) in a directed graph. In an undirected graph, returns the degree(Object).

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

Annotations
@Override
isDirectedback to summary
public boolean isDirected()

Implements com.google.common.graph.ValueGraph.isDirected, com.google.common.graph.BaseGraph.isDirected.

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

Returns true if the edges in this graph 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.ValueGraph.nodeOrder, com.google.common.graph.BaseGraph.nodeOrder.

Doc from com.google.common.graph.ValueGraph.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.ValueGraph.nodes, com.google.common.graph.BaseGraph.nodes.

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

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

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

Overrides com.google.common.graph.AbstractBaseGraph.outDegree.

Implements com.google.common.graph.ValueGraph.outDegree, com.google.common.graph.BaseGraph.outDegree.

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

Returns the count of node's outgoing edges (equal to successors(node).size()) in a directed graph. In an undirected graph, returns the degree(Object).

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

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

Implements com.google.common.graph.ValueGraph.predecessors, com.google.common.graph.BaseGraph.predecessors.

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

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.

In an undirected graph, this is equivalent to adjacentNodes(Object).

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

Implements com.google.common.graph.ValueGraph.successors, com.google.common.graph.BaseGraph.successors.

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

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.

In an undirected graph, 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