0

Hello,

I have to create a graph based program that will validate a zip code given an expression to match eg. ddddd - dddd, where d is a digit 0 - 9. I am new to graphs and don't know how to accomplish this. I'm trying to make graph class, and this is what I have so far using my textbook as a guide. Any help would be appreciated: Thank you.

```
class graph
{
public:
bool isEmpty() const;
void createGraph();
void ClearGraph();
void depthFirstTravesal();
graph( int size = 0);
~graphType();
protected:
int maxSize;
int gSize;
private:
void dft(int v, bool visited[]);
};
void graph::createGraph()
{
int index;
string zip;
int vertex;
int adjacentVertex;
if(gSize != 0)
clearGraph();
cout << "Enter Zip Code + 4: ";
cin >> zip;
cout << endl;
}
void graph::ClearGraph()
{
int index;
for (index = 0; index < gSize; index++)
graph[index].destroyList();
}
graph::graph(int size)
{
maxSize = size;
gSize = 0;
}
graph::graph()
{
clearGraph();
}
void graph:: depthFirstTravesal()
{
bool *visited;
visited = new bool[gSize];
int index;
for (index = 0; index < gSize; index++)
visited[index] = false;
for(index = 0; index < gSize; index++)
if(!visited[index])
dft(index, visited);
delete [] visited;
}
void graph::dft
//this should be a recursive function to implement the depth first traversal, but I am not sure hot to do that.
```