Graphviz layered drawing

If the layers graph attribute is set, the graph is printed in a sequence of colored layers, or overlays. (This coloring overrides any other settings.) layers defines a list of layer names, each separated by a sequence of separator characters. The tokens can be any identifier or natural number, except the reserved word all. By default, the separator characters are colon, space and tab, though this can be overridden using the layersep graph attribute.

The layer attribute of a node or edge enables its appearance in given layers. Its value specifies a layer, or a layer range, written as two layer names separated by a sequence of separator characters. The keyword all means all possible layers. If all is used as part of a range, the range denotes all layers bounded on one side by the other token. Thus, the label pvt:all of the edge node2 -> node3 in the example below corresponds to the layers pvt, test, new, and ofc.

As an example, the graph:

digraph G {

	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 */
produces the 5 layers shown below:
Layer 1
Layer 2
Layer 3
Layer 4
Layer 5

In a layered graph, if a given node (or edge) does not have a layer assignment, but incident edges (nodes, resp.) do, its layer specification is inferred from these. For example, in the examples above, node4 only appears on layer 3, because a layer assignment was given for its connecting edge. Note, however, that if a node or edge without a layer attribute is incident with an edge or node without a layer attribute (or such a node has no edges), then the node or edge appears on all layers.

To change the default so that nodes and edges with no layer attribute appear on all layers, insert

	node [layer=all];
	edge [layer=all];
at the beginning of the graph file.

At present, the layers feature is only available in PostScript output.

There is currently no way to specify a set of layers that are not a continuous range, sorry, but feel free to fix it in the source.

The color sequence for layers is set in the array layercolorseq (in Postscript at least). The first index is 1 and each element is a three-element color coordinate array. Custom layer colors can be created by setting the value of this array.