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
2
3 Drawings of semigroups
3
4
There are some pictures that may give a lot of information about a
5
semigroup. This is the case of the egg-box picture of the D-classes, the
6
right Cayley graph of a finite monoid and the Schützenberger graphs of a
7
finite inverse monoid.
8
9
10
3.1 Drawing the D-class of an element of a semigroup
11
12
3.1-1 DrawDClassOfElement
13
14
DrawDClassOfElement( arg )  function
15
16
This function uses DotForDrawingDClassOfElement (3.1-2) to compute the dot
17
code to produce the image that is then displayed. It takes as arguments a
18
semigroup followed by a transformation which is the element whose D-class
19
will be drawn. Optionally we can then specify n lists of elements and the
20
elements of each list will be drawn in different colours. Finally, if the
21
last argument is the integer 1 then the elements will appear as
22
transformations, otherwise they will appear as words. The idempotents will
23
be marked with a * before them.
24
25
This last optional argument may also be the integer 2 and in this case the
26
elements will appear as integers, where i represents the element
27
Elements(S)[i].
28
29
 Example 
30
gap> DrawDClassOfElement(poi3, Transformation([1,4,3,4]));
31
gap> DrawDClassOfElement(poi3, Transformation([1,4,3,4]),1);
32
gap> DrawDClassOfElement(poi3, Transformation([1,4,3,4]),
33
 [Transformation( [ 2, 3, 4, 4 ] )],1);
34
gap> DrawDClassOfElement(poi3, Transformation([1,4,3,4]),
35
 [Transformation( [ 2, 3, 4, 4 ] ), Transformation( [ 2, 4, 3, 4 ] )],
36
 [Transformation( [ 2, 4, 3, 4 ] )],1);
37
gap> DrawDClassOfElement(poi3, Transformation([1,4,3,4]), 
38
 [Transformation( [ 2, 4, 3, 4 ] )],"Dclass",1);
39
 
40

41
42
This is the image produced by the first command in the previous example:
43
This is the image produced by the fourth command in the previous example:
44
This is the image produced by the last command in the previous example:
45
46
3.1-2 DotForDrawingDClassOfElement
47
48
DotForDrawingDClassOfElement( arg )  function
49
50
This function computes the dot code that can be used to produce a drawing
51
for the D-class of an element of a semigroup. This can be done by using the
52
function DrawDClassOfElement (3.1-1) (if the system is properly configured)
53
or by the user in some independent way. The arguments and options are the
54
same than those of DrawDClassOfElement (3.1-1).
55
56
 Example 
57
 gap> DotForDrawingDClassOfElement(poi3,Transformation([1,4,3,4]));
58
"digraph DClassOfElement {\ngraph [center=yes,ordering=out];\nnode [shape=pla\
59
intext];\nedge [color=cornflowerblue,arrowhead=none];\n1 [label=<\n<TABLE BORD\
60
ER=\"0\" CELLBORDER=\"0\" CELLPADDING=\"0\" CELLSPACING=\"0\" PORT=\"1\">\n<TR\
61
><TD BORDER=\"0\"><TABLE CELLSPACING=\"0\"><TR><TD BGCOLOR=\"white\" BORDER=\"\
62
0\">*abc</TD></TR>\n</TABLE></TD><TD BORDER=\"0\"><TABLE CELLSPACING=\"0\"><TR\
63
><TD BGCOLOR=\"white\" BORDER=\"0\">a</TD></TR>\n</TABLE></TD><TD BORDER=\"0\"\
64
><TABLE CELLSPACING=\"0\"><TR><TD BGCOLOR=\"white\" BORDER=\"0\">ab</TD></TR>\
65
\n</TABLE></TD></TR>\n<TR><TD BORDER=\"0\"><TABLE CELLSPACING=\"0\"><TR><TD BG\
66
COLOR=\"white\" BORDER=\"0\">bc</TD></TR>\n</TABLE></TD><TD BORDER=\"0\"><TABL\
67
E CELLSPACING=\"0\"><TR><TD BGCOLOR=\"white\" BORDER=\"0\">*bca</TD></TR>\n</T\
68
ABLE></TD><TD BORDER=\"0\"><TABLE CELLSPACING=\"0\"><TR><TD BGCOLOR=\"white\" \
69
BORDER=\"0\">b</TD></TR>\n</TABLE></TD></TR>\n<TR><TD BORDER=\"0\"><TABLE CELL\
70
SPACING=\"0\"><TR><TD BGCOLOR=\"white\" BORDER=\"0\">c</TD></TR>\n</TABLE></TD\
71
><TD BORDER=\"0\"><TABLE CELLSPACING=\"0\"><TR><TD BGCOLOR=\"white\" BORDER=\"\
72
0\">ca</TD></TR>\n</TABLE></TD><TD BORDER=\"0\"><TABLE CELLSPACING=\"0\"><TR><\
73
TD BGCOLOR=\"white\" BORDER=\"0\">*cab</TD></TR>\n</TABLE></TD></TR>\n</TABLE>\
74
>];\n}\n"
75
 
