next up previous contents
Next: The Visual Graph Class: Up: An Experiment in Object Previous: Run Time Results:

   
Adding Visualization to the Graph Class:

We will begin by adding to the exsiting graph class the needed pieces to enable the nodes and edges to display in a standard X Windos graphical environment.

Our discussions here are brief, but note that the new functionality we derive is done by simply taking the old graph class, keeing all of its class names and adding the new material into the new files xgraph.h and xgraph.c. This means that there are two version of the graph class available which implies collisions of the name spaces.

So why did this happen? A careful examination of the original graph code will show that the Gnode and Gedge classes are derived from the underlying Node and Edge classes. Note these underlying classes have private constructors. An easy first try would be build new XGnode and XGedge classes by inheritance from Node and Edge and then to build a new graph class, say XGraph. This will fail because the edge and node bag pointer classes are defined in terms of Gnode and Gedge and the pointer manipulations we need to do are illegal.

The only files that are therefore changed are the two files that define the graph class.



 
next up previous contents
Next: The Visual Graph Class: Up: An Experiment in Object Previous: Run Time Results:
Jim Peterson
1999-05-17