- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试使用 boost 的 graphviz 阅读下图:
graph G {
0[label="1"];
1[label="0"];
2[label="1"];
3[label="1"];
0--1 [label="1.2857"];
1--2 [label="4.86712"];
1--3 [label="2.29344"];
}
但是,每次我尝试编译它时,我都会遇到一个严重的错误:
/tmp/ccnZnPad.o: In function "bool boost::read_graphviz_new<boost::adjacency_list<boost::vecS, boost::vecS, boost::undirectedS, Vertex, Edge, boost::no_property, boost::listS> >(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, boost::adjacency_list<boost::vecS, boost::vecS, boost::undirectedS, Vertex, Edge, boost::no_property, boost::listS>&, boost::dynamic_properties&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&):test.cpp(.text._ZN5boost17read_graphviz_newINS_14adjacency_listINS_4vecSES2_NS_11undirectedSE6Vertex4EdgeNS_11no_propertyENS_5listSEEEEEbRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERT_RNS_18dynamic_propertiesESG_[_ZN5boost17read_graphviz_newINS_14adjacency_listINS_4vecSES2_NS_11undirectedSE6Vertex4EdgeNS_11no_propertyENS_5listSEEEEEbRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERT_RNS_18dynamic_propertiesESG_]+0x98): undefined reference to boost::detail::graph::read_graphviz_new(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, boost::detail::graph::mutate_graph*)'
collect2: error: ld returned 1 exit status
我不知道这是什么意思,我试过用 g++ -lboost_graph test.cpp
编译我仍然得到错误。我也尝试包括 <libs/graph/src/read_graphviz_new.cpp>
但后来我的程序中断了,因为它不知道是什么 <libs/graph/src/read_graphviz_new.cpp>
是。我不知道下一步需要尝试什么,或者这可能不是打印出来的正确方法。任何帮助将不胜感激!
#include <fstream>
#include <boost/graph/adjacency_list.hpp>
#include <boost/graph/graphviz.hpp>
#include <boost/property_map/dynamic_property_map.hpp>
//#include <libs/graph/src/read_graphviz_new.cpp> //breaks if I try to include
#include <boost/graph/graph_utility.hpp>
struct Vertex
{
bool isLeaf;
};
struct Edge
{
double weight;
};
typedef boost::adjacency_list<boost::vecS,boost::vecS, boost::undirectedS, Vertex, Edge> Graph;
int main()
{
Graph g;
boost::dynamic_properties dp;
dp.property("label", get(&Vertex::isLeaf, g));
dp.property("label", get(&Edge::weight, g));
std::ifstream dot("baseTree.dot");
boost::read_graphviz(dot,g,dp);
write_graphviz_dp(std::cout, g, dp);
}
最佳答案
read_graphviz 实现在库部分(已编译),因此您需要以某种方式链接它。
您可以直接编译并链接相关的 cpp 文件,甚至将其包含到您的文件中:
#include <libs/graph/src/read_graphviz_new.cpp>
“规范”方式是编译库和链接,例如与
g++ test.cpp -lboost_graph
是的,顺序很重要! ( Why does the order of '-l' option in gcc matter? )
关于c++ - 在 boost 中从 graphviz 读取的问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50282741/
我试图写我自己的 little algorithm用于仅创建节点布局但不定义边路由的图形布局。当我使用 Graphviz 将生成的点文件转换为图形时,边缘是穿过节点甚至相互重叠的直线。有没有一种方法可
我正在创建一个包含一千条边的圆形图。 如果我只在那里放一些,它工作得很好,例如,我可以改变边缘长度。但是,当我将所有数据放入时,我似乎无法再控制大小了。这张图片只是膨胀得离谱,只有微小的节点和与其他节
我正在使用 Doxygen 在我的源代码中制作一些 GraphViz 点图。 问题:由特定点文件生成的图形是否保证始终生成相同的输出? 对于不同的计算机、一天中的不同时间、不同的体系结构等,情况是否如
我怎么能画一个 arc graph在 GraphViz 中?我不能强制节点排成一行。 最佳答案 由于我没有足够的声誉来添加评论,我在这里发布了一些建议。下面的代码解决了强制节点排成一行的问题。 dig
我正在为graphviz HTML nodes使用per my previous question。为什么我要在外面放多余的盒子,如何摆脱它?另外,如何缩小身材? digraph g {
我有一组用 DOT 语言编码的有向图。我想构建一个图图,使得超图中的每个节点都是这些有向图之一。有没有办法在 GraphViz 框架内做到这一点? 我知道gvpack将允许我将多个图形组合成一个 .d
我想知道如何才能 strike-through我的节点中的一些文本基于点 graphviz图表? 我在此页面上查看过,但无法弄清楚: http://www.graphviz.org/doc/info/
我将 Graphviz 用作库 (C++)。我需要 Graphviz 来计算节点和相应边的坐标。我正在渲染自己(即不使用 Graphviz 的渲染器)。我的节点是矩形,具有定义的宽度和高度(以像素为单
我正在使用 Graphviz绘制一些图形。我在节点上使用标签,我可以输入 "\n"强制它将标签分成 2 行。有没有办法让 Graphviz(或我正在使用的 dot)自动看到它应该拆分一些节点标签,并让
我试图在 Graphviz 中的集群之间建立一个边缘,其中边缘不影响排名。 这看起来不错: digraph { subgraph clusterX { A B } s
我正在构建一个epsilon NFA,以使用规范构造来识别正则表达式。我正在使用子图对正则表达式的各个部分进行分组。 *运算符给我特别麻烦,因为dot决定移动节点的顺序。我尝试添加边缘权重以强制使特定
我正在尝试使用点显示从右到左(即向后)的边缘: C B 我能做的最好的是: digraph { a -> b; c -> a [dir="back"]; {rank=same;c a b
我用点语言制作了一棵树,类似于here . 有什么方法可以让树向右扩展,而不是向下扩展(因此根节点位于左侧,子节点向右扩展)。 最佳答案 这很简单,只要你坚持基本布局:place rankdir ="
我有以下 graphviz 文件: digraph ServerDependency { Server02 -> Server01 [tooltip="Database"]; Serv
我有几个相关的子图,我想在 GraphViz 中将它们绘制在一起。当我绘制简单的节点时,它看起来很漂亮: 来源: digraph { rankdir=LR; A1 -> A21; A1 -
我使用下面的代码使用点(graphviz)创建了一个图形。 digraph { node [color=Blue,shape=box] 1.1 [label="Frequency of t e
我用graphviz画了一张图。请参阅FSM 。我认为它很丑,因为自环边缘太短。边缘的属性“minlen”对我不起作用。我尝试了节点的几个端口,但除了我当前的实现之外,一切都显示出一团糟。你有什么好主
基本问题是如何控制 Graphviz 图中元素的垂直和水平定位。 考虑这个图表的摘录(在 wysiwig 编辑器中创建)。 我试图在 Graphviz 中重现它,以确定它是否适合我的目的。 digra
我有一个简单的 .dot 文件(graphviz),见下文: digraph Mapper{ Mapper [label=Mapper]; General [label=General];
我想在 GraphViz 中绘制 Chimera 类型的图形: https://www.ibm.com/developerworks/community/blogs/jfp/resource/BLOG
我是一名优秀的程序员,十分优秀!