Files
reachability-algorithms/graph/digraph.h
2022-06-12 20:33:11 +03:00

36 lines
643 B
C++

#ifndef DIGRAPH_H_
#define DIGRAPH_H_
#include "graph.h"
#include <algorithm>
#include <ranges>
namespace graph {
template<typename T>
class Digraph : public Graph<T> {
public:
Digraph() = default;
Digraph(std::map<T, std::set<T>> digraph);
// Reverse graph directions
Digraph<T> reverse();
};
template<typename T>
Digraph<T>::Digraph(std::map<T, std::set<T>> digraph) {
Graph<T>::adjMatrix = digraph;
auto kv = std::views::keys(Graph<T>::adjMatrix);
Graph<T>::vertices = std::set<T>{ kv.begin(), kv.end() };
}
template<typename T>
Digraph<T> Digraph<T>::reverse() {
return Digraph<T>();
}
} // namespace graph
#endif