Main Page Class Hierarchy Alphabetical List Compound List File List Compound Members File Members
Graph Class Reference#include <Graph.h>
List of all members.
Detailed Description
Graph is a base class. A Graph is a container class responsible for holding the vertex set and edge set. The class is responsible for: \begin{enumerate} \item providing methods to add vertices and edges. \item accessing the vertices and edges. \end{enumerate} All the methods for the class are declared as virtual to allow subclasses to be introduced. \
Definition at line 67 of file Graph.h.
Constructor & Destructor Documentation
|
To create an empty Graph. Creates an ArrayOfTagged object of initial size
in which to store the Vertices. The ArrayOfTagged object is used to store the Vertices.
Definition at line 42 of file Graph.cpp. |
Graph::Graph (
|
int numVertices )
|
|
|
To create an empty Graph. Creates an ArrayOfTagged object of initial size {numVertices} in which to store the Vertices. The ArrayOfTagged object is used to store the Vertices.
Definition at line 50 of file Graph.cpp. |
|
To create an empty Graph. The {theVerticesStorage} object is used to store the Vertices. {clearAll()} is invoked on this object to ensure it is empty.
Definition at line 58 of file Graph.cpp. |
Graph::~Graph (
|
) [virtual]
|
|
|
Invokes {clearAll()} on the storage object used to store the Vertices. It then invokes delete on the storage object used, which was either passed or created in the constructor.
Definition at line 66 of file Graph.cpp. |
Member Function Documentation
void Graph::Print (
|
ostream & s,
|
|
int flag = 0 ) [virtual]
|
|
|
A method to print the graph. Invokes {Print(s, flag)} on the vertex storage object.
Definition at line 208 of file Graph.cpp.
Referenced by operator<<().
|
int Graph::addEdge (
|
int vertexTag,
|
|
int otherVertexTag ) [virtual]
|
|
|
Causes the Graph to add an edge {(vertexTag,otherVertexTag)} to the Graph. A check is first made to see if vertices with tags given by {vertexTag} and {otherVertexTag} exist in the graph. If they do not exist a
is returned, otherwise the method invokes {addEdge()} on each of the corresponding vertices in the graph. Increments {numEdge} by
and returns
if sucessfull, a
if the edge already existed, and a
if one {addEdge()} was successful, but the other was not.
Definition at line 129 of file Graph.cpp.
Referenced by Domain::buildEleGraph(), and Domain::buildNodeGraph().
|
bool Graph::addVertex (
|
Vertex * vertexPtr,
|
|
bool checkAdjacency = true ) [virtual]
|
|
|
Causes the graph to add a vertex to the graph. If {checkAdjacency} is {true}, a check is made to ensure that all the Vertices in the adjacency list of the Vertex are in the Graph. If a vertex in the adjacency is not in the Graph the vertex is not added, a warning message is printed and {false} is returned. If successful, returns the result of invoking {addComponent()} on the TaggedStorage object used to store the Vertices.
Definition at line 87 of file Graph.cpp.
Referenced by Domain::buildEleGraph(), and Domain::buildNodeGraph().
|
int Graph::getNumEdge (
|
void ) const [virtual]
|
|
int Graph::getNumVertex (
|
void ) const [virtual]
|
|
Vertex * Graph::getVertexPtr (
|
int vertexTag ) [virtual]
|
|
VertexIter & Graph::getVertices (
|
void ) [virtual]
|
|
Vertex * Graph::removeVertex (
|
int tag,
|
|
bool removeEdgeFlag = true ) [virtual]
|
|
|
To remove the Vertex from the Graph whose tag is equal to {vertexTag}. If {removeEdgeFlag} is {true} will also remove the Vertex from the remaining Vertices adjacency lists. returns a pointer to the removed Vertex if successful,
if the Vertex was not in the Graph. Invokes {removeComponent(vertexTag)} on the vertex storage object and casts this to a Vertex * if not null. DOES NOT YET DEAL WITH {removeEdgeFlag}.
Definition at line 190 of file Graph.cpp. |
Friends And Related Function Documentation
ostream & operator<< (
|
ostream & s,
|
|
Graph & M ) [friend]
|
|
|
Invokes {Print()} on the Graph {G}.
Definition at line 214 of file Graph.cpp. |
The documentation for this class was generated from the following files:
|