ExplicitGraph
Declared in astar/ExplicitGraph.h; the same class on the site of Doxygen.
-
template<class Cost = int>
class ExplicitGraph a weighted graph given explicitly, searched from a source to a target
The nodes are \( 0 , \ldots , n - 1 \); add_edge() adds an arc (or an edge) with its cost, and set_heuristic() gives \( h \) node by node (0 by default). The states are the nodes, and the features of Zobrist hashing and the perfect hash too. The arcs are kept in an ExplicitAdjacency, whose order of the arcs leaving a node is that of their insertion in every set but boost; in the set ads, a loop ( u , u ) is not kept, as it never shortens a path.
Public Functions
-
inline ExplicitGraph(std::size_t n, state_type s, state_type t)
constructor of a graph with n nodes and no arc, searched from s to t
-
inline void add_edge(state_type u, state_type v, Cost c, bool directed = false)
adds the arc ( u , v ) of cost c, and ( v , u ) too unless directed
-
inline void set_heuristic(state_type u, Cost h)
sets the heuristic value of the node u
-
inline void set_source(state_type s)
sets the source of the search
-
inline state_type initial_state(void) const noexcept
-
inline bool is_goal(state_type s) const noexcept
-
inline std::uint64_t hash(state_type s) const noexcept
-
inline Cost heuristic(state_type s) const noexcept
-
template<class F>
inline void for_each_successor(state_type s, Cost, F &&f) const
-
inline std::size_t num_features(void) const noexcept
-
template<class F>
inline void for_each_feature(state_type s, F &&f) const
-
inline std::uint64_t perfect_hash(state_type s) const noexcept
the perfect hash: the node
-
inline std::size_t size(void) const noexcept
the number of nodes
-
inline ExplicitGraph(std::size_t n, state_type s, state_type t)