Improve readability

This commit is contained in:
stefiosif
2023-02-10 18:26:48 +02:00
parent 2175ac0ca9
commit 3591c58f6d
6 changed files with 217 additions and 158 deletions

View File

@@ -15,7 +15,9 @@ public:
BreadthFirstTree(Digraph<T> G, T root);
T root;
void removeEdgeTo(const T& u);
T root{};
};
template<typename T>
@@ -23,6 +25,18 @@ BreadthFirstTree<T>::BreadthFirstTree(Digraph<T> G, T root) {
this->adjList = algo::BreadthFirstSearch<T>(G.adjList).execute(root);
}
template<typename T>
void BreadthFirstTree<T>::removeEdgeTo(const T& u) {
for (const auto& x : this->vertices()) {
for (const auto& y : this->adjList[x]) {
if (y == u) {
this->remove(x, u);
return;
}
}
}
}
} // namespace graph
#endif