在 WPF 应用程序中使用 GraphViz
我想在我的 WPF 应用程序中使用 GraphViz,而不安装 Graphviz。
AT&T(或其他人)是否分发这样的 DLL?
谢谢, 凯末尔
I want to use GraphViz in my WPF application without installing Graphviz.
Does AT&T (or somebody else) distribute such a DLL?
Thanks,
Kemal
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
您可以将 dot 工具从源代码编译为 DLL。这就是我不久前所做的。我将 QuickGraph 与 GraphViz 结合使用,并使用稍微修改过的控件版本渲染图形,您可以从此处获取 http://www.codeproject.com/KB/WPF/Dot2Wpf.aspx
You can compile the dot tool as DLL from source. That is what I did a while back. I use QuickGraph with GraphViz and render the graph with slightly modified version of the control you can get from here http://www.codeproject.com/KB/WPF/Dot2Wpf.aspx
显然 ImageMagick 可以读取 graphviz DOT 格式: http://www.imagemagick.org/script/formats .php
也许您可以使用此包装器从.NET 调用 ImageMagick http://imagemagick.codeplex.com/ 并让它读取 DOT 并输出为 PNG 或其他什么?我从未尝试过,据我所知,ImageMagick 可能最终会生成命令行程序!
(我很久以前就使用过 ASP classic 中的 graphviz,生成了 graphviz 可执行文件,结果很好。)
Apparently ImageMagick can read the graphviz DOT format: http://www.imagemagick.org/script/formats.php
Perhaps you can call ImageMagick from .NET using this wrapper http://imagemagick.codeplex.com/ and get it to read DOT and output as PNG or something? I've never tried, and for all I know ImageMagick might end up spawning the command line program anyway!
(I have used graphviz from ASP classic a long time ago by spawning the graphviz executable with good results BTW.)
尝试 graphviz 库 .NET 包装器 http://code.google.com/p/graphviznet/ 。
它接受托管对象形式的图形描述,通过 graphviz 布局引擎运行并获取数据。
如果您不想安装完整的graphviz,您可以只复制所需的dll集,请参阅演示项目中的readme.txt,项目还包含一个用于显示图形的WPF控件。
Try graphviz library .NET wrapper http://code.google.com/p/graphviznet/.
It accepts the description of a graph in the form of managed objects, runs through the graphviz layout engine and gets back the data.
If you don't want't to install complete graphviz, you can copy only required set of dll's, see readme.txt in demo project, project also contains a WPF control to display graphs.
许可
GraphViz 根据 Common Public License 获得许可(请参阅 CPL 常见问题解答)
同样来自 GraphViz 站点:
将 GraphViz 作为 DLL 使用
GraphViz 是一个可执行程序,而不是 DLL - 要在您的应用程序中使用它,您需要使用正确的命令行参数生成可执行文件并获取结果输出。
使用 GraphViz 的其他方式
有一个 COM 组件可以解析 DOT 语言并呈现它:
WinGraphViz 但我从未使用过它,也无法保证它的工作效果。
旁白:如果您在 WPF 中进行图形工作,我强烈建议您使用 QuickGraph 来实际管理图形 - 它还会输出到 GraphViz 兼容的文本文件。
Licensing
GraphViz is licensed under the Common Public License (see the CPL FAQ)
Also from the GraphViz site:
Using GraphViz as a DLL
GraphViz is an executable program rather than a DLL - to use it in your app you need to spawn the executable with the correct command line parameters and pick up the resulting output.
Other ways of using GraphViz
There is a COM component available that parses the DOT language and renders it:
WinGraphViz but I've never used it and cannot vouch for how well it works.
Aside: If you are doing graph work in WPF I thoroughly recommend using QuickGraph to actually manage the graph - it will also output to GraphViz compatible text files.
看看这个相当新的面向对象的 .NET Graphviz 包装器: https://github.com/ Rubjerg/Graphviz.NetWrapper
由于它通过对其附带的 Graphviz 库进行外部函数调用来工作,因此您无需安装任何东西。
Have a look at this fairly new object-oriented Graphviz wrapper for .NET: https://github.com/Rubjerg/Graphviz.NetWrapper
Since it works by doing foreign function calls to the Graphviz library it ships with, you don't have to install anything.