PBeFS
Parallel Best-First Search
Loading...
Searching...
No Matches
ExplicitGraph< Cost > Class Template Reference

a weighted graph given explicitly, searched from a source to a target More...

#include <PBeFS/astar/ExplicitGraph.h>

Public Types

using state_type = std::uint32_t
 a node
using cost_type = Cost
 the cost type

Public Member Functions

 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
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
void set_heuristic (state_type u, Cost h)
 sets the heuristic value of the node u
void set_source (state_type s)
 sets the source of the search
state_type initial_state (void) const noexcept
bool is_goal (state_type s) const noexcept
std::uint64_t hash (state_type s) const noexcept
Cost heuristic (state_type s) const noexcept
template<class F>
void for_each_successor (state_type s, Cost, F &&f) const
std::size_t num_features (void) const noexcept
template<class F>
void for_each_feature (state_type s, F &&f) const
std::uint64_t perfect_hash (state_type s) const noexcept
 the perfect hash: the node
std::size_t size (void) const noexcept
 the number of nodes

Detailed Description

template<class Cost = int>
class PBeFS_di_unipi_it::ExplicitGraph< Cost >

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.

Member Typedef Documentation

◆ cost_type

template<class Cost = int>
using cost_type = Cost

the cost type

◆ state_type

template<class Cost = int>
using state_type = std::uint32_t

a node

Constructor & Destructor Documentation

◆ ExplicitGraph()

template<class Cost = int>
ExplicitGraph ( std::size_t n,
state_type s,
state_type t )
inline

constructor of a graph with n nodes and no arc, searched from s to t

Member Function Documentation

◆ add_edge()

template<class Cost = int>
void add_edge ( state_type u,
state_type v,
Cost c,
bool directed = false )
inline

adds the arc ( u , v ) of cost c, and ( v , u ) too unless directed

◆ for_each_feature()

template<class Cost = int>
template<class F>
void for_each_feature ( state_type s,
F && f ) const
inline

◆ for_each_successor()

template<class Cost = int>
template<class F>
void for_each_successor ( state_type s,
Cost ,
F && f ) const
inline

◆ hash()

template<class Cost = int>
std::uint64_t hash ( state_type s) const
inlinenodiscardnoexcept

◆ heuristic()

template<class Cost = int>
Cost heuristic ( state_type s) const
inlinenodiscardnoexcept

◆ initial_state()

template<class Cost = int>
state_type initial_state ( void ) const
inlinenodiscardnoexcept

◆ is_goal()

template<class Cost = int>
bool is_goal ( state_type s) const
inlinenodiscardnoexcept

◆ num_features()

template<class Cost = int>
std::size_t num_features ( void ) const
inlinenodiscardnoexcept

◆ perfect_hash()

template<class Cost = int>
std::uint64_t perfect_hash ( state_type s) const
inlinenodiscardnoexcept

the perfect hash: the node

◆ set_heuristic()

template<class Cost = int>
void set_heuristic ( state_type u,
Cost h )
inline

sets the heuristic value of the node u

◆ set_source()

template<class Cost = int>
void set_source ( state_type s)
inline

sets the source of the search

◆ size()

template<class Cost = int>
std::size_t size ( void ) const
inlinenodiscardnoexcept

the number of nodes


The documentation for this class was generated from the following file: