Move Graph::vertices to Digraph
This commit is contained in:
@@ -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
|
||||
Reference in New Issue
Block a user