Add tests for same SCC O(1) query

This commit is contained in:
stefiosif
2022-06-29 17:33:27 +03:00
parent 8d8e6ef831
commit d199b7de17
4 changed files with 23 additions and 11 deletions

View File

@@ -17,7 +17,7 @@ public:
Tarjan(Digraph<T> G) : G(G) {}
//
std::vector<SCC<T>> run();
std::vector<SCC<T>> findSCC();
//
void strongConnect(const T& v);
@@ -68,7 +68,7 @@ void Tarjan<T>::strongConnect(const T& v) {
}
template<typename T>
std::vector<SCC<T>> Tarjan<T>::run() {
std::vector<SCC<T>> Tarjan<T>::findSCC() {
for (const auto& v : G.vertices) {
if (p[v].index == -1) {
strongConnect(v);