// defining class wtdgraph using std::size_t; using std::map; // optional (see private section below) // mandatory header: template class wtdgraph : public graph { public: // define all constructors: wtdgraph( ); wtdgraph(size_t initial_allocation); wtdgraph(const wtdgraph &source); // make destructor virtual: virtual ~wtdgraph(); // overload add_edge with default weight parameter: void add_edge(size_t source, size_t target, size_t weight=0); // redefine others as needed to handle weights: void remove_edge(size_t source, size_t target); wtdgraph &operator=(const wtdgraph &source); // override resize function to allocate weights: virtual void resize(size_t new_allocation); // add edge_weight function to return a weight: size_t edge_weight(size_t source, size_t target) const; private: // need a way to store the weights - for example: map *weights; // any other ideas? // lots of ways could work, but avoid 2-D array }; // Implement the functions below (see wtdgraphimpl.txt)