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

Fields inherited from class drasys.or.graph.Graph
_symmetric
 
Constructor Summary
BaseGraph()
           
BaseGraph(int vertexCapacity)
           
 
Method Summary
 VertexI addVertex(java.lang.Object key)
          Adds a new vertex to the graph where: value=null.
 VertexI addVertex(java.lang.Object key, java.lang.Object value)
          Adds a new vertex to the graph.
 VertexI addVertex(VertexI vertex)
          Adds a new vertex to the graph.
 void ensureVertexCapacity(int vertexCapacity)
          Increases the capacity of the graph if needed to ensure it can efficiently hold this many vertices.
 int getChangeCount()
          Returns the number of changes that have been made to a graph.
 VertexI getVertex(java.lang.Object key)
          Get the vertex that matches the key.
protected abstract  VertexI newVertex(java.lang.Object key, java.lang.Object value)
           
 void removeAllVertices()
          Removes all the vertices and edges from the graph.
 int sizeOfDirectedEdges()
           
 int sizeOfEdges()
           
 int sizeOfVertices()
           
 java.util.Enumeration vertices()
          Creates an enumeration on the vertices of the graph.
 
Methods inherited from class drasys.or.graph.Graph
edges, equals, getEdge, getEdge, isSubsetOf, mutableEdges, setSymmetric, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BaseGraph

public BaseGraph()

BaseGraph

public BaseGraph(int vertexCapacity)
Method Detail

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