drasys.or.graph
Class BaseGraph
java.lang.Object
|
+--drasys.or.graph.Graph
|
+--drasys.or.graph.BaseGraph
- Direct Known Subclasses:
- DenseGraph, PointGraph, SparseGraph
- public abstract class BaseGraph
- extends Graph
- implements AddVertexI
An abstract graph containing features that are common to the other graph types.
- See Also:
DenseGraph
,
SparseGraph
, Serialized Form
Methods inherited from class java.lang.Object |
clone,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
BaseGraph
public BaseGraph()
BaseGraph
public BaseGraph(int vertexCapacity)
getChangeCount
public int getChangeCount()
- Returns the number of changes that have been made to a graph.
This can be used by algorithms to determine is a graph has changed since initialization.
vertices
public java.util.Enumeration vertices()
- Creates an enumeration on the vertices of the graph.
- Returns:
- An enumeration with elements of class VertexI.
sizeOfVertices
public int sizeOfVertices()
- Returns:
- The number vertices in the graph.
sizeOfEdges
public int sizeOfEdges()
- Returns:
- The number edges in the graph.
sizeOfDirectedEdges
public int sizeOfDirectedEdges()
- Returns:
- The number of directed edges in the graph.
ensureVertexCapacity
public void ensureVertexCapacity(int vertexCapacity)
- Increases the capacity of the graph if needed to ensure
it can efficiently hold this many vertices.
- Specified by:
- ensureVertexCapacity in interface AddVertexI
getVertex
public VertexI getVertex(java.lang.Object key)
- Get the vertex that matches the key.
- Returns:
- Null if the edge is not in the graph.
removeAllVertices
public void removeAllVertices()
- Removes all the vertices and edges from the graph.
newVertex
protected abstract VertexI newVertex(java.lang.Object key,
java.lang.Object value)
addVertex
public VertexI addVertex(java.lang.Object key)
throws DuplicateVertexException
- Adds a new vertex to the graph where: value=null.
Throws 'DuplicateVertexException' if the vertex already exists.
- Specified by:
- addVertex in interface AddVertexI
addVertex
public VertexI addVertex(VertexI vertex)
throws DuplicateVertexException
- Adds a new vertex to the graph.
Throws 'DuplicateVertexException' if the vertex already exists.
- Specified by:
- addVertex in interface AddVertexI
addVertex
public VertexI addVertex(java.lang.Object key,
java.lang.Object value)
throws DuplicateVertexException
- Adds a new vertex to the graph.
Throws 'DuplicateVertexException' if the vertex already exists.
- Specified by:
- addVertex in interface AddVertexI
Copyright(C)1997-2000 by DRA Systems all rights reserved. OpsResearch.com