Refactor: Replace std::map and std::set with unordered versions

This commit is contained in:
stefiosif
2022-10-12 17:26:11 +03:00
parent c525aeaa43
commit dc7fa93a6a
13 changed files with 44 additions and 41 deletions

View File

@@ -28,17 +28,17 @@ public:
// Remove edge (u,v) and update A accordingly for fast checking query
void remove(const T& u, const T& v) override;
std::map<T, SCC<T>> getSCCs() { return C; }
std::unordered_map<T, SCC<T>> getSCCs() { return C; }
private:
// Array used to answer strong connectivity queries in O(1) time
std::map<T, T> A;
std::unordered_map<T, T> A;
// Connect each representative with its SCC
std::map<T, SCC<T>> C;
std::unordered_map<T, SCC<T>> C;
// Maintain in-out bfs trees
std::map<T, BreadthFirstTree<T>> In;
std::map<T, BreadthFirstTree<T>> Out;
std::unordered_map<T, BreadthFirstTree<T>> In;
std::unordered_map<T, BreadthFirstTree<T>> Out;
};
template<typename T>