Refactor: Change reachability interfaces to handle multiple removals/insertions
This commit is contained in:
@@ -25,16 +25,10 @@ public:
|
||||
// and then if necessary check the set S
|
||||
bool query(const T& u, const T& v) override;
|
||||
|
||||
// Delete edge e(u, v)
|
||||
void remove(const T& u, const T& v) override;
|
||||
|
||||
// Remove collection of edges from the decremental maintenance data structure
|
||||
// and for every vertex in set S, rebuilt reachability trees from scratch
|
||||
void remove(const std::vector<std::pair<T,T>>& edges);
|
||||
|
||||
// Add edge e(u, v)
|
||||
void insert(const T& u, const T& v) override;
|
||||
|
||||
// Insert collection of edges in set S, if threshold is reached re-initialize
|
||||
// algorithm, otherwise construct reachability trees for the vertex that is
|
||||
// the center-of-insertions
|
||||
@@ -70,15 +64,10 @@ bool HenzingerKing<T>::query(const T& u, const T& v) {
|
||||
});
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void HenzingerKing<T>::remove(const T& u, const T& v) {
|
||||
this->G.remove(u, v);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void HenzingerKing<T>::remove(const std::vector<std::pair<T, T>>& edges) {
|
||||
for (const auto& [u, v]: edges) {
|
||||
remove(u, v);
|
||||
for (const auto& [u, v] : edges) {
|
||||
this->G.remove(u, v);
|
||||
}
|
||||
frigioni.remove(edges);
|
||||
|
||||
@@ -88,15 +77,10 @@ void HenzingerKing<T>::remove(const std::vector<std::pair<T, T>>& edges) {
|
||||
}
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void HenzingerKing<T>::insert(const T& u, const T& v) {
|
||||
this->G.insert(u, v);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void HenzingerKing<T>::insert(const T& c, const std::vector<T>& vertices) {
|
||||
for (const auto& w : vertices)
|
||||
insert(c, w);
|
||||
this->G.insert(c, w);
|
||||
|
||||
S.insert(c);
|
||||
if (S.size() > threshold) {
|
||||
|
||||
Reference in New Issue
Block a user