迭代没有访问者的boost图
Iterate over boost graph without Visitor
我需要遍历一个图(DFS),但不使用标准的DFS访问者回调技术。
是否有一种方法可以迭代地遍历图?
for(each edge in my graph visited in dfs) {
do some complicated stuff;
}
是的,根据具体的图形类型,您可以直接使用
auto e = edges(g);
for (auto it = e.first; it != e.second; ++it)
{
}
如果你的图形模型不同的概念,你可能想要in_edges(g)
或out_edges(g)
: http://www.boost.org/doc/libs/1_55_0/libs/graph/doc/graph_concepts.html
编辑更新注释:
那你得自己包装了。您可以使用Boost协程强制拉出接口。或者您可以使用访问器来填充队列,在DFS完成后使用该队列。
相关文章:
- 理解boost::asio-async_read在无需读取内容时的行为
- boost::进程间消息队列引发错误
- 如何运行位于boost/libs/python/example/tutorial目录中的hello.cpp和Jamfil
- 访问者访问变体并返回不同类型时出错
- cmake如何在fedora工作站中找到boost静态库包
- CMake项目Boost库错误:Boost/config/compiler/gcc.hpp:165:10:致命错误:cs
- Boost Graph Library,修复节点大小
- 什么是"#include <boost/functional/hash.hpp> "?
- 基于boost的程序的静态链接——zlib问题
- C++:如何在CLion IDE中安装Boost
- 使用自定义访问者时具有自定义类型的提升变体失败(源自 boost::static_visitor)
- 使用访问者中的Boost变体中的类型不编译
- 在boost BGL中使用make_bfs_visitor而不是带有bfs的派生访问者
- 静态多态性与boost变体单访问者与多访问者与动态多态性
- 更改boost::来自访问者的变体基础类型
- boost::变体访问者返回错误(最麻烦的解析?)
- 自动定义来自CRTP的访问者(CRTP使用boost foreach和boost变体)
- Boost::变异;定义访问者类
- 迭代没有访问者的boost图
- Boost变量:我如何做一个返回已设置类型的访问者