52# ifndef TPL_FIND_PATH_H
53# define TPL_FIND_PATH_H
93 template <AlephGraph
GT,
152 auto arc = i.get_curr();
171 return find(g, start, path, op);
199 return find(g, start, path, [end](
auto p) {
return p == end; });
216 find(g, start,
ret, [end](
auto p) {
return p == end; });
240 template <
class Op = Dft_Goal_Node<GT>>
272 template <AlephGraph
GT,
293 q.
put(i.get_current_arc());
323 auto a = i.get_current_arc();
407 return find_path(g, start, path, [end](
auto p) {
return p == end; });
423 find_path(g, start,
ret, [end](
auto p) {
return p == end; });
433 template <AlephGraph
GT,
441 template <
template <
typename T>
class Q,
class Op>
452 auto a = it.get_curr();
458 typename GT::Node *end =
nullptr, *curr =
nullptr;
459 while (
not q.is_empty())
480 auto a = it.get_curr();
503 while (curr != start)
544 return dfs(start, [end](
auto p) {
return p == end; });
549 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.
C++20 concepts for the protocol shared by graph algorithms.
List_Graph< Graph_Node< Node_Info >, Graph_Arc< Arc_Info > > GT
Path search on directed graphs defined through a graph class (not a digraph).
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.
Performs a breadth-first search for a path between a pair of nodes.
Path< GT > operator()(const GT &g, typename GT::Node *start, Op &op)
Invokes the breadth-first path search.
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())
Performs a depth-first search for a path between a pair of nodes.
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)
Invokes the depth-first path search.
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
size_t blossom_maximum_cardinality_matching(const GT &g, DynDlist< typename GT::Arc * > &matching, SA sa=SA())
Alias of compute_maximum_cardinality_general_matching().
#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.
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.