如何使用boost显示网格图? [英] how to display grid graph using boost?

查看:249
本文介绍了如何使用boost显示网格图?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要像打印这样的网格图

I want like to print the grid graph like this.

在这里输入的形象描述

我尝试以下code

#include <boost/graph/graphviz.hpp>
#include <boost/graph/grid_graph.hpp>
typedef boost::grid_graph<2> Grid;
int main()
{
    boost::array<std::size_t, 2> lengths = { { 3, 5 } };
    Grid grid(lengths);
    std::ofstream gout;
    gout.open("test.dot");
    boost::write_graphviz(gout, grid);

}

和输出了这样的。

在这里输入的形象描述

推荐答案

我想你会很乐意与替换 NEATO 有:

I think you'd be happy with replacing dot with neato there:

http://www.graphviz.org/category/graphviz-terms/neato

在这里输入的形象描述

这篇关于如何使用boost显示网格图?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