可视化 DAG
我有一个大型有向无环图,我想在位图图像中可视化。
理想情况下,我希望所有根节点都位于图像的顶部,所有叶节点都位于底部,即图形边缘都指向向下的方向。
是否有一个好的算法来计算出满足这些约束的所有节点的坐标并产生良好的可视化效果?
I have a large directed acyclic graph that I would like to visualize in a bitmap image.
Ideally I'd like to have all the root nodes at the top of the image, and all of the leaf nodes at the bottom, i.e. the graph edges are all pointing in a downwards direction.
Is there a good algorithm for working out the coordinates of all the nodes that meets these constraints and will produce a good visualization?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
我建议您使用 Gephi。
这个软件可以做你想做的所有事情,特别是图形布局!
I advise you to use Gephi.
This soft is able to do all the things you want to, especially graph layouts !
查看 Graphviz 软件集合。它包含几个用于渲染图形的程序。
最简单的方法是以 Graphviz 的文本格式之一将图形写入磁盘。然后执行渲染程序之一,并将生成的图像加载到您的应用程序中。
Look at the Graphviz software collection. It contains several programs to render graphs.
The most simple way is to write your graph to disk, in one of Graphviz's text formats. Then execute one of the render programs, and load the resulting image into your application.
贝叶斯网络有类似的要求。您可能会寻找贝叶斯网络的算法。例如,本文可能会有所帮助。
Bayesian Networks have similar requirements. You might look for algorithms for Bayesian Networks. This paper for example might be helpful.
如果图形相当简单,那么位图将非常适合您。然而,对于非常密集的图形,您需要带有矢量图形的文件,例如 SVG 文件,它将支持以更友好的方式放大和缩小精细细节。更好的是使用专门用于导航图形的交互式工具,例如上面提到的 gephi 或 yED
如果您想可视化软件依赖关系图,我发现的最佳导航工具是 DGML 工具是 Visual Studio 的一部分。他们使用非常强大的 Sugiyama 树形布局在使图形的流动具有方向性方面做得很好。它们具有强大的交互功能,这些边缘跳跃链接是无与伦比的。您还可以组织子图并将其折叠起来等。
维基百科中涵盖了几种图形描述语言,请查看
https://en.wikipedia.org/wiki/Category:Graph_description_languages。如果您有足够大的 RAM,DGML 工具可以非常愉快地渲染,并使图形的交互和探索变得非常直观。
这里有关于布局技术的不错的概述< /a> 特别是来自 Kozo Sugiyama 的#2 分层图形绘制。
If the graph is fairly simply then bitmaps will serve you fairly well. For very dense graphs however you'll want something with vector graphics, such as a SVG file that will support zooming in and out of fine details in a more friendly manner. Better yet is to use an interactive tool dedicated to navigating a graph such as gephi like someone mentioned above or yED
If you're trying to visualize a software dependency graph the best tool I've found for navigating is the DGML tools that are part of Visual Studio. They use a very powerful Sugiyama tree layout that does a fine job of making the flow of the graph directional. They have powerful interactive features with these edge hopping links that are bar none. You can also organize subgraphs and collapse them down, etc.
There's several graph description languages covered in Wikipedia with checking out
https://en.wikipedia.org/wiki/Category:Graph_description_languages. If you have a good chunk of RAM the DGML tools can render very pleasantly and make the interaction and exploration of the graph very intuitive.
There's a decent overview of layout techniques to be seen here particularly #2 Layered Graph Drawing from Kozo Sugiyama.
您可能对分层图形绘制(也称为“分层图形绘制”或“杉山式图形绘制”)感兴趣。该算法太长,无法在这里描述,但谷歌搜索提供了许多可靠的解释。
You might be interested in layered graph drawing (also known as "hierarchical graph drawing" or "Sugiyama-style graph drawing"). The algorithm is too long to describe here, but Google searches bring up many reliable explanations.
你可以试试我写的这个Go包: https://github.com/h8liu/e8tools/ tree/master/dagvis
示例:http://lonnie.io/gostd/dagvis/
You can try this Go package I wrote: https://github.com/h8liu/e8tools/tree/master/dagvis
An example: http://lonnie.io/gostd/dagvis/