停止的boost :: depth_first_search沿着一个特定的深度,如果满足一定的条件 [英] Stop boost::depth_first_search along a particular depth if certain criteria is met
问题描述
我使用 BGL 来存储我的DAG。顶点有一定的状态。鉴于我想更新相关顶点顶点的一个状态的更改。这我能做到使用boost :: depth_first_search和一个自定义的访客。
I'm using BGL to store my DAG. Vertices have states. Given a change in state in one of the vertices i want to update dependent vertices. This i'm able to do using boost::depth_first_search and a custom visitor.
现在的逻辑是,我不希望如果顶点是在一个特定的状态更新搜索顶点及其相关。基本上我想EN-排队在任何DFS或BFS顶点的控制权。什么是BGL实现这一目标的最佳途径。
Now the logic is that i dont want to update a searched vertex and its dependent if the vertex is in a particular state. Basically i want to control over en-queuing of vertices in either dfs or bfs. What is the best way to achieve this in BGL.
感谢。
推荐答案
似乎提振:: depth_first_search不支持这一点,但潜在的boost :: depth_first_visit呢,通过其第二超载允许一个终结者功能( TerminatorFunc)。
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).
所以,你可以复制的boost :: depth_first_search的实施,并替代传递给boost :: depth_first_visit用自己的(非平凡)终止功能细节:: nontruth2()的参数。
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.
这篇关于停止的boost :: depth_first_search沿着一个特定的深度,如果满足一定的条件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!