Homework Assignment #4

Give an implementation of graph class using adjacency matrix representation.

1. Refer to "d_graph.h", the interface of the functions is the same, (Hint: cut-paste) but the implementation is based on
adjacency-matrix instead of adjacency-set in the textbook software. For example, you may change data members.
2. Submit one file named USERNAME_hwk4.tar.
3. In the main() of USERNAME_hwk4.cpp, use example16-1 on p946 as test data. Regarding to the I/O of graph, please read carefully about the file format and screen output format on p947-948 (but not for Fig 16-7). Notice that data is still Fig 16-6. You can name the files for graphs (a) and (b) as "ga.dat" and "gb.dat" for example. Type in contents of file "ga.dat" as the source of overloaded operator ">>". Display it (<<). Do part 1. After updates of part 2, save graph (b)  and display it on screen. So the behaviors (the code) of example16-1 will be the same, though your modifed file of d_graph (please rename it) is included.
 

---
The following is just my pop-off thought (not part of requirements) as a reference.
private members:
-Matrix : vector< vector <float> >, assume float weights
-vector <vertex>
-vertex:
    int index;
    content of nodes: type T (usually int, or char, or string etc),
    bool occupied;
    int indegree, outdegree;
    parent
   etc. etc...
---