Top Description Constructors Methods
com.google.common.graph

public abstract Class AbstractValueGraph<N, V>

extends AbstractBaseGraph<N>
implements ValueGraph<N, V>
Class Inheritance
All Implemented Interfaces
com.google.common.graph.ValueGraph, com.google.common.graph.BaseGraph, com.google.common.graph.PredecessorsFunction, com.google.common.graph.SuccessorsFunction
Known Direct Subclasses
com.google.common.graph.ForwardingValueGraph, com.google.common.graph.StandardValueGraph
Annotations
@Beta
@ElementTypesAreNonnullByDefault
Type Parameters
<N>
Node parameter type
<V>
Value parameter type
Static Imports
java.util.Objects.requireNonNull

This class provides a skeletal implementation of ValueGraph. It is recommended to extend this class rather than implement ValueGraph directly.

The methods implemented in this class should not be overridden unless the subclass admits a more efficient implementation.

Author
James Sexton
Since
20.0

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public Graph<N>
asGraph()

Implements com.google.common.graph.ValueGraph.asGraph.

Returns a live view of this graph as a Graph.
public Optional<V>
edgeValue(N nodeU, N nodeV)

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)

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().
private static <N, V> Map<EndpointPair<N>, V>
edgeValueMap(final ValueGraph<N, V> graph)

public final boolean
equals(Object
the reference object with which to compare.
obj
)

Overrides java.lang.Object.equals.

Implements com.google.common.graph.ValueGraph.equals.

Returns true iff object is a ValueGraph that has the same elements and the same structural relationships as those in this graph.
public final int
hashCode()

Overrides java.lang.Object.hashCode.

Implements com.google.common.graph.ValueGraph.hashCode.

Returns the hash code for this graph.
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of this graph.
Inherited from com.google.common.graph.AbstractBaseGraph:
degreeedgeCountedgeshasEdgeConnectinghasEdgeConnectingincidentEdgeOrderincidentEdgesinDegreeisOrderingCompatiblenodeInvalidatableSetnodePairInvalidatableSetoutDegreevalidateEndpoints

Constructor Detail

AbstractValueGraphback to summary
public AbstractValueGraph()

Method Detail

asGraphback to summary
public Graph<N> asGraph()

Implements com.google.common.graph.ValueGraph.asGraph.

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

Returns a live view of this graph as a Graph. The resulting Graph will have an edge connecting node A to node B if this ValueGraph has an edge connecting A to B.

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

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)

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
edgeValueMapback to summary
private static <N, V> Map<EndpointPair<N>, V> edgeValueMap(final ValueGraph<N, V> graph)
equalsback to summary
public final boolean equals(Object obj)

Overrides java.lang.Object.equals.

Implements com.google.common.graph.ValueGraph.equals.

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

Returns true iff object is a ValueGraph that has the same elements and the same structural relationships as those in this graph.

Thus, two value graphs A and B are equal if all of the following are true:

Graph properties besides directedness do not affect equality. For example, two graphs may be considered equal even if one allows self-loops and the other doesn't. Additionally, the order in which nodes or edges are added to the graph, and the order in which they are iterated over, are irrelevant.

A reference implementation of this is provided by AbstractValueGraph#equals(Object).

Parameters
obj:Object

Doc from java.lang.Object.equals.

the reference object with which to compare.

Returns:boolean

Doc from java.lang.Object.equals.

true if this object is the same as the obj argument; false otherwise.

Annotations
@Override
hashCodeback to summary
public final int hashCode()

Overrides java.lang.Object.hashCode.

Implements com.google.common.graph.ValueGraph.hashCode.

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

Returns the hash code for this graph. The hash code of a graph is defined as the hash code of a map from each of its edges to the associated edge value.

A reference implementation of this is provided by AbstractValueGraph#hashCode().

Returns:int

Doc from java.lang.Object.hashCode.

a hash code value for this object

Annotations
@Override
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Returns a string representation of this graph.

Returns:String

Doc from java.lang.Object.toString.

a string representation of the object

Annotations
@Override