Files
reachability-algorithms/graph/scc.h
2022-07-12 14:42:29 +03:00

28 lines
476 B
C++

#ifndef SCC_H_
#define SCC_H_
#include "digraph.h"
#include <ranges>
namespace graph {
template<typename T>
class SCC : public Digraph<T> {
public:
SCC() = default;
SCC(std::map<T, std::set<T>> scc)
: Digraph<T>::Digraph(scc) { proxy = scc.begin()->first; }
//
T representative() { return proxy; };
private:
// Each SCC has a representative vertex that helps
// answer strong connectivity queries in O(1) time
T proxy;
};
}; // namespace graph
#endif