76

77
78
By using Print (or PrinTo, if one wants to print to a file) the string is
79
displayed as follows:
80
81
 Example 
82
gap> Print(last);
83
digraph DClassOfElement {
84
graph [center=yes,ordering=out];
85
node [shape=plaintext];
86
edge [color=cornflowerblue,arrowhead=none];
87
1 [label=<
88
<TABLE BORDER="0" CELLBORDER="0" CELLPADDING="0" CELLSPACING="0" PORT="1">
89
<TR><TD BORDER="0"><TABLE CELLSPACING="0"><TR><TD BGCOLOR="white" BORDER="0">*\
90
abc</TD></TR>
91
</TABLE></TD><TD BORDER="0"><TABLE CELLSPACING="0"><TR><TD BGCOLOR="white" BOR\
92
DER="0">a</TD></TR>
93
</TABLE></TD><TD BORDER="0"><TABLE CELLSPACING="0"><TR><TD BGCOLOR="white" BOR\
94
DER="0">ab</TD></TR>
95
</TABLE></TD></TR>
96
<TR><TD BORDER="0"><TABLE CELLSPACING="0"><TR><TD BGCOLOR="white" BORDER="0">b\
97
c</TD></TR>
98
</TABLE></TD><TD BORDER="0"><TABLE CELLSPACING="0"><TR><TD BGCOLOR="white" BOR\
99
DER="0">*bca</TD></TR>
100
</TABLE></TD><TD BORDER="0"><TABLE CELLSPACING="0"><TR><TD BGCOLOR="white" BOR\
101
DER="0">b</TD></TR>
102
</TABLE></TD></TR>
103
<TR><TD BORDER="0"><TABLE CELLSPACING="0"><TR><TD BGCOLOR="white" BORDER="0">c\
104
</TD></TR>
105
</TABLE></TD><TD BORDER="0"><TABLE CELLSPACING="0"><TR><TD BGCOLOR="white" BOR\
106
DER="0">ca</TD></TR>
107
</TABLE></TD><TD BORDER="0"><TABLE CELLSPACING="0"><TR><TD BGCOLOR="white" BOR\
108
DER="0">*cab</TD></TR>
109
</TABLE></TD></TR>
110
</TABLE>>];
111
}
112

113
114
115
3.2 Drawing the D-classes of a semigroup
116
117
3.2-1 DrawDClasses
118
119
DrawDClasses( arg )  function
120
121
This function is similar to the previous one, except that this one draws all
122
the D-classes of the semigroup given as the first argument. It then takes
123
optionally n lists of elements and the elements of each list will be drawn
124
in different colours. It also accepts, as an optional argument, the integer
125
1, to specify whether the elements will appear as words or as
126
transformations as in the previous function. The idempotents will be marked
127
with a * before them.
128
129
The dot code is computed by DotForDrawingDClasses (3.2-2).
130
131
This last optional argument may also be the integer 2 and in this case the
132
elements will appear as integers, where i represents the element
133
Elements(S)[i].
134
135
 Example 
