#include #include // Used by the mark array #define UNVISITED 0 #define VISITED 1 #include "graph.h" class Graphm : public Graph { // Implement adjacency matrix private: int numVertex, numEdge; // Store number of vertices, edges int **matrix; // Pointer to adjacency matrix int *mark; // Pointer to mark array public: Graphm(int numVert) { // Make graph w/ numVert vertices int i, j; numVertex = numVert; numEdge = 0; mark = new int[numVert]; // Initialize mark array for (i=0; i0, "Illegal weight value"); if (matrix[v1][v2] == 0) numEdge++; matrix[v1][v2] = wgt; } void delEdge(int v1, int v2) { // Delete edge (v1, v2) if (matrix[v1][v2] != 0) numEdge--; matrix[v1][v2] = 0; } int weight(int v1, int v2) { return matrix[v1][v2]; } int getMark(int v) { return mark[v]; } void setMark(int v, int val) { mark[v] = val; } }; #include "graphutil.cpp"