#include <DFS.hpp>
|
template<typename TGraph , typename TNode , typename F = std::function<bool(const TNode &, const size_t &)>> |
static void | run (const TGraph &graph, const TNode &start, F f_user=[](const TNode &, const size_t &) -> bool { return false;}) |
|
template<typename TGraph , typename TNode , typename F = std::function<void(const TNode &, const size_t &)>> |
static ext::vector< TNode > | findPath (const TGraph &graph, const TNode &start, const TNode &goal, F f_user=[](const TNode &, const size_t &) {}) |
|
template<typename TGraph , typename TNode > |
static ext::vector< TNode > | findPathRegistration (const TGraph &graph, const TNode &start, const TNode &goal) |
|
◆ findPath()
template<typename TGraph , typename TNode , typename F >
ext::vector< TNode > graph::traverse::DFS::findPath |
( |
const TGraph & |
graph, |
|
|
const TNode & |
start, |
|
|
const TNode & |
goal, |
|
|
F |
f_user = [](const TNode &, const size_t &) {} |
|
) |
| |
|
static |
Find path using DFS algorithm from the start
node to the goal
node in the graph
. However, it is not quarantee that the return path gonna be the shortest one.
Whenever node is opened, f_user
is called with two parameters (the opened node and distance to this node).
- Parameters
-
graph | to explore. |
start | initial node. |
goal | final node. |
f_user | function which is called for every opened node with value of currently shortest path. |
- Returns
- nodes in path, if there is no such path vector is empty.
◆ findPathRegistration()
template<typename TGraph , typename TNode >
static ext::vector< TNode > graph::traverse::DFS::findPathRegistration |
( |
const TGraph & |
graph, |
|
|
const TNode & |
start, |
|
|
const TNode & |
goal |
|
) |
| |
|
inlinestatic |
◆ run()
template<typename TGraph , typename TNode , typename F >
void graph::traverse::DFS::run |
( |
const TGraph & |
graph, |
|
|
const TNode & |
start, |
|
|
F |
f_user = [](const TNode &, const size_t &) -> bool { return false; } |
|
) |
| |
|
static |
Run DFS algorithm from the start
node in the graph
.
Whenever node is opened, f_user
is called with two parameters (the opened node and distance to this node). If return of f_user
is true, then the algorithm is stopped.
- Parameters
-
graph | to explore. |
start | initial node. |
f_user | function which is called for every opened node with value of currently shortest path. |
The documentation for this class was generated from the following file:
- alib2graph_algo/src/traverse/DFS.hpp