Move Graph::vertices to Digraph

This commit is contained in:
stefiosif
2022-10-12 09:32:40 +03:00
parent 3d9651c474
commit 8b6d341d18
3 changed files with 21 additions and 24 deletions

View File

@@ -4,8 +4,6 @@
#include "graph.h"
#include "algorithm/breadth_first_search.h"
#include <ranges>
namespace graph {
template<typename T>
@@ -26,9 +24,6 @@ public:
// Reverse graph directions
auto reverse();
// Return vertices
auto vertices();
};
template<typename T>
@@ -56,7 +51,7 @@ template<typename T>
auto Digraph<T>::reverse() {
std::map<T, std::set<T>> revMatrix;
for (const auto& u : vertices()) {
for (const auto& u : this->vertices()) {
for (const auto& v : this->adjMatrix[u]) {
revMatrix[v].insert(u);
}
@@ -65,11 +60,6 @@ auto Digraph<T>::reverse() {
return revMatrix;
}
template<typename T>
auto Digraph<T>::vertices() {
return std::views::keys(this->adjMatrix);
}
} // namespace graph
#endif