From 54eee41f7d3f46b118999c73d6dc55749dbd5897 Mon Sep 17 00:00:00 2001 From: stefiosif Date: Sat, 28 Jan 2023 21:32:25 +0200 Subject: [PATCH] Reconstruct only the deconstructed SCC --- include/algorithm/roditty_zwick.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/include/algorithm/roditty_zwick.h b/include/algorithm/roditty_zwick.h index e6f1b67..fb00aef 100644 --- a/include/algorithm/roditty_zwick.h +++ b/include/algorithm/roditty_zwick.h @@ -18,7 +18,7 @@ public: void init() override; // - void findSCC(); + void findSCC(graph::Digraph G); // Return true if u and v are in the same SCC bool query(const T& u, const T& v) override; @@ -44,12 +44,12 @@ private: template void RodittyZwick::init() { - findSCC(); + findSCC(this->G); } template -void RodittyZwick::findSCC() { - auto SCCs = Tarjan(this->G.adjList).execute(); +void RodittyZwick::findSCC(graph::Digraph G) { + auto SCCs = Tarjan(G.adjList).execute(); for (auto& SCC : SCCs) { const auto& w = SCC.id; @@ -95,7 +95,7 @@ void RodittyZwick::remove(const T& u, const T& v) { // If a SCC is broken, compute all SCCs again if (!In[w].adjList.count(u) || !Out[w].adjList.count(v)) - findSCC(); + findSCC(C[w]); } }; // namespace algo