diff options
author | Marcin Chrzanowski <marcin.j.chrzanowski@gmail.com> | 2017-01-05 00:26:34 -0500 |
---|---|---|
committer | Marcin Chrzanowski <marcin.j.chrzanowski@gmail.com> | 2017-01-05 11:52:19 -0500 |
commit | 98844eccedfb84fac46c83d59a1298cce491f77b (patch) | |
tree | 52e4ab6f472b59c90f0ae34505daabfec5185333 /src/graph.h | |
parent | 02d18af55aaf50b57b3a57891dac74a9b1a36b60 (diff) |
Switch to unordered maps and sets
Diffstat (limited to 'src/graph.h')
-rw-r--r-- | src/graph.h | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/graph.h b/src/graph.h index 7d0ae08..f687ff3 100644 --- a/src/graph.h +++ b/src/graph.h @@ -1,7 +1,9 @@ #ifndef GRAPH_H #define GRAPH_H -#include <map> +#include <algorithm> +#include <unordered_map> +#include <unordered_set> #include <vector> class Graph { @@ -33,10 +35,11 @@ public: bool has_out_edges(int vertex) const { return has_out_edges_.count(vertex) > 0; } + private: std::set<int> vertices_; - std::map<int, std::vector<int>> graph_; - std::set<int> has_out_edges_; + std::unordered_map<int, std::vector<int>> graph_; + std::unordered_set<int> has_out_edges_; }; #endif |