Refactor: Rename adjMatrix to adjList
This commit is contained in:
@@ -28,23 +28,23 @@ public:
|
||||
|
||||
template<typename T>
|
||||
Digraph<T>::Digraph(std::map<T, std::set<T>> G) {
|
||||
this->adjMatrix = G;
|
||||
this->adjList = G;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
bool Digraph<T>::contains(const T& u, const T& v) {
|
||||
return algo::BreadthFirstSearch<T>(this->adjMatrix).query(u, v);
|
||||
return algo::BreadthFirstSearch<T>(this->adjList).query(u, v);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void Digraph<T>::insert(const T& u, const T& v) {
|
||||
this->adjMatrix[u].insert(v);
|
||||
this->adjMatrix[v];
|
||||
this->adjList[u].insert(v);
|
||||
this->adjList[v];
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void Digraph<T>::remove(const T& u, const T& v) {
|
||||
this->adjMatrix[u].erase(v);
|
||||
this->adjList[u].erase(v);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
@@ -52,7 +52,7 @@ auto Digraph<T>::reverse() {
|
||||
std::map<T, std::set<T>> revMatrix;
|
||||
|
||||
for (const auto& u : this->vertices()) {
|
||||
for (const auto& v : this->adjMatrix[u]) {
|
||||
for (const auto& v : this->adjList[u]) {
|
||||
revMatrix[v].insert(u);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user