V
- the graph vertex typeE
- the graph edge typepublic class ParanoidGraph<V,E> extends GraphDelegator<V,E>
DEFAULT_EDGE_WEIGHT
Constructor and Description |
---|
ParanoidGraph(Graph<V,E> g)
Create a new paranoid graph.
|
Modifier and Type | Method and Description |
---|---|
boolean |
addEdge(V sourceVertex,
V targetVertex,
E e)
Adds the specified edge to this graph, going from the source vertex to the target vertex.
|
boolean |
addVertex(V v)
Adds the specified vertex to this graph if not already present.
|
addEdge, containsEdge, containsVertex, degreeOf, edgeSet, edgesOf, getAllEdges, getEdge, getEdgeFactory, getEdgeSource, getEdgeTarget, getEdgeWeight, getType, incomingEdgesOf, inDegreeOf, outDegreeOf, outgoingEdgesOf, removeEdge, removeEdge, removeVertex, setEdgeWeight, toString, vertexSet
assertVertexExist, containsEdge, equals, hashCode, removeAllEdges, removeAllEdges, removeAllEdges, removeAllVertices, toStringFromSets
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
containsEdge, removeAllEdges, removeAllEdges, removeAllVertices
public boolean addEdge(V sourceVertex, V targetVertex, E e)
e
, to this graph if this graph contains no edge e2
such that
e2.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 returns
false
. If the edge was added to the graph, returns
true
.
The source and target vertices must already be contained in this graph. If they are not found in graph IllegalArgumentException is thrown.
addEdge
in interface Graph<V,E>
addEdge
in class GraphDelegator<V,E>
sourceVertex
- source vertex of the edge.targetVertex
- target vertex of the edge.e
- edge to be added to this graph.Graph.addEdge(Object, Object)
,
Graph.getEdgeFactory()
public boolean addVertex(V v)
v
, to this graph if this graph contains no vertex
u
such that
u.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.Copyright © 2017. All rights reserved.