#ifndef GRAPH_H_ #define GRAPH_H_ #include #include #include #include namespace graph { template class Graph { public: Graph() = default; // Add vertex v void insert(const V& v); // Add edge between v and u void insert(const V& v, const V& u); // Delete vertex v void erase(const V& v); // Delete edge between v and u void erase(const V& v, const V& u); // Return true if v and u are connected bool connected(const V& v, const V& u); private: std::map> adjacency; }; template inline void Graph::insert(const V& v) { adjacency[v]; } template inline void Graph::insert(const V& v, const V& u) { adjacency[v].insert(u); } template inline void Graph::erase(const V& v) { adjacency.erase(v); } template inline void Graph::erase(const V& v, const V& u) { adjacency[v].erase(u); } template inline bool Graph::connected(const V& v, const V& u) { return true; } } // namespace graph #endif