Graph/GraphList.h

Go to the documentation of this file.
00001 
00010 #ifndef _GRAPH_LIST_H_
00011 #define _GRAPH_LIST_H_
00012 
00013 #include "Graph.h"
00014 
00021 class GraphList : public Graph {
00022 
00023 public:
00024 
00025   // creation interface
00026   // ------------------
00027   GraphList () : Graph() {}
00028   GraphList (int n) : Graph (n) { allocate(n); }
00029 
00030   ~GraphList () { deallocate(); }
00031 
00032   // read-only information about graph
00033   // ---------------------------------
00034   // expose iterator to edges emanating from this vertex
00035   bool isEdge (int, int);
00036   int edgeWeight (int, int);
00037 
00038   // update edge structure of graph (when no weight, assumed to be 1).
00039   // ---------------------------------------------------------------
00040   void addEdge (int u, int v, int w);
00041   bool removeEdge (int u, int v);
00042 
00043  protected:
00045     void allocate(int n) {
00046       
00047     }
00048 
00050     void deallocate() {
00051       delete [] vertices_;
00052     }
00053 
00054  private:
00055   void helperRemove (int, int, bool);
00056 
00057 };
00058 
00059 
00060 #endif /* _GRAPH_LIST_H_ */
Algorithm Development Kit 1.0