#ifndef DIGRAPH_H_ #define DIGRAPH_H_ #include "graph.h" #include #include namespace graph { template class Digraph : public Graph { public: Digraph() = default; Digraph(std::map> digraph); // Reverse graph directions Digraph reverse(); }; template Digraph::Digraph(std::map> digraph) { Graph::adjMatrix = digraph; auto kv = std::views::keys(Graph::adjMatrix); Graph::vertices = std::set{ kv.begin(), kv.end() }; } template Digraph Digraph::reverse() { std::map> revMatrix; for (const auto& v : Graph::adjMatrix) { for (const auto& u : v.second) { revMatrix[u].insert(v.first); } } return revMatrix; } } // namespace graph #endif