Fix includes and add some comments
This commit is contained in:
@@ -1,11 +1,10 @@
|
||||
#ifndef DECREMENTAL_SCC_H_
|
||||
#define DECREMENTAL_SCC_H_
|
||||
|
||||
#include "graph/digraph.h"
|
||||
#include "graph/scc.h"
|
||||
#include "algorithm/tarjan.h"
|
||||
#include "algorithm/bfs.h"
|
||||
#include "algorithm/roditty_zwick.h"
|
||||
#include "algorithm/tarjan.h"
|
||||
#include "algorithm/breadth_first_search.h"
|
||||
#include "tree/breadth_first_tree.h"
|
||||
|
||||
using namespace graph;
|
||||
|
||||
@@ -16,16 +15,12 @@ class DecrementalSCC : public RodittyZwick<T> {
|
||||
public:
|
||||
DecrementalSCC(Digraph<T> G) : G(G) {}
|
||||
|
||||
//
|
||||
void init();
|
||||
|
||||
//
|
||||
void findSCC();
|
||||
|
||||
//
|
||||
bool query(const T& u, const T& v);
|
||||
|
||||
//
|
||||
void remove(const T& u, const T& v);
|
||||
private:
|
||||
Digraph<T> G;
|
||||
@@ -49,13 +44,13 @@ void DecrementalSCC<T>::init() {
|
||||
|
||||
template<typename T>
|
||||
void DecrementalSCC<T>::findSCC() {
|
||||
auto SCCs = Tarjan<T>(G).findSCC();
|
||||
auto SCCs = Tarjan<T>(G).execute();
|
||||
|
||||
for (auto& C : SCCs) {
|
||||
const auto& w = C.representative();
|
||||
|
||||
// Create shortest-paths out-tree/in-tree
|
||||
auto outTree = Digraph<T>(BFS<T>(C).run(w));
|
||||
auto outTree = Digraph<T>(BreadthFirstSearch<T>(C).execute(w));
|
||||
SPT[w] = std::make_pair(outTree, outTree.reverse());
|
||||
|
||||
// Update A with current SCCs vertices
|
||||
@@ -89,7 +84,7 @@ void DecrementalSCC<T>::remove(const T& u, const T& v) {
|
||||
// Update In(w) and Out(w)
|
||||
connection[w].adjMatrix[u].erase(v);
|
||||
G.adjMatrix[u].erase(v);
|
||||
auto inTree = Digraph<T>(BFS<T>(connection[w]).run(w));
|
||||
auto inTree = Digraph<T>(BreadthFirstSearch<T>(connection[w]).execute(w));
|
||||
SPT[w] = std::make_pair(inTree, inTree.reverse());
|
||||
|
||||
// If a SCC is broken, compute all SCCs again
|
||||
|
||||
Reference in New Issue
Block a user