30 lines
549 B
C++
30 lines
549 B
C++
#ifndef BREADTH_FIRST_TREE_H_
|
|
#define BREADTH_FIRST_TREE_H_
|
|
|
|
#include "algorithm/bfs.h"
|
|
#include "out_tree.h"
|
|
using namespace graph;
|
|
|
|
namespace tree {
|
|
|
|
template<typename T>
|
|
class BreadthFirstTree : public OutTree<T> {
|
|
public:
|
|
BreadthFirstTree() = default;
|
|
|
|
BreadthFirstTree(Digraph<T> G);
|
|
|
|
BreadthFirstTree(std::map<T, std::set<T>> G)
|
|
: OutTree<T>::OutTree(G) {}
|
|
};
|
|
|
|
template<typename T>
|
|
BreadthFirstTree<T>::BreadthFirstTree(Digraph<T> G) {
|
|
auto bfs = algo::BFS<T>(G).run(1);
|
|
|
|
Graph<T>::adjMatrix = bfs;
|
|
}
|
|
|
|
} // namespace tree
|
|
|
|
#endif |