Subject: [boost] Boost.Graph depth_first_visit algorithm
From: Brook Milligan (brook_at_[hidden])
Date: 2018-07-09 17:23:35


The documentation on the Boost.Graph depth_first_visit algorithm indicates that the first argument is a non-const reference to an Incidence Graph. See https://www.boost.org/doc/libs/1_67_0/libs/graph/doc/depth_first_visit.html.

However, in contrast the code in boost/graph/depth_first_search.hpp only implements the function for a _const_ reference to an Incidence Graph.

I can see that changing the graph structure mid-traversal is a problem, but I have use cases in which graph properties (not graph structure) must be changed along the traversal. Thus, it seems that a valid use case is for this algorithm to work as documented, i.e., on a non-const graph.

The attached patch implements overloads for the non-const versions of depth_first_{visit|search}, including overloads for the dfs_visitor member functions.

Is there some reason not to extend the implemented interface in this way to better agree with the documentation?

Cheers,
Brook