Update decremental algorithms according to project structure changes

This commit is contained in:
stefiosif
2022-09-25 17:42:00 +03:00
parent d63411672d
commit 14a61c92e9
3 changed files with 52 additions and 47 deletions

View File

@@ -50,17 +50,15 @@ void Digraph<T>::insert(const T& u, const T& v) {
template<typename T>
void Digraph<T>::remove(const T& u, const T& v) {
this->adjMatrix[u].erase(v);
//if (this->adjMatrix[u].size() == 0)
// this->adjMatrix.erase(u);
}
template<typename T>
auto Digraph<T>::reverse() {
std::map<T, std::set<T>> revMatrix;
for (const auto& u : this->adjMatrix) {
for (const auto& v : u.second) {
revMatrix[v].insert(u.first);
for (const auto& u : vertices()) {
for (const auto& v : this->adjMatrix[u]) {
revMatrix[v].insert(u);
}
}