106
106
<TD ALIGN=RIGHT><I>compass_pt</I></TD>
107
107
<TD ALIGN=LEFT>:</TD>
108
<TD ALIGN=LEFT>(<B>n</B> | <B>ne</B> | <B>e</B> | <B>se</B> | <B>s</B> | <B>sw</B> | <B>w</B> | <B>nw</B>)</TD>
108
<TD ALIGN=LEFT>(<B>n</B> | <B>ne</B> | <B>e</B> | <B>se</B> | <B>s</B> | <B>sw</B> | <B>w</B> | <B>nw</B> | <B>c</B> | <B>_</B>)</TD>
112
112
The keywords <B>node</B>, <B>edge</B>, <B>graph</B>, <B>digraph</B>,
113
113
<B>subgraph</B>, and <B>strict</B> are case-independent.
114
114
Note also that the allowed compass point values are not keywords, so
115
these strings can be used elsewhere as ordinary identifiers.
115
these strings can be used elsewhere as ordinary identifiers and, conversely,
116
the parser will actually accept any identifier.
117
118
An <I>ID</I> is one of the following:
119
<LI> Any string of alphabetic characters, underscores or
120
digits, not beginning with a digit;
121
<LI> a number [<tt>-</tt>]<sup>?</sup>(<tt>.</tt>[<tt>0</tt>-<tt>9</tt>]<sup>+</sup> | [<tt>0</tt>-<tt>9</tt>]<sup>+</sup>(<tt>.</tt>[<tt>0</tt>-<tt>9</tt>]<sup>*</sup>)<sup>?</sup> );
120
<LI> Any string of alphabetic (<TT>[a-zA-Z\200-\377]</TT>) characters, underscores (<TT>'_'</TT>) or
121
digits (<TT>[0-9]</TT>), not beginning with a digit;
122
<LI> a numeral [<tt>-</tt>]<sup>?</sup>(<tt>.</tt>[<tt>0</tt>-<tt>9</tt>]<sup>+</sup> | [<tt>0</tt>-<tt>9</tt>]<sup>+</sup>(<tt>.</tt>[<tt>0</tt>-<tt>9</tt>]<sup>*</sup>)<sup>?</sup> );
122
123
<LI> any double-quoted string ("...") possibly containing escaped
124
quotes (\")<SUP>1</SUP>;
124
125
<LI> an <A NAME=html>HTML string</A> (<...>).
126
Note that in HTML strings, angle
127
An ID is just a string; the lack of quote characters in the first two
128
forms is just for simplicity. There is no semantic difference between
129
<TT>abc_2</TT> and <TT>"abc_2"</TT>, or between <TT>2.34</TT> and
130
<TT>"2.34"</TT>. Obviously, to use a keyword as an ID, it must be quoted.
131
Note that, in HTML strings, angle
127
132
brackets must occur in matched pairs, and unescaped newlines are allowed.
128
133
In addition, the content must be legal XML, so that the special XML
129
134
escape sequences for ", &, <, and > may be necessary
146
151
that a named subgraph with no body immediately preceeds an anonymous
147
152
subgraph, since the precedence rules cause this sequence to be parsed as
148
153
a subgraph with a heading and a body.
154
Also, any amount of whitespace may be inserted between terminals.
150
156
As another aid for readability, dot allows single logical lines to
151
157
span multiple physical lines using the standard C convention of a
153
159
double-quoted strings can be concatenated using a '+' operator.
154
160
As HTML strings can contain newline characters, they do not support the
155
161
concatenation operator.
156
<H2>Semantic Notes</H2>
162
<H2>Subgraphs and Clusters</H2>
163
Subgraphs play three roles in Graphviz. First, a subgraph can be used to
164
represent graph structure, indicating that certain nodes and edges should
165
be grouped together. This is the usual role for subgraphs
166
and typically specifies semantic information about the graph components.
168
In the second role, a subgraph can provide a context for setting attributes.
169
For example, a subgraph could specify that blue
170
is the default color for all nodes defined in it.
172
graph drawing, a more interesting example is:
175
rank = same; A; B; C;
178
This (anonymous) subgraph specifies that the nodes A, B and C
179
should all be placed on the same rank if drawn using dot.
181
The third role for subgraphs directly involves how the graph
182
will be laid out by certain layout engines. If the name of
183
the subgraph begins with <TT>cluster</TT>, Graphviz notes the subgraph as
184
a special <I>cluster</I> subgraph. If supported, the layout engine will
185
do the layout so that the nodes belonging to the cluster are drawn together,
186
with the entire drawing of the cluster contained within a bounding rectangle.
187
Note that, for good and bad, cluster subgraphs are not part of the
188
DOT language, but solely a syntactic convention adhered to by
189
certain of the layout engines.
190
<H2>Lexical and Semantic Notes</H2>
157
191
If a default attribute is
158
192
defined using a <B>node</B>, <B>edge</B>, or <B>graph</B> statement,
159
193
or by an attribute assignment not attached to a node or edge, any object of the
173
207
resetting the attribute as needed in the subgraphs, one can simple defer
174
208
the attribute definition if the graph until the appropriate subgraphs
175
209
have been defined.
211
If an edge belongs to a cluster, its endpoints belong to that cluster.
212
Thus, where you put an edge can effect a layout, as clusters are sometimes
213
laid out recursively.
215
There are certain restrictions on subgraphs and clusters. First, at
216
present, the names of a graph and it subgraphs share the same namespace.
217
Thus, each subgraph must have a unique name. Second, although nodes
218
can belong to any number of subgraphs, it is assumed clusters form
219
a strict hierarchy when viewed as subsets of nodes and edges.
176
220
<H2>Character encodings</H2>
177
221
The DOT language assumes at least the ascii character set.
178
222
Quoted strings, both ordinary and HTML-like, may contain non-ascii characters.
198
242
into a string, one can use the ascii sequence <TT>&beta;</TT>.
199
243
In general, one should only use entities that are allowed in the output
200
244
character set, and for which there is a glyph in the font.
247
<LI> In quoted strings in DOT, the only escaped character is double-quote
248
("). That is, in quoted strings, the dyad \" is converted to "; all other
249
characters are left unchanged. In particular, \\ remains \\. Layout
250
engines may apply additional escape sequences.