14template<Edge E,util::HashFunction<
typename E::node_type> Hash = std::hash<
typename E::node_type>,fishnet::util::BiPredicate<
typename E::node_type> Equal = std::equal_to<
typename E::node_type>>
18 using N = E::node_type;
23 std::unordered_map<N,N> predecessor;
41 void onEdge(
const N & from,
const N & to){
42 predecessor.try_emplace(to,from);
49 std::optional<std::vector<N>>
get()
const{
53 nodes.push_back(goal);
54 while(this->predecessor.contains(nodes.back()) && !eq(nodes.back(),start)) {
55 nodes.push_back(this->predecessor.at(nodes.back()));
57 std::reverse(nodes.begin(),nodes.end());
58 return std::optional<std::vector<N>>{nodes};
Search Path implementation.
Definition SearchPath.hpp:16
void onOpen(const N &node)
Definition SearchPath.hpp:29
SearchPath(const N &start, const N &goal)
Definition SearchPath.hpp:27
void onEdge(const N &from, const N &to)
Definition SearchPath.hpp:41
N node_type
Definition SearchPath.hpp:25
std::optional< std::vector< N > > get() const
Definition SearchPath.hpp:49
bool stop() const
Definition SearchPath.hpp:45
void onClose(const N &node)
Definition SearchPath.hpp:35
CRTP Abstraction of Search Results.
Definition SearchResult.hpp:16
Definition AdjacencyContainer.hpp:4