Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
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
Project: cocalc-sagemath-dev-slelievre
Views: 418346<?xml version="1.0" encoding="UTF-8"?>1<Chapter>2<Heading>3Drawings of semigroups4</Heading>5There are some pictures that may give a lot of information about a semigroup.6This is the case of the egg-box picture of the D-classes,7the right Cayley graph of a finite monoid and the Schützenberger graphs8of a finite inverse monoid.9101112<Section>13<Heading>14Drawing the D-class of an element of a semigroup15</Heading>1617<ManSection>18<Func Arg="arg" Name="DrawDClassOfElement" />19<Description>20This 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.21<P/>22This last optional argument may also be the integer <C>2</C> and in this case23the elements will appear as integers, where <C>i</C> represents the element <C>Elements(S)[i]</C>.24</Description>25</ManSection>26<Example><![CDATA[27gap> DrawDClassOfElement(poi3, Transformation([1,4,3,4]));28gap> DrawDClassOfElement(poi3, Transformation([1,4,3,4]),1);29gap> DrawDClassOfElement(poi3, Transformation([1,4,3,4]),30[Transformation( [ 2, 3, 4, 4 ] )],1);31gap> DrawDClassOfElement(poi3, Transformation([1,4,3,4]),32[Transformation( [ 2, 3, 4, 4 ] ), Transformation( [ 2, 4, 3, 4 ] )],33[Transformation( [ 2, 4, 3, 4 ] )],1);34gap> DrawDClassOfElement(poi3, Transformation([1,4,3,4]),35[Transformation( [ 2, 4, 3, 4 ] )],"Dclass",1);36]]></Example>37This is the image produced by the first command in the previous example:38<Alt Only="LaTeX">39\begin{center}40\includegraphics[width=0.35\textwidth]{images/dclass1.png}41\end{center}42</Alt>43<Alt Only="HTML">44<br><center><img src="images/dclass1.png"></center><br>45</Alt>46This is the image produced by the fourth command in the previous example:47<Alt Only="LaTeX">48\begin{center}49\includegraphics[width=0.5\textwidth]{images/dclass2.png}50\end{center}51</Alt>52<Alt Only="HTML">53<br><center><img src="images/dclass2.png"></center><br>54</Alt>55This is the image produced by the last command in the previous example:56<Alt Only="LaTeX">57\begin{center}58\includegraphics[width=0.5\textwidth]{images/dclass3.png}59\end{center}60</Alt>61<Alt Only="HTML">62<br><center><img src="images/dclass3.png"></center><br>63</Alt>64<ManSection>65<Func Arg="arg" Name="DotForDrawingDClassOfElement" />66<Description>67This 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" />.68</Description>69</ManSection>70<Example><![CDATA[71gap> DotForDrawingDClassOfElement(poi3,Transformation([1,4,3,4]));72"digraph DClassOfElement {\ngraph [center=yes,ordering=out];\nnode [shape=pla\73intext];\nedge [color=cornflowerblue,arrowhead=none];\n1 [label=<\n<TABLE BORD\74ER=\"0\" CELLBORDER=\"0\" CELLPADDING=\"0\" CELLSPACING=\"0\" PORT=\"1\">\n<TR\75><TD BORDER=\"0\"><TABLE CELLSPACING=\"0\"><TR><TD BGCOLOR=\"white\" BORDER=\"\760\">*abc</TD></TR>\n</TABLE></TD><TD BORDER=\"0\"><TABLE CELLSPACING=\"0\"><TR\77><TD BGCOLOR=\"white\" BORDER=\"0\">a</TD></TR>\n</TABLE></TD><TD BORDER=\"0\"\78><TABLE CELLSPACING=\"0\"><TR><TD BGCOLOR=\"white\" BORDER=\"0\">ab</TD></TR>\79\n</TABLE></TD></TR>\n<TR><TD BORDER=\"0\"><TABLE CELLSPACING=\"0\"><TR><TD BG\80COLOR=\"white\" BORDER=\"0\">bc</TD></TR>\n</TABLE></TD><TD BORDER=\"0\"><TABL\81E CELLSPACING=\"0\"><TR><TD BGCOLOR=\"white\" BORDER=\"0\">*bca</TD></TR>\n</T\82ABLE></TD><TD BORDER=\"0\"><TABLE CELLSPACING=\"0\"><TR><TD BGCOLOR=\"white\" \83BORDER=\"0\">b</TD></TR>\n</TABLE></TD></TR>\n<TR><TD BORDER=\"0\"><TABLE CELL\84SPACING=\"0\"><TR><TD BGCOLOR=\"white\" BORDER=\"0\">c</TD></TR>\n</TABLE></TD\85><TD BORDER=\"0\"><TABLE CELLSPACING=\"0\"><TR><TD BGCOLOR=\"white\" BORDER=\"\860\">ca</TD></TR>\n</TABLE></TD><TD BORDER=\"0\"><TABLE CELLSPACING=\"0\"><TR><\87TD BGCOLOR=\"white\" BORDER=\"0\">*cab</TD></TR>\n</TABLE></TD></TR>\n</TABLE>\88>];\n}\n"89]]></Example>90By using Print (or PrinTo, if one wants to print to a file) the string is displayed as follows:91<Example><![CDATA[92gap> Print(last);93digraph DClassOfElement {94graph [center=yes,ordering=out];95node [shape=plaintext];96edge [color=cornflowerblue,arrowhead=none];971 [label=<98<TABLE BORDER="0" CELLBORDER="0" CELLPADDING="0" CELLSPACING="0" PORT="1">99<TR><TD BORDER="0"><TABLE CELLSPACING="0"><TR><TD BGCOLOR="white" BORDER="0">*\100abc</TD></TR>101</TABLE></TD><TD BORDER="0"><TABLE CELLSPACING="0"><TR><TD BGCOLOR="white" BOR\102DER="0">a</TD></TR>103</TABLE></TD><TD BORDER="0"><TABLE CELLSPACING="0"><TR><TD BGCOLOR="white" BOR\104DER="0">ab</TD></TR>105</TABLE></TD></TR>106<TR><TD BORDER="0"><TABLE CELLSPACING="0"><TR><TD BGCOLOR="white" BORDER="0">b\107c</TD></TR>108</TABLE></TD><TD BORDER="0"><TABLE CELLSPACING="0"><TR><TD BGCOLOR="white" BOR\109DER="0">*bca</TD></TR>110</TABLE></TD><TD BORDER="0"><TABLE CELLSPACING="0"><TR><TD BGCOLOR="white" BOR\111DER="0">b</TD></TR>112</TABLE></TD></TR>113<TR><TD BORDER="0"><TABLE CELLSPACING="0"><TR><TD BGCOLOR="white" BORDER="0">c\114</TD></TR>115</TABLE></TD><TD BORDER="0"><TABLE CELLSPACING="0"><TR><TD BGCOLOR="white" BOR\116DER="0">ca</TD></TR>117</TABLE></TD><TD BORDER="0"><TABLE CELLSPACING="0"><TR><TD BGCOLOR="white" BOR\118DER="0">*cab</TD></TR>119</TABLE></TD></TR>120</TABLE>>];121}122]]></Example>123</Section>124<Section>125<Heading>126Drawing the D-classes of a semigroup127</Heading>128<ManSection>129<Func Arg="arg" Name="DrawDClasses" />130<Description>131This 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.132<P/>133The dot code is computed by <Ref Func="DotForDrawingDClasses"/>.134<P/>135This last optional argument may also be the integer <C>2</C> and in this case136the elements will appear as integers, where <C>i</C> represents the element <C>Elements(S)[i]</C>.137</Description>138</ManSection>139<Example><![CDATA[140gap> DrawDClasses(poi3);141gap> DrawDClasses(poi3, [Transformation( [ 2, 3, 4, 4 ] ),142Transformation( [ 2, 4, 3, 4 ] )],143[Transformation( [ 2, 4, 3, 4 ] )],1);144]]></Example>145146This is the image produced by the first command in the previous example:147<Alt Only="LaTeX">148\begin{center}149\includegraphics[width=0.4\textwidth]{images/dclasses1.png}150\end{center}151</Alt>152<Alt Only="HTML">153<br><center><img src="images/dclasses1.png"></center><br>154</Alt>155156This is the image produced by the second command in the previous example:157<Alt Only="LaTeX">158\begin{center}159\includegraphics[width=0.4\textwidth]{images/dclasses2.png}160\end{center}161</Alt>162<Alt Only="HTML">163<br><center><img src="images/dclasses2.png"></center><br>164</Alt>165<ManSection>166<Func Arg="arg" Name="DotForDrawingDClasses" />167<Description>168This 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" />.169</Description>170</ManSection>171<Example><![CDATA[172gap> Print(DotForDrawingDClasses(poi3));173digraph DClasses {174graph [center=yes,ordering=out];175node [shape=plaintext];176edge [color=cornflowerblue,arrowhead=none];177## ... many more lines ...178</TABLE></TD></TR>179</TABLE>>];1804:4 -> 3:3;1813:3 -> 2:2;1822:2 -> 1:1;183}184]]></Example>185186</Section>187188<Section>189<Heading>Cayley graphs</Heading>190<ManSection>191<Func Arg="S" Name="DrawRightCayleyGraph" />192<Description>Draws the right Cayley graph of a finite monoid or semigroup <Arg>S</Arg>.193</Description>194</ManSection>195196<ManSection>197<Func Arg="S" Name="DrawCayleyGraph" />198<Description>This function is a synonym of199<Ref Func="DrawRightCayleyGraph" />.200</Description>201</ManSection>202203For example, the command <C>DrawCayleyGraph(b21);</C> would produce the following image204(where state <C>i</C> represents the element <C>Elements(S)[i]</C>, the neutral element is205coloured in "light blue" and all other idempotents are coloured in "light coral"):206<Alt Only="LaTeX">207\begin{center}208\includegraphics[width=0.4\textwidth]{images/cgb21.png}209\end{center}210</Alt>211<Alt Only="HTML">212<br><center><img src="images/cgb21.png"></center><br>213</Alt>214215<ManSection>216<Func Arg="S" Name="DotForDrawingRightCayleyGraph" />217<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.218</Description>219</ManSection>220221222</Section>223224225<Section>226<Heading>Schützenberger graphs</Heading>227228<ManSection>229<Func Arg="S" Name="DrawSchutzenbergerGraphs" />230<Description>Draws the Schützenberger graphs of the inverse231semigroup <Arg>S</Arg>.</Description>232</ManSection>233For example, <Code>DrawSchutzenbergerGraphs(poi3);</Code> would produce234the following:235<P />236<Alt Only="LaTeX">237\begin{center}238\includegraphics[width=0.45\textwidth]{images/schutzenberger.png}239\end{center}240</Alt>241242<Alt Only="HTML">243<br><center><img src="images/schutzenberger.png"></center><br>244</Alt>245246247</Section>248249250<Section Label="Drawings_output_formats">251<Heading>Drawings output formats</Heading>252253By default, when a drawing is requested, it is outputted in pdf format.254Since <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.255256<ManSection>257<Var Name="DrawingsListOfExtraFormats" />258<Description>259This 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).260</Description>261</ManSection>262263264<ManSection>265<Var Name="DrawingsExtraFormat" />266<Description>267This is a global variable which holds the alternative output format for a drawing.268By default its value is <C>"none"</C> which indicates that just pdf will be used269as the output format.270<P/>271If its value becomes one of those in <Ref Var="DrawingsListOfExtraFormats" />, then272besides the pdf file, it will also be created a file in the alternative format.273<P/>274To change this variable's value, please use <Ref Func="SetDrawingsExtraFormat" />.275</Description>276</ManSection>277278279<ManSection>280<Func Arg="f" Name="SetDrawingsExtraFormat" />281<Description>282This function is used to set the value of <Ref Var="DrawingsExtraFormat" /> to the283format <A>f</A> which is one of <Ref Var="DrawingsListOfExtraFormats" />.284<Example><![CDATA[285gap> DrawingsExtraFormat;286"none"287gap> SetDrawingsExtraFormat("jpg");288gap> DrawingsExtraFormat;289"jpg"290291gap> DrawRightCayleyGraph(poi3);292Displaying file: /tmp/tmp.tpJqvI/cayleygraph.dot.ps293The extra output format file: /tmp/tmp.tpJqvI/cayleygraph.dot.jpg294has also been created.295296]]></Example>297</Description>298299</ManSection>300</Section>301302303<Section Label="Drawings_extra_graph_attributes">304<Heading>Drawings extra graph attributes</Heading>305The functions described in this subsection are intended to give the user a finer control306over the final drawing.307They allow to define the graph attributes described in <URL>http://graphviz.org/doc/info/attrs.html</URL>.308(Note that only graph attributes are allowed to be defined, not edge nor node attributes are supported yet.)309310<ManSection>311<Var Name="DrawingsExtraGraphAttributes" />312<Description>313This is a global variable which holds a list of strings, each of which defines a <E>dot</E> graph attribute.314This variable is <E>not</E> intended to be modified by the user directly, but can be used to check315which extra attributes are currently defined.316To set the attributes, please use <Ref Func="SetDrawingsExtraGraphAttributes" />.317If <C>DrawingsExtraGraphAttributes</C> holds the value <C>"none"</C> then the default <E>dot</E> settings will be used.318Use <Ref Func="ClearDrawingsExtraGraphAttributes" /> to set it to <C>"none"</C>.319</Description>320</ManSection>321322323<ManSection>324<Func Arg="L" Name="SetDrawingsExtraGraphAttributes" />325<Description>326This is the function to define the drawing's graph attributes (see <URL>http://graphviz.org/doc/info/attrs.html</URL>327for a list and explanation of them).328the argument <A>L</A> is a list of strings, each of which defines a <E>dot</E> graph attribute.329For example, if we wanted to define the graph size to be 7x9 (in inches), we would call330<C>SetDrawingsExtraGraphAttributes(["size=7,9"]);</C>.331<P />332If we also wanted to define the graph to be displayed in landscape mode we would call333<C>SetDrawingsExtraGraphAttributes(["size=7,9", "rotate=90"]);</C>.334If, in addition we wanted to define the background colour to be, for example, pink, we would call335<C>SetDrawingsExtraGraphAttributes(["size=7,9", "rotate=90", "bgcolor=pink"]);</C>.336<P />337After defining the attributes, any command that creates a drawing will use the last defined attributes.338To set them back to the defaults, please use <Ref Func="ClearDrawingsExtraGraphAttributes" />.339<Example><![CDATA[340gap> DrawingsExtraGraphAttributes;341"none"342343344gap> SetDrawingsExtraGraphAttributes(["size=7,9"]);345346gap> DrawingsExtraGraphAttributes;347[ "size=7,9" ]348349350gap> SetDrawingsExtraGraphAttributes(["size=7,9", "rotate=90"]);351352gap> DrawingsExtraGraphAttributes;353[ "size=7,9", "rotate=90" ]354355356gap> SetDrawingsExtraGraphAttributes(["size=7,9", "rotate=90", "bgcolor=pink"]);357358gap> DrawingsExtraGraphAttributes;359[ "size=7,9", "rotate=90", "bgcolor=pink" ]360361362gap> ClearDrawingsExtraGraphAttributes();363364gap> DrawingsExtraGraphAttributes;365"none"366]]></Example>367</Description>368</ManSection>369370<ManSection>371<Func Arg="" Name="ClearDrawingsExtraGraphAttributes" />372<Description>373This function sets the graph drawing attributes back to <E>dot</E>'s defaults.374</Description>375</ManSection>376377378</Section>379380381</Chapter>382383384