<?xml version="1.0" encoding="ISO-8859-1"?>
  <!-- $Id: drawings.xml,v 0.997  Exp $ -->
  <Chapter>
    <Heading>
      Drawings of semigroups
    </Heading>
There are some pictures that may give a lot of information about a semigroup.
This is the case of the egg-box picture of the D-classes,
the right Cayley graph of a finite monoid and the Schutzenberger graphs
of a finite inverse monoid.



    <Section>
      <Heading>
        Drawing the D-class of an element of a semigroup
      </Heading>
      <ManSection>
        <Func Arg="arg" Name="DrawDClassOfElement" />
        <Description>
          This function 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, we may specify a string name the file that will be used to write the drawing of the class (in PostScript format) and 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.
<P/>
This last optional argument may also be the integer <C>2</C> and in this case
the elements will appear as integers, where <C>i</C> represents the element <C>Elements(S)[i]</C>.
        </Description>
      </ManSection>
      <Example>
gap&#62; DrawDClassOfElement(poi3, Transformation([1,4,3,4]));
gap&#62; DrawDClassOfElement(poi3, Transformation([1,4,3,4]),1);
gap&#62; DrawDClassOfElement(poi3, Transformation([1,4,3,4]),
 [Transformation( [ 2, 3, 4, 4 ] )],1);
gap&#62; DrawDClassOfElement(poi3, Transformation([1,4,3,4]),
 [Transformation( [ 2, 3, 4, 4 ] ), Transformation( [ 2, 4, 3, 4 ] )],
 [Transformation( [ 2, 4, 3, 4 ] )],1);
gap&#62; DrawDClassOfElement(poi3, Transformation([1,4,3,4]), 
 [Transformation( [ 2, 4, 3, 4 ] )],"Dclass",1);
      </Example>

<Alt Only="HTML">
This is the image produced by the first command in the previous example:
      &#60;br&#62;&#60;br&#62;&#60;center&#62;&#60;img src=&#34;images/dclass1.png&#34;&#62;&#60;/center&#62;&#60;br&#62;
&#60;br&#62;&#60;br&#62;

This is the image produced by the fourth command in the previous example:
      &#60;br&#62;&#60;br&#62;&#60;center&#62;&#60;img src=&#34;images/dclass2.png&#34;&#62;&#60;/center&#62;&#60;br&#62;
&#60;br&#62;&#60;br&#62;

This is the image produced by the last command in the previous example:
      &#60;br&#62;&#60;br&#62;&#60;center&#62;&#60;img src=&#34;images/dclass3.png&#34;&#62;&#60;/center&#62;&#60;br&#62;
&#60;br&#62;&#60;br&#62;
    </Alt>


    </Section>
    <Section>
      <Heading>
        Drawing the D-classes of a semigroup
      </Heading>
      <ManSection>
        <Func Arg="arg" Name="DrawDClasses" />
        <Description>
          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 a string specifying the name of the file in which the drawing will be written and the last, 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.
<P/>
This last optional argument may also be the integer <C>2</C> and in this case
the elements will appear as integers, where <C>i</C> represents the element <C>Elements(S)[i]</C>.
        </Description>
      </ManSection>
      <Example>
gap&#62; DrawDClasses(poi3,"DClasses");
gap&#62; DrawDClasses(poi3, [Transformation( [ 2, 3, 4, 4 ] ),
  Transformation( [ 2, 4, 3, 4 ] )],
  [Transformation( [ 2, 4, 3, 4 ] )],1);
      </Example>

<Alt Only="HTML">
This is the image produced by the first command in the previous example:
      &#60;br&#62;&#60;br&#62;&#60;center&#62;&#60;img src=&#34;images/dclasses1.png&#34;&#62;&#60;/center&#62;&#60;br&#62;
&#60;br&#62;&#60;br&#62;

This is the image produced by the second command in the previous example:
      &#60;br&#62;&#60;br&#62;&#60;center&#62;&#60;img src=&#34;images/dclasses2.png&#34;&#62;&#60;/center&#62;&#60;br&#62;
&#60;br&#62;&#60;br&#62;
    </Alt>

    </Section>

    <Section>
     <Heading>Cayley graphs</Heading>
      <ManSection>
        <Func Arg="S" Name="DrawRightCayleyGraph" />
        <Description>Draws the right Cayley graph of a finite monoid or semigroup <Arg>S</Arg>.
          </Description>
      </ManSection>

      <ManSection>
        <Func Arg="S" Name="DrawCayleyGraph" />
        <Description>This function is a synonym of 
<Ref Func="DrawRightCayleyGraph" />.
          </Description>
      </ManSection>

For example, the command <C>DrawCayleyGraph(b21);</C> would produce the following image
(where state <C>i</C> represents the element <C>Elements(S)[i]</C>, the neutral element is
colored in "light blue" and all other idempotents are colored in "light coral"):
<Alt Only="HTML">
      &#60;br&#62;&#60;br&#62;&#60;center&#62;&#60;img src=&#34;images/cgb21.png&#34;&#62;&#60;/center&#62;&#60;br&#62;
    </Alt>

    </Section>


    <Section>
       <Heading>Schutzenberger graphs</Heading>

       <ManSection>
        <Func Arg="S" Name="DrawSchutzenbergerGraphs" />
        <Description>Draws the Schutzenberger graphs of the inverse
semigroup <Arg>S</Arg>.</Description>
      </ManSection>
For example, <Code>DrawSchutzenbergerGraphs(poi3);</Code> would produce
the following:
<P />

    <Alt Only="HTML">
      &#60;br&#62;&#60;center&#62;&#60;img src=&#34;images/schutzenberger.gif&#34;&#62;&#60;/center&#62;&#60;br&#62;
    </Alt>


    </Section>


    <Section>
       <Heading>Drawings output formats</Heading>

       By default, when a drawing is requested, it is outputted in PostScript format.
       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 PostScript.
       
       <ManSection>
        <Var Name="DrawingsListOfExtraFormats" />
	<Description>
	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).
	</Description>
      </ManSection>


      <ManSection>
        <Var Name="DrawingsExtraFormat" />
	<Description>
	This is a global variable which holds the alternative output format for a drawing.
	By default its value is <C>"none"</C> which indicates that just PostScript will be used
	as the output format.
	<P/>
	If its value becomes one of those in <Ref Var="DrawingsListOfExtraFormats" />, then
	besides the PostScript file, it will also be created a file in the alternative format.
	<P/>
	To change this variable's value, please use <Ref Func="SetDrawingsExtraFormat" />.
	</Description>
      </ManSection>


      <ManSection>
        <Func Arg="f" Name="SetDrawingsExtraFormat" />
	<Description>
	This function is used to set the value of <Ref Var="DrawingsExtraFormat" /> to the
format <A>f</A> which is one of <Ref Var="DrawingsListOfExtraFormats" />.
<Example><![CDATA[
gap> DrawingsExtraFormat;
"none"
gap> SetDrawingsExtraFormat("jpg");
gap> DrawingsExtraFormat;
"jpg"

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

]]></Example>
	</Description>
	
      </ManSection>


    </Section>


  </Chapter>
