Visualizing a DAG - graph

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?

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/

Related

Is it possible to download graph of scalars in TensorBoard?

I'm using Tensorboard to visualize the training of a neural network in R. Tensorboard gives really nice graphs of the accuracy, the loss, validation accuracy etcetera. I would like to download these graphs (including smoothing and legend) just like one can download the graph of the nodes. Is this possible? I know that you can download the data one by one, but then you would have to make the graph manually including the smoothing and legend. This would be a lot of work, while you already have such a nice looking graph. I have tried using SVG Crowbar, but I don't know which one to download (if this even works...). I do not know what to do. The best solution thus far seems to be using printscreen and paint.
Thanks in advance for helping me!

Successive pictures on R

I have a code to plot a world map with a meteorological field for one moment (or one measure).
Is it possible to successively plot the map for different moments (for i from 1 to 125) in order to view a sort of video when we run the code?
Yes, look at the animation package.
It can creates an animated gif for you (as well as other tricks). There are live examples you can look at as eg Buffon's needle, a CLT demo and much more.
The package abstracts away some of the OS-dependent layers. If you know the basics, you can of course just call the corresponding tool from the imagemagick project which is likely to be available on OS of choice too.

How do I visualise an arbitrary directed acyclic graph?

I'm looking for an algorithm to automatically visualise a large DAG. It needs to scale well to hundreds or even thousands of nodes and connections (without turning unreadable). Connections should avoid crossing over each other where possible, and should especially avoid crossing over nodes that they aren't connected to.
Is there any standard algorithm I can adapt for this purpose?
You could check out the scalable force-directed placement algorithm. Graphviz implements this, so if you'd like to preview it before implementing, create a Graphviz file and run sfdp my_dag.gv (or fdp which might be easier to implement).
If that doesn't work for you, you might want something like Circos or Hive Plots. Hive Plots work really well for thousands of nodes for both directed and undirected graphs. The algorithm is described at a high level on the homepage, but there's an accompanying journal article too.
You can try Gephi a graph viz software.
You can feed it with different file type (.gexf, .gdf).
As this is a open source software, you can look inside spatialization algorithms.
url: http://gephi.org/

Better way to visualize a social network graph

I have graph of friendship of one social network with about 1.5 million of nodes and 17 million edges - not all network, but that's enough for me.
Of course, it's undirected and unweighted.
What is the way to render it really beautiful? (e.g. to make a poster ;-)
You should try with Gephi. This is a very large graph but I think you can handle it with a correct computer.
I advice you to try OpenOrd (here) or ForceAtlas in Parallel version (here)
You can render as SVG or PDF to export you graph for "graphic customization"
You can have a look at Protovis ( http://mbostock.github.com/protovis/) especially ForceDirectedLayout
http://mbostock.github.com/protovis/ex/force.html

How to draw a directed graph with labels on edges using quickgraph and graph# libraries?

I'm trying to draw a directed graph with labels on edges. I'm using graph# (graphsharp) and quickgraph, and I saw an explanation in the forums about how to add labels (it is not supported by the library), but cannot manage to implement myself. If someone could provide a working example using these two libraries I would be very thankful.
Update:
I'm now looking for something a little more complicated: My edges behave like nodes, they have connections to other nodes and have a name-tag. So they are like any other node, and when I draw the graph these edge-nodes must appear exactly in the middle of a certain connections. Any ideas?
Although it's not documented, QuickGraph supports output to other formats, like DGML. VS 2010 includes a very basic DGML viewer. It may be possible to output DGML so that the resulting graph has edge labels. However you will likely need to add support yourself.
Download the QuickGraph sources and play around with it. I'm a committer on the project, so if you figure it out let me know and we'll get your changes into the project.

Resources