136
gap> DrawDClasses(poi3);
137
gap> DrawDClasses(poi3, [Transformation( [ 2, 3, 4, 4 ] ),
138
 Transformation( [ 2, 4, 3, 4 ] )],
139
 [Transformation( [ 2, 4, 3, 4 ] )],1);
140
 
141

142
143
This is the image produced by the first command in the previous example:
144
This is the image produced by the second command in the previous example:
145
146
3.2-2 DotForDrawingDClasses
147
148
DotForDrawingDClasses( arg )  function
149
150
This function computes the dot code that can be used to produce a drawing
151
for the D-class of an element of a semigroup. This can be done by using the
152
function DrawDClasses (3.2-1) (if the system is properly configured) or by
153
the user in some independent way. The arguments and options are the same
154
than those of DrawDClasses (3.2-1).
155
156
 Example 
157
gap> Print(DotForDrawingDClasses(poi3));
158
digraph DClasses {
159
graph [center=yes,ordering=out];
160
node [shape=plaintext];
161
edge [color=cornflowerblue,arrowhead=none];
162
## ... many more lines ...
163
</TABLE></TD></TR>
164
</TABLE>>];
165
4:4 -> 3:3;
166
3:3 -> 2:2;
167
2:2 -> 1:1;
168
}
169
 
170

