Assignment #10 Directed Graph

Define and implement the class DiGraph using an adjacency list as defined below:
DiGraph (unsigned size) // default constructor
~DiGraph() // destructor
void insertNode(unsigned n)

void insertEdge(unsigned n1, unsigned n2)

void deleteNode(unsigned n)

void deleteEdge(unsigned fromNode, unsigned toNode)

void print(void) Prints “node index: list of adjacent nodes for each node

void dfs(List<unsigned> &order) Does a depth-first search and returns the visit order in order.

I would suggest that you hold the graph in an array of nodeCell, where nodeCell has a List<unsigned> * for the list of edges,

int exists to indicate that the node is actually in the graph (you will need this to handle deleteNode() easily),
and an int visited to indicated if the node has been visited.

Include a test driver in which you create the graph Figure 9.80 using A=0, B=1. Print it, and print a depth first ordering of its nodes. Also test the delete functions.

In later assignments we will add to the functionality of DiGraph.