Graphviz和PyGraphViz [英] Graphviz vs PyGraphViz

查看:263
本文介绍了Graphviz和PyGraphViz的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要用Python阅读一些点文件(图),并从节点中提取一些值以填充我的数据结构.我看到有两个用于Python的graphviz软件包: graphviz

I have some dot files (digraphs) that I need to read in Python and extract some values from the nodes to populate my data structure. I see there are two graphviz packages for Python: graphviz and pygraphviz. Is there any big difference between the two? From a quick scroll of the docs, they pretty much seem to do the same thing. I'll be using this in Python 2.7.X for the aforementioned task.

推荐答案

graphviz 是轻量级的库,它调用graphviz作为子进程来执行所有动作并产生输出.该库非常适合快速,轻松地生成SVG或PNG输出.

graphviz is lightweight library which calls graphviz as subprocess to execute all actions and produce output. This library is great for quick and easy producing SVG or PNG output.

pygraphviz 是完整的C绑定,它使用graphviz作为库并公开了所有graphviz内部功能,例如添加/删除节点/边.但是,由于pip需要编译C绑定并查找所有库,因此部署带来了更高的复杂性.

pygraphviz is complete C bindings which uses graphviz as library and expose all graphviz internal functionality like add/remove nodes/edges. But it comes with higher complexity in deployment as pip needs to compile C bindings and find all libraries.

在您的情况下,由于需要读取和操作点文件,因此您似乎必须使用 pygraphviz .其他有趣的替代方法是 http://pypi.python.org/pypi/pydot 它是纯python点解析器.

In your case, as you need read and manipulate dot files, it looks like you have to go with pygraphviz. Other interesting alternative to take a look is http://pypi.python.org/pypi/pydot it is pure python dot parser.

免责声明:我有偏见,因为我为pygraphviz做出了一点贡献.

Disclaimer: I am biased, because I contributed (a little bit) to pygraphviz.

这篇关于Graphviz和PyGraphViz的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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