Stop boost::depth_first_search along a particular depth if certain criteria is met

一笑奈何 提交于 2019-12-05 06:42:22

It seems that boost::depth_first_search does not support this, but the underlying boost::depth_first_visit does, through its 2nd overload allowing for a "terminator function" (TerminatorFunc).

So you could copy the implementation of boost::depth_first_search and substitute the detail::nontruth2() parameter passed to boost::depth_first_visit with your own (non-trivial) terminator function.

Lack of termination in depth-first-search - is the most stupid thing in graph library I ever seen.

May be, this may be the way out: depth_first_search on filtered_graph. You may mark the stop-vertex somehow, and in filter-edges function of filtered_graph just hide the incident edges

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!