Top Description Constructors Methods
com.google.common.graph

pack-priv abstract Class ForwardingGraph<N>

extends AbstractGraph<N>
Class Inheritance
Known Direct Subclasses
com.google.common.graph.Graphs.TransposedGraph, com.google.common.graph.ImmutableGraph, com.google.common.graph.StandardMutableGraph
Annotations
@ElementTypesAreNonnullByDefault
Imports
java.util.Set

A class to allow Graph implementations to be backed by a BaseGraph. This is not currently planned to be released as a general-purpose forwarding class.
Author
James Sexton

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.Graph.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.Graph.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.Graph.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 BaseGraph<N>
protected long
edgeCount()

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

Defer to AbstractGraph#edges() (based on successors(Object)) for full edges() implementation.
public boolean
hasEdgeConnecting(N nodeU, N nodeV)

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

Implements com.google.common.graph.Graph.hasEdgeConnecting, com.google.common.graph.BaseGraph.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.AbstractBaseGraph.hasEdgeConnecting.

Implements com.google.common.graph.Graph.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 Set<EndpointPair<N>>
public int
inDegree(N node)

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

Implements com.google.common.graph.Graph.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.Graph.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.Graph.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.Graph.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.Graph.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.Graph.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.Graph.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.AbstractGraph:
equalshashCodetoString

Constructor Detail

ForwardingGraphback to summary
pack-priv ForwardingGraph()

Method Detail

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

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

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

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

Doc from com.google.common.graph.Graph.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 BaseGraph<N> delegate()
edgeCountback to summary
protected long edgeCount()

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

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

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

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

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

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

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

Doc from com.google.common.graph.Graph.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
incidentEdgesback to summary
public Set<EndpointPair<N>> incidentEdges(N node)

Overrides com.google.common.graph.AbstractBaseGraph.incidentEdges.

Implements com.google.common.graph.Graph.incidentEdges, com.google.common.graph.BaseGraph.incidentEdges.

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

Returns the edges in this graph whose endpoints include node.

This is equal to the union of incoming and outgoing edges.

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

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

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

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

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

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

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

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

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

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