org._3pq.jgrapht.graph
Class AbstractGraph
java.lang.Object
org._3pq.jgrapht.graph.AbstractGraph
- Graph
public abstract class AbstractGraph
extends java.lang.Object
A skeletal implementation of the Graph interface, to minimize the
effort required to implement graph interfaces. This implementation is
applicable to both: directed graphs and undirected graphs.
boolean | addAllEdges(Collection edges)
|
boolean | addAllVertices(Collection vertices)
|
protected boolean | assertVertexExist(Object v) - Ensures that the specified vertex exists in this graph, or else throws
exception.
|
boolean | containsEdge(Object sourceVertex, Object targetVertex)
|
boolean | removeAllEdges(Collection edges)
|
List | removeAllEdges(Object sourceVertex, Object targetVertex)
|
protected boolean | removeAllEdges(Edge[] edges) - Removes all the edges in this graph that are also contained in the
specified edge array.
|
boolean | removeAllVertices(Collection vertices)
|
String | toString() - Returns a string of the parenthesized pair (V, E) representing this
G=(V,E) graph.
|
protected String | toStringFromSets(Collection vertexSet, Collection edgeSet) - Helper for subclass implementations of toString( ).
|
AbstractGraph
public AbstractGraph()
Construct a new empty graph object.
addAllEdges
public boolean addAllEdges(Collection edges)
- addAllEdges in interface Graph
addAllVertices
public boolean addAllVertices(Collection vertices)
- addAllVertices in interface Graph
assertVertexExist
protected boolean assertVertexExist(Object v)
Ensures that the specified vertex exists in this graph, or else throws
exception.
true
if this assertion holds.
containsEdge
public boolean containsEdge(Object sourceVertex,
Object targetVertex)
- containsEdge in interface Graph
removeAllEdges
public List removeAllEdges(Object sourceVertex,
Object targetVertex)
- removeAllEdges in interface Graph
removeAllEdges
protected boolean removeAllEdges(Edge[] edges)
Removes all the edges in this graph that are also contained in the
specified edge array. After this call returns, this graph will contain
no edges in common with the specified edges. This method will invoke
the
Graph.removeEdge(Edge)
method.
edges
- edges to be removed from this graph.
- true if this graph changed as a result of the call.
toString
public String toString()
Returns a string of the parenthesized pair (V, E) representing this
G=(V,E) graph. 'V' is the string representation of the vertex set, and
'E' is the string representation of the edge set.
- a string representation of this graph.
toStringFromSets
protected String toStringFromSets(Collection vertexSet,
Collection edgeSet)
Helper for subclass implementations of toString( ).
vertexSet
- the vertex set V to be printededgeSet
- the edge set E to be printed
- a string representation of (V,E)