4 #include "../structures/Graph.hpp"
16 template <
class GRAPH>
17 void DFS_recursive (
const GRAPH& graph,
const typename GRAPH::idx_t node,
typename GRAPH::visit_list_t& visited,
typename GRAPH::ordered_list_t& out) {
18 graph.checkRange(node);
19 typename GRAPH::idx_list_t tempList;
20 typename GRAPH::DFS_queue_t queue;
23 out.emplace_back(node);
24 tempList = graph.getUnvisitedNeighbours(node,visited);
26 for (
auto v : tempList) {
40 template <
class Graph>
void DFS_recursive(const GRAPH &graph, const typename GRAPH::idx_t node, typename GRAPH::visit_list_t &visited, typename GRAPH::ordered_list_t &out)
Recursive call for DFS.
Definition: DFS.hpp:17
Graph::ordered_list_t DFS(const Graph &graph, const typename Graph::idx_t node)
Traverses the connected component of node using DFS.
Definition: DFS.hpp:41
gl::index_type idx_t
Index type.
Definition: Graph.hpp:44
Stores and implements a Graph.
Definition: Graph.hpp:39
idx_t numNodes() const
Returns the number of nodes currently in the graph.
Definition: Graph.hpp:406
std::list< idx_t > ordered_list_t
Ordered List type.
Definition: Graph.hpp:49
std::vector< bool > visit_list_t
Visited-List type.
Definition: Graph.hpp:50
void checkRange(const idx_t &idx1) const
Only one index that gets range checked.
Definition: Graph.hpp:1389