diff options
-rw-r--r-- | src/graph.h | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/graph.h b/src/graph.h new file mode 100644 index 0000000..9df4b9f --- /dev/null +++ b/src/graph.h @@ -0,0 +1,26 @@ +#ifndef GRAPH_H +#define GRAPH_H + +#include <map> +#include <vector> + +class Graph { +public: + Graph() : graph_() {} + + void add_vertex(int vertex) { + graph_[vertex] = std::vector<int>(); + } + + void add_edge(int from, int to) { + graph_[from].push_back(to); + } + + std::vector<int> const& get_neighbors(int vertex) { + return graph_[vertex]; + } +private: + std::map<int, std::vector<int>> graph_; +}; + +#endif |