101 cout <<
"[1] BFS / DFS, driven lazily from Alice\n";
104 cout <<
"BFS order: ";
107 cout << n->get_info() <<
" ";
110 cout <<
"DFS order: ";
113 cout << n->get_info() <<
" ";
119 cout <<
"[2] Early termination: callback-with-bool vs plain break\n";
122 const string target =
"Eve";
132 if (n->get_info() == target)
139 cout <<
"Eager Graph_Traverse (callback) searching for \"" << target <<
"\":\n";
150 if (n->get_info() == target)
156 cout <<
"Lazy Graph_Traverse_BFS_Generator (range-for) searching for \""
157 << target <<
"\":\n";
161 cout <<
"Same node count either way — both approaches support early\n"
162 "termination. The lazy version reads as plain iteration-with-break\n"
163 "instead of a callback contract you have to get right, and it\n"
164 "composes with other range-for/`Generator` code for free.\n\n";
171 cout <<
"\n=== Lazy graph BFS/DFS ===\n\n";
WeightedDigraph::Node Node
Graph build_social_network()
Build a sample social network graph.
Lazily traverse a graph depth-first or breadth-first.
virtual Node * insert_node(Node *node) noexcept
Insertion of a node already allocated.
Arc * insert_arc(Node *src_node, Node *tgt_node, void *a)
Traverse a graph depth-first or breadth-first and execute a visit function.
Lazy (coroutine-based) graph traversal (DFS, BFS).
Graph traversal algorithms (DFS, BFS).
size_t blossom_maximum_cardinality_matching(const GT &g, DynDlist< typename GT::Arc * > &matching, SA sa=SA())
Alias of compute_maximum_cardinality_general_matching().
DFSResult< typename Domain::Distance > dfs(Domain &domain, typename Domain::State &state, SearchPath< typename Domain::Move > &path, const typename Domain::Distance g, const typename Domain::Distance threshold, const size_t depth, IDAStarResult< Solution, typename Domain::Distance > &result, OnSolution &on_solution)
Core recursive DFS used by IDA* for a single threshold pass.
Main namespace for Aleph-w library functions.
bool traverse(Node *root, Op op)
void print_rule()
Prints a horizontal rule for example output separation.
Arc of graph implemented with double-linked adjacency lists.
Node belonging to a graph implemented with a double linked adjacency list.
Filtered iterator of adjacent arcs of a node.
Generic graph and digraph implementations.