Most of the examples for the Boost:graph library perform depth-first-search by calling boost's depth first search utilities. After creation of the vertices and edges, calling DFS on the graph traverses the entire graph in a depth-first manner and if we have a visitor method associated with it, it would call the visitor method to perform an action, for every node traversed.
What I am looking for is a way to maintain an iterator over the graph, where instead of traversing the graph in one go, when the client calls 'next()', the iterator would move to the next vertex that it would traversed to for DFS and upon calling next again, the iterator would move to the next vertex as dictated by DFS.
Are there any examples of performing the above using boost:graph?
Thanks
Unfortunately for you, the boost::graph API is based on visitors, i.e. callbacks. In principle, the only way to convert that into iterators would be coroutines, which C++ does not have standard.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With