CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.

| Download

GAP 4.8.9 installation with standard packages -- copy to your CoCalc project to get it

Views: 418346
1
<?xml version="1.0" encoding="UTF-8"?>
2
<Chapter>
3
<Heading>
4
Drawings of semigroups
5
</Heading>
6
There are some pictures that may give a lot of information about a semigroup.
7
This is the case of the egg-box picture of the D-classes,
8
the right Cayley graph of a finite monoid and the Schützenberger graphs
9
of a finite inverse monoid.
10
11
12
13
<Section>
14
<Heading>
15
Drawing the D-class of an element of a semigroup
16
</Heading>
17
18
<ManSection>
19
<Func Arg="arg" Name="DrawDClassOfElement" />
20
<Description>
21
This function uses <Ref Func="DotForDrawingDClassOfElement" /> to compute the dot code to produce the image that is then displayed. It takes as arguments a semigroup followed by a transformation which is the element whose D-class will be drawn. Optionally we can then specify n lists of elements and the elements of each list will be drawn in different colours. Finally, if the last argument is the integer <C>1</C> then the elements will appear as transformations, otherwise they will appear as words. The idempotents will be marked with a * before them.
22
<P/>
23
This last optional argument may also be the integer <C>2</C> and in this case
24
the elements will appear as integers, where <C>i</C> represents the element <C>Elements(S)[i]</C>.
25
</Description>
26
</ManSection>
27
<Example><![CDATA[
28
gap> DrawDClassOfElement(poi3, Transformation([1,4,3,4]));
29
gap> DrawDClassOfElement(poi3, Transformation([1,4,3,4]),1);
30
gap> DrawDClassOfElement(poi3, Transformation([1,4,3,4]),
31
[Transformation( [ 2, 3, 4, 4 ] )],1);
32
gap> DrawDClassOfElement(poi3, Transformation([1,4,3,4]),
33
[Transformation( [ 2, 3, 4, 4 ] ), Transformation( [ 2, 4, 3, 4 ] )],
34
[Transformation( [ 2, 4, 3, 4 ] )],1);
35
gap> DrawDClassOfElement(poi3, Transformation([1,4,3,4]),
36
[Transformation( [ 2, 4, 3, 4 ] )],"Dclass",1);
37
]]></Example>
38
This is the image produced by the first command in the previous example:
39
<Alt Only="LaTeX">
40
\begin{center}
41
\includegraphics[width=0.35\textwidth]{images/dclass1.png}
42
\end{center}
43
</Alt>
44
<Alt Only="HTML">
45
&#60;br&#62;&#60;center&#62;&#60;img src=&#34;images/dclass1.png&#34;&#62;&#60;/center&#62;&#60;br&#62;
46
</Alt>
47
This is the image produced by the fourth command in the previous example:
48
<Alt Only="LaTeX">
49
\begin{center}
50
\includegraphics[width=0.5\textwidth]{images/dclass2.png}
51
\end{center}
52
</Alt>
53
<Alt Only="HTML">
54
&#60;br&#62;&#60;center&#62;&#60;img src=&#34;images/dclass2.png&#34;&#62;&#60;/center&#62;&#60;br&#62;
55
</Alt>
56
This is the image produced by the last command in the previous example:
57
<Alt Only="LaTeX">
58
\begin{center}
59
\includegraphics[width=0.5\textwidth]{images/dclass3.png}
60
\end{center}
61
</Alt>
62
<Alt Only="HTML">
63
&#60;br&#62;&#60;center&#62;&#60;img src=&#34;images/dclass3.png&#34;&#62;&#60;/center&#62;&#60;br&#62;
64
</Alt>
65
<ManSection>
66
<Func Arg="arg" Name="DotForDrawingDClassOfElement" />
67
<Description>
68
This function computes the dot code that can be used to produce a drawing for the D-class of an element of a semigroup. This can be done by using the function <Ref Func="DrawDClassOfElement" /> (if the system is properly configured) or by the user in some independent way. The arguments and options are the same than those of <Ref Func="DrawDClassOfElement" />.
69
</Description>
70
</ManSection>
71
<Example><![CDATA[
72
gap> DotForDrawingDClassOfElement(poi3,Transformation([1,4,3,4]));
73
"digraph DClassOfElement {\ngraph [center=yes,ordering=out];\nnode [shape=pla\
74
intext];\nedge [color=cornflowerblue,arrowhead=none];\n1 [label=<\n<TABLE BORD\
75
ER=\"0\" CELLBORDER=\"0\" CELLPADDING=\"0\" CELLSPACING=\"0\" PORT=\"1\">\n<TR\
76
><TD BORDER=\"0\"><TABLE CELLSPACING=\"0\"><TR><TD BGCOLOR=\"white\" BORDER=\"\
77
0\">*abc</TD></TR>\n</TABLE></TD><TD BORDER=\"0\"><TABLE CELLSPACING=\"0\"><TR\
78
><TD BGCOLOR=\"white\" BORDER=\"0\">a</TD></TR>\n</TABLE></TD><TD BORDER=\"0\"\
79
><TABLE CELLSPACING=\"0\"><TR><TD BGCOLOR=\"white\" BORDER=\"0\">ab</TD></TR>\
80
\n</TABLE></TD></TR>\n<TR><TD BORDER=\"0\"><TABLE CELLSPACING=\"0\"><TR><TD BG\
81
COLOR=\"white\" BORDER=\"0\">bc</TD></TR>\n</TABLE></TD><TD BORDER=\"0\"><TABL\
82
E CELLSPACING=\"0\"><TR><TD BGCOLOR=\"white\" BORDER=\"0\">*bca</TD></TR>\n</T\
83
ABLE></TD><TD BORDER=\"0\"><TABLE CELLSPACING=\"0\"><TR><TD BGCOLOR=\"white\" \
84
BORDER=\"0\">b</TD></TR>\n</TABLE></TD></TR>\n<TR><TD BORDER=\"0\"><TABLE CELL\
85
SPACING=\"0\"><TR><TD BGCOLOR=\"white\" BORDER=\"0\">c</TD></TR>\n</TABLE></TD\
86
><TD BORDER=\"0\"><TABLE CELLSPACING=\"0\"><TR><TD BGCOLOR=\"white\" BORDER=\"\
87
0\">ca</TD></TR>\n</TABLE></TD><TD BORDER=\"0\"><TABLE CELLSPACING=\"0\"><TR><\
88
TD BGCOLOR=\"white\" BORDER=\"0\">*cab</TD></TR>\n</TABLE></TD></TR>\n</TABLE>\
89
>];\n}\n"
90
]]></Example>
91
By using Print (or PrinTo, if one wants to print to a file) the string is displayed as follows:
92
<Example><![CDATA[
93
gap> Print(last);
94
digraph DClassOfElement {
95
graph [center=yes,ordering=out];
96
node [shape=plaintext];
97
edge [color=cornflowerblue,arrowhead=none];
98
1 [label=<
99
<TABLE BORDER="0" CELLBORDER="0" CELLPADDING="0" CELLSPACING="0" PORT="1">
100
<TR><TD BORDER="0"><TABLE CELLSPACING="0"><TR><TD BGCOLOR="white" BORDER="0">*\
101
abc</TD></TR>
102
</TABLE></TD><TD BORDER="0"><TABLE CELLSPACING="0"><TR><TD BGCOLOR="white" BOR\
103
DER="0">a</TD></TR>
104
</TABLE></TD><TD BORDER="0"><TABLE CELLSPACING="0"><TR><TD BGCOLOR="white" BOR\
105
DER="0">ab</TD></TR>
106
</TABLE></TD></TR>
107
<TR><TD BORDER="0"><TABLE CELLSPACING="0"><TR><TD BGCOLOR="white" BORDER="0">b\
108
c</TD></TR>
109
</TABLE></TD><TD BORDER="0"><TABLE CELLSPACING="0"><TR><TD BGCOLOR="white" BOR\
110
DER="0">*bca</TD></TR>
111
</TABLE></TD><TD BORDER="0"><TABLE CELLSPACING="0"><TR><TD BGCOLOR="white" BOR\
112
DER="0">b</TD></TR>
113
</TABLE></TD></TR>
114
<TR><TD BORDER="0"><TABLE CELLSPACING="0"><TR><TD BGCOLOR="white" BORDER="0">c\
115
</TD></TR>
116
</TABLE></TD><TD BORDER="0"><TABLE CELLSPACING="0"><TR><TD BGCOLOR="white" BOR\
117
DER="0">ca</TD></TR>
118
</TABLE></TD><TD BORDER="0"><TABLE CELLSPACING="0"><TR><TD BGCOLOR="white" BOR\
119
DER="0">*cab</TD></TR>
120
</TABLE></TD></TR>
121
</TABLE>>];
122
}
123
]]></Example>
124
</Section>
125
<Section>
126
<Heading>
127
Drawing the D-classes of a semigroup
128
</Heading>
129
<ManSection>
130
<Func Arg="arg" Name="DrawDClasses" />
131
<Description>
132
This function is similar to the previous one, except that this one draws all the D-classes of the semigroup given as the first argument. It then takes optionally n lists of elements and the elements of each list will be drawn in different colours. It also accepts, as an optional argument, the integer <C>1</C>, to specify whether the elements will appear as words or as transformations as in the previous function. The idempotents will be marked with a * before them.
133
<P/>
134
The dot code is computed by <Ref Func="DotForDrawingDClasses"/>.
135
<P/>
136
This last optional argument may also be the integer <C>2</C> and in this case
137
the elements will appear as integers, where <C>i</C> represents the element <C>Elements(S)[i]</C>.
138
</Description>
139
</ManSection>
140
<Example><![CDATA[
141
gap> DrawDClasses(poi3);
142
gap> DrawDClasses(poi3, [Transformation( [ 2, 3, 4, 4 ] ),
143
Transformation( [ 2, 4, 3, 4 ] )],
144
[Transformation( [ 2, 4, 3, 4 ] )],1);
145
]]></Example>
146
147
This is the image produced by the first command in the previous example:
148
<Alt Only="LaTeX">
149
\begin{center}
150
\includegraphics[width=0.4\textwidth]{images/dclasses1.png}
151
\end{center}
152
</Alt>
153
<Alt Only="HTML">
154
&#60;br&#62;&#60;center&#62;&#60;img src=&#34;images/dclasses1.png&#34;&#62;&#60;/center&#62;&#60;br&#62;
155
</Alt>
156
157
This is the image produced by the second command in the previous example:
158
<Alt Only="LaTeX">
159
\begin{center}
160
\includegraphics[width=0.4\textwidth]{images/dclasses2.png}
161
\end{center}
162
</Alt>
163
<Alt Only="HTML">
164
&#60;br&#62;&#60;center&#62;&#60;img src=&#34;images/dclasses2.png&#34;&#62;&#60;/center&#62;&#60;br&#62;
165
</Alt>
166
<ManSection>
167
<Func Arg="arg" Name="DotForDrawingDClasses" />
168
<Description>
169
This function computes the dot code that can be used to produce a drawing for the D-class of an element of a semigroup. This can be done by using the function <Ref Func="DrawDClasses" /> (if the system is properly configured) or by the user in some independent way. The arguments and options are the same than those of <Ref Func="DrawDClasses" />.
170
</Description>
171
</ManSection>
172
<Example><![CDATA[
173
gap> Print(DotForDrawingDClasses(poi3));
174
digraph DClasses {
175
graph [center=yes,ordering=out];
176
node [shape=plaintext];
177
edge [color=cornflowerblue,arrowhead=none];
178
## ... many more lines ...
179
</TABLE></TD></TR>
180
</TABLE>>];
181
4:4 -> 3:3;
182
3:3 -> 2:2;
183
2:2 -> 1:1;
184
}
185
]]></Example>
186
187
</Section>
188
189
<Section>
190
<Heading>Cayley graphs</Heading>
191
<ManSection>
192
<Func Arg="S" Name="DrawRightCayleyGraph" />
193
<Description>Draws the right Cayley graph of a finite monoid or semigroup <Arg>S</Arg>.
194
</Description>
195
</ManSection>
196
197
<ManSection>
198
<Func Arg="S" Name="DrawCayleyGraph" />
199
<Description>This function is a synonym of
200
<Ref Func="DrawRightCayleyGraph" />.
201
</Description>
202
</ManSection>
203
204
For example, the command <C>DrawCayleyGraph(b21);</C> would produce the following image
205
(where state <C>i</C> represents the element <C>Elements(S)[i]</C>, the neutral element is
206
coloured in "light blue" and all other idempotents are coloured in "light coral"):
207
<Alt Only="LaTeX">
208
\begin{center}
209
\includegraphics[width=0.4\textwidth]{images/cgb21.png}
210
\end{center}
211
</Alt>
212
<Alt Only="HTML">
213
&#60;br&#62;&#60;center&#62;&#60;img src=&#34;images/cgb21.png&#34;&#62;&#60;/center&#62;&#60;br&#62;
214
</Alt>
215
216
<ManSection>
217
<Func Arg="S" Name="DotForDrawingRightCayleyGraph" />
218
<Description>This function computes the dot code that is used by the previous function and can also be used by the reader in some independent way.
219
</Description>
220
</ManSection>
221
222
223
</Section>
224
225
226
<Section>
227
<Heading>Schützenberger graphs</Heading>
228
229
<ManSection>
230
<Func Arg="S" Name="DrawSchutzenbergerGraphs" />
231
<Description>Draws the Schützenberger graphs of the inverse
232
semigroup <Arg>S</Arg>.</Description>
233
</ManSection>
234
For example, <Code>DrawSchutzenbergerGraphs(poi3);</Code> would produce
235
the following:
236
<P />
237
<Alt Only="LaTeX">
238
\begin{center}
239
\includegraphics[width=0.45\textwidth]{images/schutzenberger.png}
240
\end{center}
241
</Alt>
242
243
<Alt Only="HTML">
244
&#60;br&#62;&#60;center&#62;&#60;img src=&#34;images/schutzenberger.png&#34;&#62;&#60;/center&#62;&#60;br&#62;
245
</Alt>
246
247
248
</Section>
249
250
251
<Section Label="Drawings_output_formats">
252
<Heading>Drawings output formats</Heading>
253
254
By default, when a drawing is requested, it is outputted in pdf format.
255
Since <C>graphviz</C> allows other output formats (see <URL>http://www.graphviz.org/doc/info/output.html</URL>), it is possible to also request a drawing in a format other than pdf.
256
257
<ManSection>
258
<Var Name="DrawingsListOfExtraFormats" />
259
<Description>
260
This is a global variable which holds the valid output formats for a drawing. It currently has the value: <C>["dia", "fig", "gd", "gd2", "gif", "hpgl", "jpg", "mif", "mp", "pcl", "pic", "plain", "plain-ext", "png", "ps", "ps2", "svg", "svgz", "vrml", "vtx", "wbmp", "none"]</C> (see <URL>http://www.graphviz.org/doc/info/output.html</URL> for their description).
261
</Description>
262
</ManSection>
263
264
265
<ManSection>
266
<Var Name="DrawingsExtraFormat" />
267
<Description>
268
This is a global variable which holds the alternative output format for a drawing.
269
By default its value is <C>"none"</C> which indicates that just pdf will be used
270
as the output format.
271
<P/>
272
If its value becomes one of those in <Ref Var="DrawingsListOfExtraFormats" />, then
273
besides the pdf file, it will also be created a file in the alternative format.
274
<P/>
275
To change this variable's value, please use <Ref Func="SetDrawingsExtraFormat" />.
276
</Description>
277
</ManSection>
278
279
280
<ManSection>
281
<Func Arg="f" Name="SetDrawingsExtraFormat" />
282
<Description>
283
This function is used to set the value of <Ref Var="DrawingsExtraFormat" /> to the
284
format <A>f</A> which is one of <Ref Var="DrawingsListOfExtraFormats" />.
285
<Example><![CDATA[
286
gap> DrawingsExtraFormat;
287
"none"
288
gap> SetDrawingsExtraFormat("jpg");
289
gap> DrawingsExtraFormat;
290
"jpg"
291
292
gap> DrawRightCayleyGraph(poi3);
293
Displaying file: /tmp/tmp.tpJqvI/cayleygraph.dot.ps
294
The extra output format file: /tmp/tmp.tpJqvI/cayleygraph.dot.jpg
295
has also been created.
296
297
]]></Example>
298
</Description>
299
300
</ManSection>
301
</Section>
302
303
304
<Section Label="Drawings_extra_graph_attributes">
305
<Heading>Drawings extra graph attributes</Heading>
306
The functions described in this subsection are intended to give the user a finer control
307
over the final drawing.
308
They allow to define the graph attributes described in <URL>http://graphviz.org/doc/info/attrs.html</URL>.
309
(Note that only graph attributes are allowed to be defined, not edge nor node attributes are supported yet.)
310
311
<ManSection>
312
<Var Name="DrawingsExtraGraphAttributes" />
313
<Description>
314
This is a global variable which holds a list of strings, each of which defines a <E>dot</E> graph attribute.
315
This variable is <E>not</E> intended to be modified by the user directly, but can be used to check
316
which extra attributes are currently defined.
317
To set the attributes, please use <Ref Func="SetDrawingsExtraGraphAttributes" />.
318
If <C>DrawingsExtraGraphAttributes</C> holds the value <C>"none"</C> then the default <E>dot</E> settings will be used.
319
Use <Ref Func="ClearDrawingsExtraGraphAttributes" /> to set it to <C>"none"</C>.
320
</Description>
321
</ManSection>
322
323
324
<ManSection>
325
<Func Arg="L" Name="SetDrawingsExtraGraphAttributes" />
326
<Description>
327
This is the function to define the drawing's graph attributes (see <URL>http://graphviz.org/doc/info/attrs.html</URL>
328
for a list and explanation of them).
329
the argument <A>L</A> is a list of strings, each of which defines a <E>dot</E> graph attribute.
330
For example, if we wanted to define the graph size to be 7x9 (in inches), we would call
331
<C>SetDrawingsExtraGraphAttributes(["size=7,9"]);</C>.
332
<P />
333
If we also wanted to define the graph to be displayed in landscape mode we would call
334
<C>SetDrawingsExtraGraphAttributes(["size=7,9", "rotate=90"]);</C>.
335
If, in addition we wanted to define the background colour to be, for example, pink, we would call
336
<C>SetDrawingsExtraGraphAttributes(["size=7,9", "rotate=90", "bgcolor=pink"]);</C>.
337
<P />
338
After defining the attributes, any command that creates a drawing will use the last defined attributes.
339
To set them back to the defaults, please use <Ref Func="ClearDrawingsExtraGraphAttributes" />.
340
<Example><![CDATA[
341
gap> DrawingsExtraGraphAttributes;
342
"none"
343
344
345
gap> SetDrawingsExtraGraphAttributes(["size=7,9"]);
346
347
gap> DrawingsExtraGraphAttributes;
348
[ "size=7,9" ]
349
350
351
gap> SetDrawingsExtraGraphAttributes(["size=7,9", "rotate=90"]);
352
353
gap> DrawingsExtraGraphAttributes;
354
[ "size=7,9", "rotate=90" ]
355
356
357
gap> SetDrawingsExtraGraphAttributes(["size=7,9", "rotate=90", "bgcolor=pink"]);
358
359
gap> DrawingsExtraGraphAttributes;
360
[ "size=7,9", "rotate=90", "bgcolor=pink" ]
361
362
363
gap> ClearDrawingsExtraGraphAttributes();
364
365
gap> DrawingsExtraGraphAttributes;
366
"none"
367
]]></Example>
368
</Description>
369
</ManSection>
370
371
<ManSection>
372
<Func Arg="" Name="ClearDrawingsExtraGraphAttributes" />
373
<Description>
374
This function sets the graph drawing attributes back to <E>dot</E>'s defaults.
375
</Description>
376
</ManSection>
377
378
379
</Section>
380
381
382
</Chapter>
383
384