#ifndef GRAPH_H #define GRAPH_H #include #include class Graph { public: Graph() : graph_() {} void add_vertex(int vertex) { graph_[vertex] = std::vector(); } void add_edge(int from, int to) { graph_[from].push_back(to); } std::set get_vertices() { std::set vertices; for (auto vertex : graph_) { vertices.insert(vertex.first); } return vertices; } std::vector const& get_neighbors(int vertex) { return graph_[vertex]; } private: std::map> graph_; }; #endif