171
172
173
3.3 Cayley graphs
174
175
3.3-1 DrawRightCayleyGraph
176
177
DrawRightCayleyGraph( S )  function
178
179
Draws the right Cayley graph of a finite monoid or semigroup S.
180
181
3.3-2 DrawCayleyGraph
182
183
DrawCayleyGraph( S )  function
184
185
This function is a synonym of DrawRightCayleyGraph (3.3-1).
186
187
For example, the command DrawCayleyGraph(b21); would produce the following
188
image (where state i represents the element Elements(S)[i], the neutral
189
element is coloured in "light blue" and all other idempotents are coloured
190
in "light coral"):
191
192
3.3-3 DotForDrawingRightCayleyGraph
193
194
DotForDrawingRightCayleyGraph( S )  function
195
196
This function computes the dot code that is used by the previous function
197
and can also be used by the reader in some independent way.
198
199
200
3.4 Schützenberger graphs
201
202
3.4-1 DrawSchutzenbergerGraphs
203
204
DrawSchutzenbergerGraphs( S )  function
205
206
Draws the Schützenberger graphs of the inverse semigroup S.
207
208
For example, DrawSchutzenbergerGraphs(poi3); would produce the following:
209
210
211
3.5 Drawings output formats
212
213
By default, when a drawing is requested, it is outputted in pdf format.
214
Since graphviz allows other output formats (see
215
http://www.graphviz.org/doc/info/output.html), it is possible to also
216
request a drawing in a format other than pdf.
217
218
3.5-1 DrawingsListOfExtraFormats
219
220
DrawingsListOfExtraFormats global variable
221
222
This is a global variable which holds the valid output formats for a
223
drawing. It currently has the value: ["dia", "fig", "gd", "gd2", "gif",
224
"hpgl", "jpg", "mif", "mp", "pcl", "pic", "plain", "plain-ext", "png", "ps",
225
"ps2", "svg", "svgz", "vrml", "vtx", "wbmp", "none"] (see
226
http://www.graphviz.org/doc/info/output.html for their description).
227
228
3.5-2 DrawingsExtraFormat
229
230
DrawingsExtraFormat global variable
231
232
This is a global variable which holds the alternative output format for a
233
drawing. By default its value is "none" which indicates that just pdf will
234
be used as the output format.
235
236
If its value becomes one of those in DrawingsListOfExtraFormats (3.5-1),
237
then besides the pdf file, it will also be created a file in the alternative
238
format.
239
240
To change this variable's value, please use SetDrawingsExtraFormat (3.5-3).
241
242
3.5-3 SetDrawingsExtraFormat
243
244
SetDrawingsExtraFormat( f )  function
245
246
This function is used to set the value of DrawingsExtraFormat (3.5-2) to the
247
format f which is one of DrawingsListOfExtraFormats (3.5-1).
248
249
 Example 
250
gap> DrawingsExtraFormat;
251
"none"
252
gap> SetDrawingsExtraFormat("jpg");
253
gap> DrawingsExtraFormat;
254
"jpg"
255

256
gap> DrawRightCayleyGraph(poi3);
257
Displaying file: /tmp/tmp.tpJqvI/cayleygraph.dot.ps
258
The extra output format file: /tmp/tmp.tpJqvI/cayleygraph.dot.jpg
259
has also been created.
260

261

262
263
264
3.6 Drawings extra graph attributes
265
266
The functions described in this subsection are intended to give the user a
267
finer control over the final drawing. They allow to define the graph
268
attributes described in http://graphviz.org/doc/info/attrs.html. (Note that
269
only graph attributes are allowed to be defined, not edge nor node
270
attributes are supported yet.)
271
272
3.6-1 DrawingsExtraGraphAttributes
273
274
DrawingsExtraGraphAttributes global variable
275
276
This is a global variable which holds a list of strings, each of which
277
defines a dot graph attribute. This variable is not intended to be modified
278
by the user directly, but can be used to check which extra attributes are
279
currently defined. To set the attributes, please use
280
SetDrawingsExtraGraphAttributes (3.6-2). If DrawingsExtraGraphAttributes
281
holds the value "none" then the default dot settings will be used. Use
282
ClearDrawingsExtraGraphAttributes (3.6-3) to set it to "none".
283
284
3.6-2 SetDrawingsExtraGraphAttributes
285
286
SetDrawingsExtraGraphAttributes( L )  function
287
288
This is the function to define the drawing's graph attributes (see
289
http://graphviz.org/doc/info/attrs.html for a list and explanation of them).
290
the argument L is a list of strings, each of which defines a dot graph
291
attribute. For example, if we wanted to define the graph size to be 7x9 (in
292
inches), we would call SetDrawingsExtraGraphAttributes(["size=7,9"]);.
293
294
If we also wanted to define the graph to be displayed in landscape mode we
295
would call SetDrawingsExtraGraphAttributes(["size=7,9", "rotate=90"]);. If,
296
in addition we wanted to define the background colour to be, for example,
297
pink, we would call SetDrawingsExtraGraphAttributes(["size=7,9",
298
"rotate=90", "bgcolor=pink"]);.
299
300
After defining the attributes, any command that creates a drawing will use
301
the last defined attributes. To set them back to the defaults, please use
302
ClearDrawingsExtraGraphAttributes (3.6-3).
303
304
 Example 
305
gap> DrawingsExtraGraphAttributes;
306
"none"
307

308

309
gap> SetDrawingsExtraGraphAttributes(["size=7,9"]);
310

311
gap> DrawingsExtraGraphAttributes;
312
[ "size=7,9" ]
313

314

315
gap> SetDrawingsExtraGraphAttributes(["size=7,9", "rotate=90"]);
316

317
gap> DrawingsExtraGraphAttributes;
318
[ "size=7,9", "rotate=90" ]
319

320

321
gap> SetDrawingsExtraGraphAttributes(["size=7,9", "rotate=90", "bgcolor=pink"]);
322

323
gap> DrawingsExtraGraphAttributes;
324
[ "size=7,9", "rotate=90", "bgcolor=pink" ]
325

326

327
gap> ClearDrawingsExtraGraphAttributes();
328

329
gap> DrawingsExtraGraphAttributes;
330
"none"
331

332
333
3.6-3 ClearDrawingsExtraGraphAttributes
334
335
ClearDrawingsExtraGraphAttributes( )  function
336
337
This function sets the graph drawing attributes back to dot's defaults.
338
339
340