Reconstruct only the deconstructed SCC
This commit is contained in:
@@ -18,7 +18,7 @@ public:
|
||||
void init() override;
|
||||
|
||||
//
|
||||
void findSCC();
|
||||
void findSCC(graph::Digraph<T> 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<typename T>
|
||||
void RodittyZwick<T>::init() {
|
||||
findSCC();
|
||||
findSCC(this->G);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void RodittyZwick<T>::findSCC() {
|
||||
auto SCCs = Tarjan<T>(this->G.adjList).execute();
|
||||
void RodittyZwick<T>::findSCC(graph::Digraph<T> G) {
|
||||
auto SCCs = Tarjan<T>(G.adjList).execute();
|
||||
|
||||
for (auto& SCC : SCCs) {
|
||||
const auto& w = SCC.id;
|
||||
@@ -95,7 +95,7 @@ void RodittyZwick<T>::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
|
||||
|
||||
Reference in New Issue
Block a user