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 {
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 */
}
produces the 5 layers shown below:
|
|
|
|
|
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.
subgraph sub0 {
node [color=red];
a; b; c;
}
subgraph sub1 {
node [shape=diamond];
a; b; c;
}
We don't want to reset a,b,c to color=black just because
that is default in sub1.
Solution: none, hope for a fix in libgraph.