Files
reachability-algorithms/graph/breadth_first_tree.h
2022-10-12 16:57:48 +03:00

28 lines
558 B
C++

#ifndef BREADTH_FIRST_TREE_H_
#define BREADTH_FIRST_TREE_H_
#include "digraph.h"
namespace graph {
template<typename T>
class BreadthFirstTree : public Digraph<T> {
public:
BreadthFirstTree() = default;
BreadthFirstTree(std::map<T, std::set<T>> G, T root)
: BreadthFirstTree<T>(Digraph<T>(G), root) {}
BreadthFirstTree(Digraph<T> G, T root);
T root;
};
template<typename T>
BreadthFirstTree<T>::BreadthFirstTree(Digraph<T> G, T root) {
this->adjList = algo::BreadthFirstSearch<T>(G.adjList).execute(root);
}
} // namespace graph
#endif