diff --git a/graph/digraph.h b/graph/digraph.h index 37eaa6d..982816d 100644 --- a/graph/digraph.h +++ b/graph/digraph.h @@ -4,6 +4,8 @@ #include "graph.h" #include "algorithm/breadth_first_search.h" +#include + namespace graph { template @@ -24,6 +26,9 @@ public: // Reverse graph directions auto reverse(); + + // Return vertices + auto vertices(); }; template @@ -33,7 +38,7 @@ Digraph::Digraph(std::map> G) { template bool Digraph::contains(const T& u, const T& v) { - return algo::BreadthFirstSearch().query(u, v); + return algo::BreadthFirstSearch(this->adjMatrix).query(u, v); } template @@ -62,6 +67,11 @@ auto Digraph::reverse() { return revMatrix; } +template +auto Digraph::vertices() { + return std::views::keys(this->adjMatrix); +} + } // namespace graph #endif \ No newline at end of file