Layers for presentations

Hi,

I'm a novice using Graphviz and am having trouble with layers. I fear I don't understand the use of layers. My question: how to generate separate outputs that incrementally build up a single graph? I tried without success reproducing this example http://www.graphviz.org/wiki/how-use-drawing-layers-overlays My goal is to introduce in my lectures using an overhead projector each part of a complex graph without the first set of nodes and edges changing position or shape. Producing multiple different graphs results in changes in the position and size of nodes and edges that are far too subtle to manually align across the graphs. Ideally, I would instead write a single file that generates five different graphs which can be used in five different overhead slides where the nodes and edges in slide one never change shape or position as I proceed through slides 2-5 to add different parts to the graph.

Can layers do this? Or something else?
Thanks.

Can you provide more details

Can you provide more details as to what you are doing and what seems to be wrong? As far as I can tell, layers stil work fine.

I should note that the layers feature relies on an output format that supports multiple pages or layers, and the Graphviz renderer handling it as well. At present, layers only works with postscript output. If you want to achieve the same affect with other formats, the trick is to mimic what the layers feature does. That is, lay out the graph once with dot -Tdot, then render each layer separately using neato -n2, turning off the parts of the graph you don't want by setting style=invis.  Since each rendering uses the same coordinates, everything aligns.

As an example, suppose you have the dot file layer.gv containing

digraph G {
    layers="local:pvt:test:new:ofc";

    node1  [layer="pvt"];
    node2  [layer="all"];
    node3  [layer="pvt:ofc"];       /* pvt, test, new, and ofc */
    node2 -> node3  [layer="pvt:all"];  /* same as pvt:ofc */
    node2 -> node4 [layer=3];       /* same as test */
}

So, there are 5 layers, so we want 5 aligned images, say in png. To get this, first lay out the graph, then extract each layer and render:

dot layer.gv > out.gv

for l in local pvt test new ofc

do

  gvpr -c -a $l -f layers.txt out.gv | neato -Tpng -n2 > $l.png

done

using the gvpr script layers.txt. Also, ignore the warnings.

If you have any problems or questions, let me know.

Recent comments