Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Software to draw graphical models in plate notation

Tags:

So I see graphical models expressed in plate notation in research papers and online all the time (for example: http://www.cs.princeton.edu/~blei/papers/BleiNgJordan2003.pdf).

Is there a quick and easy way to produce these?? I've searched and searched but all I've found are solutions like GraphViz which are really way more powerful than what I need (and hence much more difficult to use). PGF/Tikz seems like my best bet, but again it seems like overkill.

Maybe my best bet is to just produce them in Inkscape, or bite the bullet and learn PGF/Tikz. They're just so popular that I thought there would be a simpler way to churn them out, but maybe not... TIA.

like image 337
JMS Avatar asked Aug 11 '10 19:08

JMS


2 Answers

GraphViz really isn't that hard to learn. The basic language is really simple for these kinds of graphs. It took me just a few moments to replicate (more or less) the first example from that pdf, and the nice thing about it is that, due to it's simplicity, it's quite easy to generate graphs procedurally from some other data source.

Digraph fig1 { rankdir = LR; //order things from left to right  //define alpha and beta as existing α [shape=circle]; β [shape=circle]; //not strictly nescessary but helps if you want to //assign them specific shapes or colours  subgraph cluster_M //names beginning with "cluster" get a box drawn, an odd hack {     label = "M"      θ [shape=circle];     subgraph cluster_N     {         label = "N"         z [shape=circle];         w [shape=circle, style=filled]         z->w; //quite literally z points at w     }      θ -> z; } α -> θ; β -> w; } 

compiled with dot -Tpng input.txt -o graph.png it comes out looking like this. If having the labels below the bubbles was important, you could do that with a couple of extra lines, similarly if specific placement of nodes is important you can adjust that too. In fact, if you don't specify an image format, the default behaviour of dot is to output a version of the input file with co-ordinates for the position of each element.

The output image

like image 145
Tyr Avatar answered Sep 28 '22 08:09

Tyr


Here is a more refined fork of Dietz's scripts: https://github.com/jluttine/tikz-bayesnet

like image 34
Karsten Avatar answered Sep 28 '22 08:09

Karsten