[Haskell-cafe] Tool for visualisation of graph reduction step by step

Miguel Ramos org.haskell at miguel.ramos.name
Fri Nov 15 15:08:48 UTC 2013


Qui, 2013-11-14 às 16:59 +0000, Stephen Tetley escreveu:
> On 14 November 2013 12:03, Miguel Ramos <org.haskell at miguel.ramos.name> wrote:
> >
> 
> > (b) What tools do people use for plotting static program graphs, such as
> > those in books, papers and slides?
> 
> 
> Graphviz can be tamed somewhat with ranking - see the examples in the manual.

Thanks, I've already conquered rank. For this kind of graph, mostly
tree-like, I find useful to let dot infer rank from edges, except for
those few edges which form cycles, where I use [ constraint = 0 ] so
that a rank constraint is not introduced for them.

To whom it may interest, my best is (distilled):

digraph G {
  graph [ splines = polyline ];
  node [ ordering = out, shape = plaintext ];
  edge [ arrowhead = none, headport = n ];
  a0 [ label = "@", root = 1 ];
  a0 -> a1;
  a1 [ label = "@" ];
  a1 -> a2;
  a2 [ label = take ];
  a1 -> a3;
  a3 [ label = 5 ];
  a0 -> a4;
  a4 [ label = "\"Desmond\"" ];
  b0 [ label = "@", root = 1, xlabel = "$" ];
  b0 -> b1;
  b1 [ label = f ];
  b0:se -> b0 [ constraint = 0, arrowhead = normal ]; // back edge is
special
}

... and this leaves a lot to be desired, and for my purpose, invisible
nodes or edges beat the purpose of specifying only the structure of the
graph, instead of computing its appearance.

I'm almost giving up with graphviz.

> 
> If you want pretty, hand coded graphs then TikZ is a handsome option.
> It has the obvious edges with or without arrowheads, but also the
> "anchor" abstraction which is a very neat way of placing edges.

Thanks, I didn't know TikZ, only PSTricks. I fear a bit having to
compute edge paths by hand...
However, it is true that an approach such as that provides good re-use
and will be easier for repetitive graphs, better than graphviz, which
does not have abstraction.

Thank you,

M.R.




More information about the Haskell-Cafe mailing list