From 4cd91c194dc93197ea972cfbd792f7acd81025d1 Mon Sep 17 00:00:00 2001 From: Marcin Chrzanowski Date: Tue, 3 Jan 2017 22:37:27 -0500 Subject: Implement graph --- src/graph.h | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 src/graph.h 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 +#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::vector const& get_neighbors(int vertex) { + return graph_[vertex]; + } +private: + std::map> graph_; +}; + +#endif -- cgit v1.2.3