annotate toolboxes/graph_visualisation/share/graphviz/doc/html/info/lang.html @ 0:cc4b1211e677 tip

initial commit to HG from Changeset: 646 (e263d8a21543) added further path and more save "camirversion.m"
author Daniel Wolff
date Fri, 19 Aug 2016 13:07:06 +0200
parents
children
rev   line source
Daniel@0 1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
Daniel@0 2 <!--
Daniel@0 3 This is a generated document. Do not edit.
Daniel@0 4 -->
Daniel@0 5 <HTML VERSION="2.0">
Daniel@0 6 <HEAD>
Daniel@0 7 <TITLE>The DOT Language</TITLE>
Daniel@0 8 </HEAD>
Daniel@0 9 <BODY BGCOLOR=white>
Daniel@0 10 <A NAME="top"></A>
Daniel@0 11 <H1 ALIGN=CENTER>The DOT Language</H1>
Daniel@0 12 <HR>
Daniel@0 13 The following is an abstract grammar defining the DOT language.
Daniel@0 14 Terminals are shown in bold font and nonterminals in italics.
Daniel@0 15 Literal characters are given in single quotes.
Daniel@0 16 Parentheses ( and ) indicate grouping when needed.
Daniel@0 17 Square brackets [ and ] enclose optional items.
Daniel@0 18 Vertical bars | separate alternatives.
Daniel@0 19 <TABLE>
Daniel@0 20 <TR>
Daniel@0 21 <TD ALIGN=RIGHT><I>graph</I></TD>
Daniel@0 22 <TD ALIGN=LEFT>:</TD>
Daniel@0 23 <TD ALIGN=LEFT>[ <B>strict</B> ] (<B>graph</B> | <B>digraph</B>) [ <I>ID</I> ] <B>'{'</B> <I>stmt_list</I> <B>'}'</B></TD>
Daniel@0 24 </TR>
Daniel@0 25 <TR>
Daniel@0 26 <TD ALIGN=RIGHT><I>stmt_list</I></TD>
Daniel@0 27 <TD ALIGN=LEFT>:</TD>
Daniel@0 28 <TD ALIGN=LEFT>[ <I>stmt</I> [ <B>';'</B> ] [ <I>stmt_list</I> ] ]</TD>
Daniel@0 29 </TR>
Daniel@0 30 <TR>
Daniel@0 31 <TD ALIGN=RIGHT><I>stmt</I></TD>
Daniel@0 32 <TD ALIGN=LEFT>:</TD>
Daniel@0 33 <TD ALIGN=LEFT><I>node_stmt</I></TD>
Daniel@0 34 </TR>
Daniel@0 35 <TR>
Daniel@0 36 <TD ALIGN=RIGHT></TD>
Daniel@0 37 <TD ALIGN=LEFT>|</TD>
Daniel@0 38 <TD ALIGN=LEFT><I>edge_stmt</I></TD>
Daniel@0 39 </TR>
Daniel@0 40 <TR>
Daniel@0 41 <TD ALIGN=RIGHT></TD>
Daniel@0 42 <TD ALIGN=LEFT>|</TD>
Daniel@0 43 <TD ALIGN=LEFT><I>attr_stmt</I></TD>
Daniel@0 44 </TR>
Daniel@0 45 <TR>
Daniel@0 46 <TD ALIGN=RIGHT></TD>
Daniel@0 47 <TD ALIGN=LEFT>|</TD>
Daniel@0 48 <TD ALIGN=LEFT><I>ID</I> <B>'='</B> <I>ID</I></TD>
Daniel@0 49 </TR>
Daniel@0 50 <TR>
Daniel@0 51 <TD ALIGN=RIGHT></TD>
Daniel@0 52 <TD ALIGN=LEFT>|</TD>
Daniel@0 53 <TD ALIGN=LEFT><I>subgraph</I></TD>
Daniel@0 54 </TR>
Daniel@0 55 <TR>
Daniel@0 56 <TD ALIGN=RIGHT><I>attr_stmt</I></TD>
Daniel@0 57 <TD ALIGN=LEFT>:</TD>
Daniel@0 58 <TD ALIGN=LEFT>(<B>graph</B> | <B>node</B> | <B>edge</B>) <I>attr_list</I></TD>
Daniel@0 59 </TR>
Daniel@0 60 <TR>
Daniel@0 61 <TD ALIGN=RIGHT><I>attr_list</I></TD>
Daniel@0 62 <TD ALIGN=LEFT>:</TD>
Daniel@0 63 <TD ALIGN=LEFT><B>'['</B> [ <I>a_list</I> ] <B>']'</B> [ <I>attr_list</I> ]</TD>
Daniel@0 64 </TR>
Daniel@0 65 <TR>
Daniel@0 66 <TD ALIGN=RIGHT><I>a_list</I></TD>
Daniel@0 67 <TD ALIGN=LEFT>:</TD>
Daniel@0 68 <TD ALIGN=LEFT><I>ID</I> [ <B>'='</B> <I>ID</I> ] [ <B>','</B> ] [ <I>a_list</I> ]</TD>
Daniel@0 69 </TR>
Daniel@0 70 <TR>
Daniel@0 71 <TD ALIGN=RIGHT><I>edge_stmt</I></TD>
Daniel@0 72 <TD ALIGN=LEFT>:</TD>
Daniel@0 73 <TD ALIGN=LEFT>(<I>node_id</I> | <I>subgraph</I>) <I>edgeRHS</I> [ <I>attr_list</I> ]</TD>
Daniel@0 74 </TR>
Daniel@0 75 <TR>
Daniel@0 76 <TD ALIGN=RIGHT><I>edgeRHS</I></TD>
Daniel@0 77 <TD ALIGN=LEFT>:</TD>
Daniel@0 78 <TD ALIGN=LEFT><I>edgeop</I> (<I>node_id</I> | <I>subgraph</I>) [ <I>edgeRHS</I> ]</TD>
Daniel@0 79 </TR>
Daniel@0 80 <TR>
Daniel@0 81 <TD ALIGN=RIGHT><I>node_stmt</I></TD>
Daniel@0 82 <TD ALIGN=LEFT>:</TD>
Daniel@0 83 <TD ALIGN=LEFT><I>node_id</I> [ <I>attr_list</I> ]</TD>
Daniel@0 84 </TR>
Daniel@0 85 <TR>
Daniel@0 86 <TD ALIGN=RIGHT><I>node_id</I></TD>
Daniel@0 87 <TD ALIGN=LEFT>:</TD>
Daniel@0 88 <TD ALIGN=LEFT><I>ID</I> [ <I>port</I> ]</TD>
Daniel@0 89 </TR>
Daniel@0 90 <TR>
Daniel@0 91 <TD ALIGN=RIGHT><I>port</I></TD>
Daniel@0 92 <TD ALIGN=LEFT>:</TD>
Daniel@0 93 <TD ALIGN=LEFT><B>':'</B> <I>ID</I> [ <B>':'</B> <I>compass_pt</I> ]</TD>
Daniel@0 94 </TR>
Daniel@0 95 <TR>
Daniel@0 96 <TD ALIGN=RIGHT></TD>
Daniel@0 97 <TD ALIGN=LEFT>|</TD>
Daniel@0 98 <TD ALIGN=LEFT><B>':'</B> <I>compass_pt</I></TD>
Daniel@0 99 </TR>
Daniel@0 100 <TR>
Daniel@0 101 <TD ALIGN=RIGHT><I>subgraph</I></TD>
Daniel@0 102 <TD ALIGN=LEFT>:</TD>
Daniel@0 103 <TD ALIGN=LEFT>[ <B>subgraph</B> [ <I>ID</I> ] ] <B>'{'</B> <I>stmt_list</I> <B>'}'</B></TD>
Daniel@0 104 </TR>
Daniel@0 105 <TR>
Daniel@0 106 <TD ALIGN=RIGHT><I>compass_pt</I></TD>
Daniel@0 107 <TD ALIGN=LEFT>:</TD>
Daniel@0 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>
Daniel@0 109 </TR>
Daniel@0 110 </TABLE>
Daniel@0 111 <P>
Daniel@0 112 The keywords <B>node</B>, <B>edge</B>, <B>graph</B>, <B>digraph</B>,
Daniel@0 113 <B>subgraph</B>, and <B>strict</B> are case-independent.
Daniel@0 114 Note also that the allowed compass point values are not keywords, so
Daniel@0 115 these strings can be used elsewhere as ordinary identifiers and, conversely,
Daniel@0 116 the parser will actually accept any identifier.
Daniel@0 117 <P>
Daniel@0 118 An <I>ID</I> is one of the following:
Daniel@0 119 <MENU>
Daniel@0 120 <LI> Any string of alphabetic (<TT>[a-zA-Z\200-\377]</TT>) characters, underscores (<TT>'_'</TT>) or
Daniel@0 121 digits (<TT>[0-9]</TT>), not beginning with a digit;
Daniel@0 122 <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> );
Daniel@0 123 <LI> any double-quoted string (&quot;...&quot;) possibly containing escaped
Daniel@0 124 quotes (\&quot;)<SUP>1</SUP>;
Daniel@0 125 <LI> an <A NAME=html>HTML string</A> (&lt;...&gt;).
Daniel@0 126 </MENU>
Daniel@0 127 Note that in HTML strings, angle
Daniel@0 128 brackets must occur in matched pairs, and unescaped newlines are allowed.
Daniel@0 129 In addition, the content must be legal XML, so that the special XML
Daniel@0 130 escape sequences for &quot;, &amp;, &lt;, and &gt; may be necessary
Daniel@0 131 in order to embed these characters in attribute values or raw text.
Daniel@0 132 <P>
Daniel@0 133 Both quoted strings and HTML strings are scanned as a unit, so
Daniel@0 134 any embedded comments will be treated as part of the strings.
Daniel@0 135 <P>
Daniel@0 136 An <I>edgeop</I> is <TT>-></TT> in directed graphs and <TT>--</TT> in
Daniel@0 137 undirected graphs.
Daniel@0 138 <P>
Daniel@0 139 An <I>a_list</I> clause of the form <I>ID</I> is equivalent to
Daniel@0 140 <I>ID</I><TT>=true</TT>.
Daniel@0 141 <P>
Daniel@0 142 The language supports C++-style comments: <TT>/* */</TT> and <TT>//</TT>.
Daniel@0 143 In addition, a line beginning with a '#' character is considered a line
Daniel@0 144 output from a C preprocessor (e.g., # 34 to indicate line 34 ) and discarded.
Daniel@0 145 <P>
Daniel@0 146 Semicolons aid readability but are not required except in the rare case
Daniel@0 147 that a named subgraph with no body immediately preceeds an anonymous
Daniel@0 148 subgraph, since the precedence rules cause this sequence to be parsed as
Daniel@0 149 a subgraph with a heading and a body.
Daniel@0 150 Also, any amount of whitespace may be inserted between terminals.
Daniel@0 151 <P>
Daniel@0 152 As another aid for readability, dot allows single logical lines to
Daniel@0 153 span multiple physical lines using the standard C convention of a
Daniel@0 154 backslash immediately preceding a newline character. In addition,
Daniel@0 155 double-quoted strings can be concatenated using a '+' operator.
Daniel@0 156 As HTML strings can contain newline characters, they do not support the
Daniel@0 157 concatenation operator.
Daniel@0 158 <H2>Semantic Notes</H2>
Daniel@0 159 If a default attribute is
Daniel@0 160 defined using a <B>node</B>, <B>edge</B>, or <B>graph</B> statement,
Daniel@0 161 or by an attribute assignment not attached to a node or edge, any object of the
Daniel@0 162 appropriate type defined afterwards will inherit this attribute value.
Daniel@0 163 This holds until the default attribute is set to a new value, from which
Daniel@0 164 point the new value is used. Objects defined before a default attribute
Daniel@0 165 is set will have an empty string value attached to the attribute once
Daniel@0 166 the default attribute definition is made.
Daniel@0 167 <P>
Daniel@0 168 Note, in particular, that a subgraph receives the attribute settings of
Daniel@0 169 its parent graph at the time of its definition. This can be useful; for
Daniel@0 170 example, one can assign a font to the root graph and all subgraphs will
Daniel@0 171 also use the font. For some attributes, however, this property is
Daniel@0 172 undesirable. If one attaches a label to the root graph, it is probably
Daniel@0 173 not the desired effect to have the label used by all subgraphs. Rather
Daniel@0 174 than listing the graph attribute at the top of the graph, and the
Daniel@0 175 resetting the attribute as needed in the subgraphs, one can simple defer
Daniel@0 176 the attribute definition if the graph until the appropriate subgraphs
Daniel@0 177 have been defined.
Daniel@0 178 <P>
Daniel@0 179 If an edge belongs to a cluster, its endpoints belong to that cluster.
Daniel@0 180 Thus, where you put an edge can effect a layout, as clusters are sometimes
Daniel@0 181 laid out recursively.
Daniel@0 182 <H2>Character encodings</H2>
Daniel@0 183 The DOT language assumes at least the ascii character set.
Daniel@0 184 Quoted strings, both ordinary and HTML-like, may contain non-ascii characters.
Daniel@0 185 In most cases, these strings are uninterpreted: they simply serve as
Daniel@0 186 unique identifiers or values passed through untouched. Labels, however,
Daniel@0 187 are meant to be displayed, which requires that the software be able to
Daniel@0 188 compute the size of the text and determine the appropriate glyphs.
Daniel@0 189 For this, it needs to know what character encoding is used.
Daniel@0 190 <P>
Daniel@0 191 By default, DOT assumes the UTF-8 character encoding. It also accepts
Daniel@0 192 the Latin1 (ISO-8859-1) character set, assuming the input graph uses
Daniel@0 193 the <B><A HREF=attrs.html#a:charset>charset</A></B> attribute to
Daniel@0 194 specify this. For graphs using other
Daniel@0 195 character sets, there are usually programs, such as <TT>iconv</TT>, which
Daniel@0 196 will translate from one character set to another.
Daniel@0 197 <P>
Daniel@0 198 Another way to avoid non-ascii characters in labels is to use HTML entities
Daniel@0 199 for special characters. During label evaluation, these entities are
Daniel@0 200 translated into the underlying character. This
Daniel@0 201 <a HREF="http://www.graphviz.org/doc/char.html">
Daniel@0 202 table</a> shows the supported entities, with their Unicode value, a typical
Daniel@0 203 glyph, and the HTML entity name. Thus, to include a lower-case Greek beta
Daniel@0 204 into a string, one can use the ascii sequence <TT>&amp;beta;</TT>.
Daniel@0 205 In general, one should only use entities that are allowed in the output
Daniel@0 206 character set, and for which there is a glyph in the font.
Daniel@0 207 <HR>
Daniel@0 208 <OL TYPE="1">
Daniel@0 209 <LI> In quoted strings in DOT, the only escaped character is double-quote
Daniel@0 210 ("). That is, in quoted strings, the dyad \" is converted to "; all other
Daniel@0 211 characters are left unchanged. In particular, \\ remains \\. Layout
Daniel@0 212 engines may apply additional escape sequences.
Daniel@0 213 </OL>
Daniel@0 214 </BODY>
Daniel@0 215 </HTML>