#ifndef GRAPH_H #define GRAPH_H ///////////////////////////////////////////////////////////////// // graph.h - declares graph with template parameters E and V // // E is edge type, V is vertex type // // // // Jim Fawcett, CSE776 - Design Patterns, Summer 2004 // ///////////////////////////////////////////////////////////////// #include class command; template class edge; template class vertex { public: vertex() {} V& value() { return vd; } void add(const edge& e); private: std::vector _edge; V vd; }; template class edge { edge() {} E& value() { return ed; } }; template class graph { public: graph() : _comm(0) {} void add(vertex& v, V& vd); void link(vertex& parent, vertex& child, E& ed); void reg(command* comm); void DFS(); void BFS(); void compress(); void topoSort(); void expand(); private: std::vector< vertex* > _adjList; command* _comm; }; #endif