开发者

Visualizing a DAG

开发者 https://www.devze.com 2023-01-12 12:09 出处:网络
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 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.开发者_JS百科

Is there a good algorithm for working out the coordinates of all the nodes that meets these constraints and will produce a good visualization?


I advise you to use Gephi.

This soft is able to do all the things you want to, especially graph layouts !


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.


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.


You can try this Go package I wrote: https://github.com/h8liu/e8tools/tree/master/dagvis

An example: http://lonnie.io/gostd/dagvis/

0

精彩评论

暂无评论...
验证码 换一张
取 消