Saving an iterator in Boost :: graph when running DFS

Most examples for the Boost: graph library perform a depth search in the first call using the first search utility to increase the depth. After creating vertices and edges, the DFS call on the graph intersects the entire graph with depth in the first order, and if we have a visitor method associated with it, it will call the visitor method to perform the action for each node it passes.

What I'm looking for is a way to maintain an iterator on a graph, where instead of moving around the graph at a time when the client calls "next ()", the iterator will move to the next vertex so that it traverses for DFS, and after repeated call, the iterator will move to the next vertex, as dictated by DFS.

Are there any examples of doing the above using boost: graph?

thank

+5
source share
1 answer

Unfortunately for you, boost :: graph API is based on visitors, i.e. callbacks. Basically, the only way to convert this to iterators is with coroutines that C ++ doesn't have a standard one.

+1
source

All Articles