9namespace fishnet::graph::__impl {
20template<Graph G,
class SearchResultImpl>
22 using N = G::node_type;
25 searchResult.open(start);
26 while(not nodes.empty() and not searchResult.stop()){
27 N current = nodes.top();
29 if(searchResult.isOpen(current)) {
30 for(
auto & neighbour: g.getNeighbours(current)){
31 if(searchResult.isUnknown(neighbour) and predicate(current,neighbour)) {
32 nodes.push(neighbour);
33 searchResult.open(neighbour);
34 searchResult.onEdge(current,neighbour);
37 searchResult.close(current);
54static std::vector<typename G::edge_type>
getPath(
const G & g,
const typename G::node_type & start,
const typename G::node_type & goal) {
55 using N =
typename G::node_type;
56 using E =
typename G::edge_type;
57 using H = G::adj_container_type::hash_function;
58 using Eq = G::adj_container_type::equality_predicate;
61 auto pathOpt = searchPath.get();
63 return std::vector<E>();
65 std::vector<N> & nodes = *pathOpt;
67 for (
size_t i = 0; i < nodes.size()-1; i++){
68 edges.emplace_back(g.makeEdge(nodes[i],nodes[i+1]));
Search Path implementation.
Definition SearchPath.hpp:16
Definition FunctionalConcepts.hpp:42
Definition DFSAlgorithm.hpp:44
static std::vector< typename G::edge_type > getPath(const G &g, const typename G::node_type &start, const typename G::node_type &goal)
Find (any, not necessarily the shortest ) path between start and goal using depth-first search.
Definition DFSAlgorithm.hpp:54
Definition FunctionalConcepts.hpp:83