Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

Graph Class Reference

#include <Graph.h>

List of all members.

Public Methods

 Graph ()
 Graph (int numVertices)
 Graph (TaggedObjectStorage &theVerticesStorage)
virtual ~Graph ()
virtual bool addVertex (Vertex *vertexPtr, bool checkAdjacency=true)
virtual int addEdge (int vertexTag, int otherVertexTag)
virtual VertexgetVertexPtr (int vertexTag)
virtual VertexIter& getVertices (void)
virtual int getNumVertex (void) const
virtual int getNumEdge (void) const
virtual VertexremoveVertex (int tag, bool removeEdgeFlag=true)
virtual void Print (ostream &s, int flag=0)

Friends

ostream& operator<< (ostream &s, Graph &M)


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

Graph::Graph ( )
 

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.

Graph::Graph ( TaggedObjectStorage & theVerticesStorage )
 

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]
 

A method to return the number of edges in the graph, returns {numEdge}.

Definition at line 184 of file Graph.cpp.

Referenced by Metis::number(), and Metis::partition().

int Graph::getNumVertex ( void ) const [virtual]
 

A method to return the number of vertices in the graph. Invokes {getNumComponents()} on the Vertex storage object.

Definition at line 178 of file Graph.cpp.

Referenced by RCM::number(), Metis::number(), Metis::partition(), SymArpackSOE::setSize(), SparseGenColLinSOE::setSize(), ProfileSPDLinSOE::setSize(), FullGenLinSOE::setSize(), BandSPDLinSOE::setSize(), BandGenLinSOE::setSize(), and BandArpackSOE::setSize().

Vertex * Graph::getVertexPtr ( int vertexTag ) [virtual]
 

A method which returns a pointer to the vertex whose tag is given by {vertexTag}. If no such vertex exists in the graph is returned. Invokes {getComponentPtr(vertexTag)} on the vertex storage object and casts this to a Vertex * if not null.

Definition at line 159 of file Graph.cpp.

Referenced by addEdge(), addVertex(), RCM::number(), Metis::number(), Metis::partition(), SymArpackSOE::setSize(), and SparseGenColLinSOE::setSize().

VertexIter & Graph::getVertices ( void ) [virtual]
 

A method which returns a reference to the graphs VertexIter. This iter can be used for iterating through the vertices of the graph.

Definition at line 169 of file Graph.cpp.

Referenced by RCM::number(), SymArpackSOE::setSize(), SparseGenColLinSOE::setSize(), ProfileSPDLinSOE::setSize(), BandSPDLinSOE::setSize(), BandGenLinSOE::setSize(), and BandArpackSOE::setSize().

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:
Copyright Contact Us