Put root of BFS tree as constructor parameter
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
#ifndef BREADTH_FIRST_TREE_H_
|
||||
#define BREADTH_FIRST_TREE_H_
|
||||
|
||||
#include "algorithm/bfs.h"
|
||||
#include "out_tree.h"
|
||||
#include "algorithm/breadth_first_search.h"
|
||||
using namespace graph;
|
||||
|
||||
namespace tree {
|
||||
@@ -12,16 +12,15 @@ class BreadthFirstTree : public OutTree<T> {
|
||||
public:
|
||||
BreadthFirstTree() = default;
|
||||
|
||||
BreadthFirstTree(Digraph<T> G);
|
||||
BreadthFirstTree(Digraph<T> G, T root);
|
||||
|
||||
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);
|
||||
|
||||
BreadthFirstTree<T>::BreadthFirstTree(Digraph<T> G, T root) {
|
||||
auto bfs = algo::BreadthFirstSearch<T>(G).execute(root);
|
||||
Graph<T>::adjMatrix = bfs;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user