Split graph folder into graph and tree
This commit is contained in:
@@ -12,10 +12,12 @@ namespace algo {
|
||||
template<typename T>
|
||||
class BFS {
|
||||
public:
|
||||
BFS(Graph<T> G) : G(G) {}
|
||||
BFS() = default;
|
||||
|
||||
BFS(Digraph<T> G) : G(G) {}
|
||||
|
||||
//
|
||||
Digraph<T> run(const T& root);
|
||||
std::map<T, std::set<T>> run(const T& root);
|
||||
|
||||
// Initialize the lookup table that is used to
|
||||
// show which vertices have been traversed
|
||||
@@ -34,7 +36,7 @@ std::map<T, bool> BFS<T>::initExplore() {
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
Digraph<T> BFS<T>::run(const T& root) {
|
||||
std::map<T, std::set<T>> BFS<T>::run(const T& root) {
|
||||
std::map<T, std::set<T>> tree;
|
||||
std::map<T, bool> graphExplore = initExplore();
|
||||
std::queue<T> Q;
|
||||
@@ -54,7 +56,7 @@ Digraph<T> BFS<T>::run(const T& root) {
|
||||
}
|
||||
}
|
||||
|
||||
return Digraph<T>(tree);
|
||||
return tree;
|
||||
}
|
||||
|
||||
} // namespace algo
|
||||
|
||||
Reference in New Issue
Block a user