61 lines
1004 B
C++
61 lines
1004 B
C++
#ifndef DECREMENTAL_MAINTENANCE_H_
|
|
#define DECREMENTAL_MAINTENANCE_H_
|
|
|
|
#include "graph/digraph.h"
|
|
#include "graph/scc.h"
|
|
#include "algorithm/tarjan.h"
|
|
#include "algorithm/bfs.h"
|
|
#include "algorithm/roditty_zwick.h"
|
|
|
|
using namespace graph;
|
|
|
|
namespace algo {
|
|
|
|
template<typename T>
|
|
class DecrementalMaintenance : public RodittyZwick<T> {
|
|
public:
|
|
DecrementalMaintenance(Digraph<T> G) : G(G) {}
|
|
|
|
//
|
|
void init();
|
|
|
|
//
|
|
void query();
|
|
|
|
//
|
|
void remove();
|
|
private:
|
|
Digraph<T> G;
|
|
};
|
|
|
|
template<typename T>
|
|
void DecrementalMaintenance<T>::init() {
|
|
std::map<T, T> A;
|
|
Tarjan<T> tarjan(G);
|
|
|
|
auto sccs = tarjan.run();
|
|
|
|
for (auto& scc : sccs) {
|
|
const auto& root = scc.representative();
|
|
BFS<T> bfs(scc);
|
|
auto spt = bfs.run(root);
|
|
for (const auto& vertex : scc.vertices) {
|
|
A[vertex] = root;
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
template<typename T>
|
|
inline void DecrementalMaintenance<T>::query()
|
|
{
|
|
}
|
|
|
|
template<typename T>
|
|
inline void DecrementalMaintenance<T>::remove()
|
|
{
|
|
}
|
|
|
|
}; // namespace algo
|
|
|
|
#endif |