Add operator<< for graph types, add contains query for digraph types and normalize scc
This commit is contained in:
28
graph/breadth_first_tree.h
Normal file
28
graph/breadth_first_tree.h
Normal file
@@ -0,0 +1,28 @@
|
||||
#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->adjMatrix = algo::BreadthFirstSearch<T>(G.adjMatrix).execute(root);
|
||||
}
|
||||
|
||||
} // namespace graph
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user