#ifndef BREADTH_FIRST_TREE_H_ #define BREADTH_FIRST_TREE_H_ #include "digraph.h" namespace graph { template class BreadthFirstTree : public Digraph { public: BreadthFirstTree() = default; BreadthFirstTree(std::unordered_map> G, T root) : BreadthFirstTree(Digraph(G), root) {} BreadthFirstTree(Digraph G, T root); void removeEdgeTo(const T& u); T root{}; }; template BreadthFirstTree::BreadthFirstTree(Digraph G, T root) { this->adjList = algo::BreadthFirstSearch(G.adjList).execute(root); } template void BreadthFirstTree::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