Package org.jgrapht.graph
Class ParanoidGraph<V,E>
- java.lang.Object
-
- org.jgrapht.graph.AbstractGraph<V,E>
-
- org.jgrapht.graph.GraphDelegator<V,E>
-
- org.jgrapht.graph.ParanoidGraph<V,E>
-
- All Implemented Interfaces:
java.io.Serializable,Graph<V,E>
public class ParanoidGraph<V,E> extends GraphDelegator<V,E>
ParanoidGraph provides a way to verify that objects added to a graph obey the standard equals/hashCode contract. It can be used to wrap an underlying graph to be verified. Note that the verification is very expensive, so ParanoidGraph should only be used during debugging.- Version:
- $Id: ParanoidGraph.java 645 2008-09-30 19:44:48Z perfecthash $
- Author:
- John Sichi
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description ParanoidGraph(Graph<V,E> g)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanaddEdge(V sourceVertex, V targetVertex, E e)Adds the specified edge to this graph, going from the source vertex to the target vertex.booleanaddVertex(V v)Adds the specified vertex to this graph if not already present.-
Methods inherited from class org.jgrapht.graph.GraphDelegator
addEdge, containsEdge, containsVertex, degreeOf, edgeSet, edgesOf, getAllEdges, getEdge, getEdgeFactory, getEdgeSource, getEdgeTarget, getEdgeWeight, incomingEdgesOf, inDegreeOf, outDegreeOf, outgoingEdgesOf, removeEdge, removeEdge, removeVertex, setEdgeWeight, toString, vertexSet
-
Methods inherited from class org.jgrapht.graph.AbstractGraph
assertVertexExist, containsEdge, removeAllEdges, removeAllEdges, removeAllEdges, removeAllVertices, toStringFromSets
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.jgrapht.Graph
containsEdge, removeAllEdges, removeAllEdges, removeAllVertices
-
-
-
-
Method Detail
-
addEdge
public boolean addEdge(V sourceVertex, V targetVertex, E e)
Description copied from interface:GraphAdds the specified edge to this graph, going from the source vertex to the target vertex. More formally, adds the specified edge,e, to this graph if this graph contains no edgee2such thate2.equals(e). If this graph already contains such an edge, the call leaves this graph unchanged and returns false. Some graphs do not allow edge-multiplicity. In such cases, if the graph already contains an edge from the specified source to the specified target, than this method does not change the graph and returnsfalse. If the edge was added to the graph, returnstrue.The source and target vertices must already be contained in this graph. If they are not found in graph IllegalArgumentException is thrown.
- Specified by:
addEdgein interfaceGraph<V,E>- Overrides:
addEdgein classGraphDelegator<V,E>- Parameters:
sourceVertex- source vertex of the edge.targetVertex- target vertex of the edge.e- edge to be added to this graph.- Returns:
- true if this graph did not already contain the specified edge.
- See Also:
Graph.addEdge(Object, Object, Object)
-
addVertex
public boolean addVertex(V v)
Description copied from interface:GraphAdds the specified vertex to this graph if not already present. More formally, adds the specified vertex,v, to this graph if this graph contains no vertexusuch thatu.equals(v). If this graph already contains such vertex, the call leaves this graph unchanged and returns false. In combination with the restriction on constructors, this ensures that graphs never contain duplicate vertices.- Specified by:
addVertexin interfaceGraph<V,E>- Overrides:
addVertexin classGraphDelegator<V,E>- Parameters:
v- vertex to be added to this graph.- Returns:
- true if this graph did not already contain the specified vertex.
- See Also:
Graph.addVertex(Object)
-
-