Refactor: Split remove into remove/repairTrees
This commit is contained in:
@@ -39,6 +39,9 @@ private:
|
|||||||
std::set<T> out;
|
std::set<T> out;
|
||||||
};
|
};
|
||||||
std::map<T, Edges> E;
|
std::map<T, Edges> E;
|
||||||
|
|
||||||
|
// Repair reachability trees after edge deletions
|
||||||
|
void repairTrees(std::map<T, std::stack<T>>& H);
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
@@ -82,6 +85,11 @@ void Italiano<T>::remove(const T& u, const T& v) {
|
|||||||
E[v].inc.erase(u);
|
E[v].inc.erase(u);
|
||||||
this->G.remove(u, v);
|
this->G.remove(u, v);
|
||||||
|
|
||||||
|
repairTrees(H);
|
||||||
|
}
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
void Italiano<T>::repairTrees(std::map<T, std::stack<T>>& H) {
|
||||||
for (const auto& z : this->G.vertices()) {
|
for (const auto& z : this->G.vertices()) {
|
||||||
while (H[z].size() > 0) {
|
while (H[z].size() > 0) {
|
||||||
const auto& h = H[z].top();
|
const auto& h = H[z].top();
|
||||||
|
|||||||
Reference in New Issue
Block a user