|
Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
|
Lazy graph BFS/DFS with coroutines (graph-traverse-generators.H). More...
#include <iostream>#include <string>#include <graph-traverse-generators.H>#include <graph-traverse.H>#include <print_rule.H>#include <tpl_graph.H>Go to the source code of this file.
Functions | |
| int | main () |
Lazy graph BFS/DFS with coroutines (graph-traverse-generators.H).
Graph_Traverse (graph-traverse.H) already supports early termination: its visitor callback returns bool, and false stops the walk. What Graph_Traverse_BFS_Generator/Graph_Traverse_DFS_Generator (graph-traverse-generators.H) add is ergonomics and composability: the exact same algorithm, driven by a plain range-for with break instead of a callback that has to remember to return false, and naturally chainable with other lazy code.
This example runs the same "find a node, stop as soon as you do" search both ways on a small social-network graph, to make the code-shape difference concrete.
Definition in file lazy_graph_traversal_example.cc.
| int main | ( | void | ) |
Definition at line 168 of file lazy_graph_traversal_example.cc.
References Aleph::blossom_maximum_cardinality_matching(), and build_social_network().