diff options
| author | Alexander Karatarakis <alkarata@microsoft.com> | 2016-11-15 11:56:46 -0800 |
|---|---|---|
| committer | Alexander Karatarakis <alkarata@microsoft.com> | 2016-11-15 12:55:35 -0800 |
| commit | 727e4ed6faabead764c4dbffaa5b57f5cfb4017a (patch) | |
| tree | 0f7c70d58ce299e80e530c02f0c20f1e01f9e9f7 | |
| parent | b64b0cbc8a34e5761fbf7fda75fda49906f116ea (diff) | |
| download | vcpkg-727e4ed6faabead764c4dbffaa5b57f5cfb4017a.tar.gz vcpkg-727e4ed6faabead764c4dbffaa5b57f5cfb4017a.zip | |
[Graph] Now uses set instead of vector
| -rw-r--r-- | toolsrc/include/vcpkg_Graphs.h | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/toolsrc/include/vcpkg_Graphs.h b/toolsrc/include/vcpkg_Graphs.h index 81b189f0e..9444ac45b 100644 --- a/toolsrc/include/vcpkg_Graphs.h +++ b/toolsrc/include/vcpkg_Graphs.h @@ -1,6 +1,7 @@ #pragma once #include <unordered_map> +#include <unordered_set> namespace vcpkg { namespace Graphs { @@ -21,7 +22,7 @@ namespace vcpkg { namespace Graphs { static void find_topological_sort_internal(V vertex, ExplorationStatus& status, - const std::unordered_map<V, std::vector<V>>& adjacency_list, + const std::unordered_map<V, std::unordered_set<V>>& adjacency_list, std::unordered_map<V, ExplorationStatus>& exploration_status, std::vector<V>& sorted) { @@ -63,7 +64,7 @@ namespace vcpkg { namespace Graphs void add_edge(V u, V v) { this->vertices[v]; - this->vertices[u].push_back(v); + this->vertices[u].insert(v); } std::vector<V> find_topological_sort() const @@ -108,12 +109,12 @@ namespace vcpkg { namespace Graphs return indegrees; } - const std::unordered_map<V, std::vector<V>>& adjacency_list() const + const std::unordered_map<V, std::unordered_set<V>>& adjacency_list() const { return this->vertices; } private: - std::unordered_map<V, std::vector<V>> vertices; + std::unordered_map<V, std::unordered_set<V>> vertices; }; }} |
