Package com.google.common.graph
Class AbstractGraph<N>
- java.lang.Object
-
- com.google.common.graph.AbstractBaseGraph<N>
-
- com.google.common.graph.AbstractGraph<N>
-
- Type Parameters:
N
- Node parameter type
- All Implemented Interfaces:
BaseGraph<N>
,Graph<N>
,PredecessorsFunction<N>
,SuccessorsFunction<N>
- Direct Known Subclasses:
ForwardingGraph
@Beta public abstract class AbstractGraph<N> extends AbstractBaseGraph<N> implements Graph<N>
This class provides a skeletal implementation ofGraph
. It is recommended to extend this class rather than implementGraph
directly.- Since:
- 20.0
-
-
Constructor Summary
Constructors Constructor Description AbstractGraph()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object obj)
Returnstrue
iffobject
is aGraph
that has the same elements and the same structural relationships as those in this graph.int
hashCode()
Returns the hash code for this graph.java.lang.String
toString()
Returns a string representation of this graph.-
Methods inherited from class com.google.common.graph.AbstractBaseGraph
degree, edgeCount, edges, hasEdgeConnecting, hasEdgeConnecting, incidentEdges, inDegree, isOrderingCompatible, outDegree, validateEndpoints
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.google.common.graph.Graph
adjacentNodes, allowsSelfLoops, degree, edges, hasEdgeConnecting, hasEdgeConnecting, incidentEdges, inDegree, isDirected, nodeOrder, nodes, outDegree, predecessors, successors
-
-
-
-
Method Detail
-
equals
public final boolean equals(java.lang.Object obj)
Description copied from interface:Graph
Returnstrue
iffobject
is aGraph
that has the same elements and the same structural relationships as those in this graph.Thus, two graphs A and B are equal if all of the following are true:
- A and B have equal
directedness
. - A and B have equal
node sets
. - A and B have equal
edge sets
.
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
equals(Object)
. - A and B have equal
-
hashCode
public final int hashCode()
Description copied from interface:Graph
Returns the hash code for this graph. The hash code of a graph is defined as the hash code of the set returned byGraph.edges()
.A reference implementation of this is provided by
hashCode()
.
-
toString
public java.lang.String toString()
Returns a string representation of this graph.- Overrides:
toString
in classjava.lang.Object
-
-