Re: [graphviz-interest] Mixing layouts in a single render

Ryan Schmidt <[email protected]> Mon, 17 Nov 2014 10:06:18 -0600
Newsgroups gmane.comp.video.graphviz
Message-ID <[email protected]>
On Nov 17, 2014, at 7:21 AM, Simon wrote:

> I would need to render an image with graphviz showing a directed graph in usual DOT layout, surrounded by other kinds of layout (I would try neato, circo or twopi).  The center graph depicts a hierarchy and needs to look like it at a glance.  The other nodes are "related" in various ways and would be best placed outside the hierarchy (surrounding or encircling the hierarchy).
> 
> This does not seem possible in a single pass.  Howerver, I think I could render the hierarchy alone in dot layout and output it in dot format, then use the nodes positions to force them when rendering it again in neato/circo/etc format with all nodes.
> 
> Is this the way you would do it?  Is there a simpler way, or are there tools that wrap around or use graphviz to achieve this sort of thing?

You're right, this can't be done in a single pass. Graphviz uses a single layout engine. However a graph can include images in various places, as the content of the note or in a label, and that image could have been produced by a previous Graphviz rendering.

Here's an example of a dot layout embedded in an fdp layout:

_______________________________________________
[email protected]
http://lists.research.att.com/mailman/listinfo/graphviz-interest
outer.png (image/png, 25 KB) - not displayed
inner.gv (text/vnd.graphviz, 25 B)
digraph G {
  a->{b c}
}
outer.gv (text/vnd.graphviz, 60 B)
digraph G {
  w->{x y z}
  w [image="inner.png" label=""]
}
render.sh (application/octet-stream, 73 B)
#!/bin/sh

dot -Tpng inner.gv -oinner.png
fdp -Tpng outer.gv -oouter.png