作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
为什么我不能编译以下简单的应用程序。如果我将 listS 更改为 vecS,则一切正常。 (我使用的是 boost 1.46.1 和 gcc 4.4.5)
#include <iostream>
#include <boost/graph/adjacency_list.hpp>
#include <boost/graph/graphviz.hpp>
int main(int argc, const char *argv[]) {
boost::adjacency_list< boost::listS, boost::listS, boost::bidirectionalS > g;
boost::write_graphviz(std::cout, g);
return 0;
}
最佳答案
write_graphviz
需要 vertex_id
属性以显示顶点标识符标签。安 adjacency_list
使用 listS
因为顶点容器不会自动提供这个 vertex_id
属性(property)。这种行为是有道理的,因为在链表中,没有可用于唯一标识元素的键或索引之类的东西。请记住,链表既不是随机访问序列,也不是关联容器。
您要么必须提供自己的 vertex_id
属性 getter,或使用具有固有 vertex_id
的顶点容器属性(property)。
关于boost - 为什么我不能使用带有 OutEdgeList=listS 和 VertexList=listS 的 boost 图 write_graphviz,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5781301/
我使用由 boost 图形库制作的图形,并希望访问 OutEdgeList 以获取/设置一些内部信息(用于构建 OutEdgeList 的 vector 的保留大小)。 我广泛地搜索了文档,但没有找到
为什么我不能编译以下简单的应用程序。如果我将 listS 更改为 vecS,则一切正常。 (我使用的是 boost 1.46.1 和 gcc 4.4.5) #include #include #i
我是一名优秀的程序员,十分优秀!