52# ifndef TPL_FIND_PATH_H
53# define TPL_FIND_PATH_H
150 auto arc = i.get_curr();
169 return find(g, start, path, op);
197 return find(g, start, path, [end](
auto p) {
return p == end; });
214 find(g, start,
ret, [end](
auto p) {
return p == end; });
238 template <
class Op = Dft_Goal_Node<GT>>
292 q.
put(i.get_current_arc());
322 auto a = i.get_current_arc();
406 return find_path(g, start, path, [end](
auto p) {
return p == end; });
422 find_path(g, start,
ret, [end](
auto p) {
return p == end; });
440 template <
template <
typename T>
class Q,
class Op>
451 auto a = it.get_curr();
457 typename GT::Node *end =
nullptr, *curr =
nullptr;
458 while (
not q.is_empty())
479 auto a = it.get_curr();
502 while (curr != start)
543 return dfs(start, [end](
auto p) {
return p == end; });
548 return bfs(start, [end](
auto p) {
return p == end; });
Exception handling system with formatted messages for Aleph-w.
#define ah_invalid_argument_if(C)
Throws std::invalid_argument if condition holds.
List_Graph< Graph_Node< Node_Info >, Graph_Arc< Arc_Info > > GT
Búsqueda de caminos sobre grafos dirigidos definidos mediante una clase grafo (no digrafo).
Directed_Find_Path(const GT &__g, SA &__sa)
Path< GT > dfs(typename GT::Node *start, Op &&op)
Path< GT > dfs(typename GT::Node *start, Op &op)
Path< GT > bfs(typename GT::Node *start, typename GT::Node *end)
Path< GT > dfs(typename GT::Node *start, typename GT::Node *end)
Directed_Find_Path(const GT &__g, SA &&__sa=SA())
Path< GT > find(typename GT::Node *start, Op &op)
Path< GT > bfs(typename GT::Node *start, Op &&op)
Path< GT > bfs(typename GT::Node *start, Op &op)
Dynamic queue of elements of generic type T based on single linked list.
T & put(const T &data)
The type of element.
T get()
Remove the oldest item of the queue.
void empty() noexcept
Empty the queue.
bool is_empty() const noexcept
Return true if this is empty.
Busca en amplitud un camino entre un par de nodos.
Path< GT > operator()(const GT &g, typename GT::Node *start, Op &op)
Invoca a la búsqueda de camino en amplitud.
Find_Path_Breadth_First(SA &_sa)
bool find_path(const GT &g, typename GT::Node *start, Path< GT > &path, Op &&op)
bool find_path(const GT &g, typename GT::Node *start, Path< GT > &path, Op &op)
Find_Path_Breadth_First(SA &&_sa=SA())
Busca en profundidad un camino entre un par de nodos.
Find_Path_Depth_First(SA &&__sa=SA())
Find_Path_Depth_First(SA &__sa)
bool operator()(const GT &g, typename GT::Node *start, typename GT::Node *end, Path< GT > &path)
Invoca a la búsqueda de camino en profundidad.
bool find(const GT &g, typename GT::Node *start, Path< GT > &path, Op &&op)
bool find_path(typename GT::Node *curr, typename GT::Arc *arc, Path< GT > &path, Op &op)
bool find(const GT &g, typename GT::Node *start, Path< GT > &path, Op &op)
Filtered iterator for outcoming arcs of a node.
void insert(Arc *arc)
Insert an arc as the first of a path.
void empty()
Clean the path: all the nodes and arc are removed.
bool inside_graph(const GT &gr) const noexcept
Return true if this is on graph gr
void set_graph(const GT &__g, Node *start_node=nullptr)
Set the graph of the path.
void append(Arc *arc)
Append an arc to the path.
Node * remove_last_node()
Remove the last node of path.
void set_state(unsigned int s) noexcept
Set the state to value s
void reset_bit_nodes(int bit) const noexcept
Reset bit to zero for all the nodes of graph.
void reset_arcs() const
Reset all the arcs of graph (the control bits, the state, the counter and the cookie)
Node * get_src_node(Arc *arc) const noexcept
Return the source node of arc (only for directed graphs)
Node * get_connected_node(Arc *arc, Node *node) const noexcept
Return the adjacent node to node through arc.
void reset_bit_arcs(int bit) const noexcept
Reset bit to zero for all the arcs of graph.
void reset_nodes() const
Reset all the nodes of graph (the control bits, the state, the counter and the cookie)
Node * get_tgt_node(Arc *arc) const noexcept
Return the target node of arc (only for directed graphs)
const unsigned char Processed
The node or arc has already been processed.
const unsigned char Processing
The node are being processed; probably it is inside a queue, stack or heap.
#define IS_NODE_VISITED(p, bit)
Determine whether the control bit is set or not to one.
#define ARC_BITS(p)
Return the control bits of arc p.
#define NODE_COOKIE(p)
Return the node cookie
#define IS_ARC_VISITED(p, bit)
Determine whether the bit field is or not set to one.
#define NODE_BITS(p)
Get the control bits of a node.
Main namespace for Aleph-w library functions.
and
Check uniqueness with explicit hash + equality functors.
Divide_Conquer_DP_Result< Cost > divide_and_conquer_partition_dp(const size_t groups, const size_t n, Transition_Cost_Fn transition_cost, const Cost inf=dp_optimization_detail::default_inf< Cost >())
Optimize partition DP using divide-and-conquer optimization.
bool operator()(typename GT::Node *) const noexcept
Default filter for filtered iterators on arcs.
Filtered iterator of adjacent arcs of a node.
Dynamic queue implementation based on linked lists.
Dynamic stack implementation based on linked lists.
Utility algorithms and operations for graphs.