From 727e4ed6faabead764c4dbffaa5b57f5cfb4017a Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Tue, 15 Nov 2016 11:56:46 -0800 Subject: [Graph] Now uses set instead of vector --- toolsrc/include/vcpkg_Graphs.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'toolsrc/include') 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 +#include 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>& adjacency_list, + const std::unordered_map>& adjacency_list, std::unordered_map& exploration_status, std::vector& 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 find_topological_sort() const @@ -108,12 +109,12 @@ namespace vcpkg { namespace Graphs return indegrees; } - const std::unordered_map>& adjacency_list() const + const std::unordered_map>& adjacency_list() const { return this->vertices; } private: - std::unordered_map> vertices; + std::unordered_map> vertices; }; }} -- cgit v1.2.3