Goto Chapter: Top 1 2 3 4 Bib Ind
 Top of Book   Previous Chapter   Next Chapter 

3 Drawings of semigroups
 3.1 Drawing the D-class of an element of a semigroup
  3.1-1 DrawDClassOfElement
 3.2 Drawing the D-classes of a semigroup
  3.2-1 DrawDClasses
 3.3 Cayley graphs
  3.3-1 DrawRightCayleyGraph

  3.3-2 DrawCayleyGraph
 3.4 Schutzenberger graphs
  3.4-1 DrawSchutzenbergerGraphs
 3.5 Drawings output formats
  3.5-1 DrawingsListOfExtraFormats

  3.5-2 DrawingsExtraFormat

  3.5-3 SetDrawingsExtraFormat
 3.6 Drawings extra graph attributes
  3.6-1 DrawingsExtraGraphAttributes

  3.6-2 SetDrawingsExtraGraphAttributes

  3.6-3 ClearDrawingsExtraGraphAttributes

3 Drawings of semigroups

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.

3.1 Drawing the D-class of an element of a semigroup

3.1-1 DrawDClassOfElement
> DrawDClassOfElement( arg )( function )

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 1 then the elements will appear as transformations, otherwise they will appear as words. The idempotents will be marked with a * before them.

This last optional argument may also be the integer 2 and in this case the elements will appear as integers, where i represents the element Elements(S)[i].

gap> DrawDClassOfElement(poi3, Transformation([1,4,3,4]));
gap> DrawDClassOfElement(poi3, Transformation([1,4,3,4]),1);
gap> DrawDClassOfElement(poi3, Transformation([1,4,3,4]),
 [Transformation( [ 2, 3, 4, 4 ] )],1);
gap> DrawDClassOfElement(poi3, Transformation([1,4,3,4]),
 [Transformation( [ 2, 3, 4, 4 ] ), Transformation( [ 2, 4, 3, 4 ] )],
 [Transformation( [ 2, 4, 3, 4 ] )],1);
gap> DrawDClassOfElement(poi3, Transformation([1,4,3,4]), 
 [Transformation( [ 2, 4, 3, 4 ] )],"Dclass",1);
      

This is the image produced by the first command in the previous example:




This is the image produced by the fourth command in the previous example:




This is the image produced by the last command in the previous example:




3.2 Drawing the D-classes of a semigroup

3.2-1 DrawDClasses
> DrawDClasses( arg )( function )

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 1, 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.

This last optional argument may also be the integer 2 and in this case the elements will appear as integers, where i represents the element Elements(S)[i].

gap> DrawDClasses(poi3,"DClasses");
gap> DrawDClasses(poi3, [Transformation( [ 2, 3, 4, 4 ] ),
  Transformation( [ 2, 4, 3, 4 ] )],
  [Transformation( [ 2, 4, 3, 4 ] )],1);
      

This is the image produced by the first command in the previous example:




This is the image produced by the second command in the previous example:




3.3 Cayley graphs

3.3-1 DrawRightCayleyGraph
> DrawRightCayleyGraph( S )( function )

Draws the right Cayley graph of a finite monoid or semigroup S.

3.3-2 DrawCayleyGraph
> DrawCayleyGraph( S )( function )

This function is a synonym of DrawRightCayleyGraph (3.3-1).

For example, the command DrawCayleyGraph(b21); would produce the following image (where state i represents the element Elements(S)[i], the neutral element is colored in "light blue" and all other idempotents are colored in "light coral"):


3.4 Schutzenberger graphs

3.4-1 DrawSchutzenbergerGraphs
> DrawSchutzenbergerGraphs( S )( function )

Draws the Schutzenberger graphs of the inverse semigroup S.

For example, DrawSchutzenbergerGraphs(poi3); would produce the following:



3.5 Drawings output formats

By default, when a drawing is requested, it is outputted in PostScript format. Since graphviz allows other output formats (see http://www.graphviz.org/doc/info/output.html), it is possible to also request a drawing in a format other than PostScript.

3.5-1 DrawingsListOfExtraFormats
> DrawingsListOfExtraFormats( global variable )

This is a global variable which holds the valid output formats for a drawing. It currently has the value: ["dia", "fig", "gd", "gd2", "gif", "hpgl", "jpg", "mif", "mp", "pcl", "pic", "plain", "plain-ext", "png", "ps", "ps2", "svg", "svgz", "vrml", "vtx", "wbmp", "none"] (see http://www.graphviz.org/doc/info/output.html for their description).

3.5-2 DrawingsExtraFormat
> DrawingsExtraFormat( global variable )

This is a global variable which holds the alternative output format for a drawing. By default its value is "none" which indicates that just PostScript will be used as the output format.

If its value becomes one of those in DrawingsListOfExtraFormats (3.5-1), then besides the PostScript file, it will also be created a file in the alternative format.

To change this variable's value, please use SetDrawingsExtraFormat (3.5-3).

3.5-3 SetDrawingsExtraFormat
> SetDrawingsExtraFormat( f )( function )

This function is used to set the value of DrawingsExtraFormat (3.5-2) to the format f which is one of DrawingsListOfExtraFormats (3.5-1).

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.

3.6 Drawings extra graph attributes

The functions described in this subsection are intended to give the user a finer control over the final drawing. They allow to define the graph attributes described in http://graphviz.org/doc/info/attrs.html. (Note that only graph attributes are allowed to be defined, not edge nor node attributes are supported yet.)

3.6-1 DrawingsExtraGraphAttributes
> DrawingsExtraGraphAttributes( global variable )

This is a global variable which holds a list of strings, each of which defines a dot graph attribute. This variable is not intended to be modified by the user directly, but can be used to check which extra attributes are currently defined. To set the attributes, please use SetDrawingsExtraGraphAttributes (3.6-2). If DrawingsExtraGraphAttributes holds the value "none" then the default dot settings will be used. Use ClearDrawingsExtraGraphAttributes (3.6-3) to set it to "none".

3.6-2 SetDrawingsExtraGraphAttributes
> SetDrawingsExtraGraphAttributes( L )( function )

This is the function to define the drawing's graph attributes (see http://graphviz.org/doc/info/attrs.html for a list and explanation of them). the argument L is a list of strings, each of which defines a dot graph attribute. For example, if we wanted to define the graph size to be 7x9 (in inches), we would call SetDrawingsExtraGraphAttributes(["size=7,9"]);.

If we also wanted to define the graph to be displayed in landscape mode we would call SetDrawingsExtraGraphAttributes(["size=7,9", "rotate=90"]);. If, in addition we wanted to define the background color to be, for example, pink, we would call SetDrawingsExtraGraphAttributes(["size=7,9", "rotate=90", "bgcolor=pink"]);.

After defining the attributes, any command that creates a drawing will use the last defined attributes. To set them back to the defaults, please use ClearDrawingsExtraGraphAttributes (3.6-3).

gap> DrawingsExtraGraphAttributes;
"none"


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

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


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

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


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

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


gap> ClearDrawingsExtraGraphAttributes();

gap> DrawingsExtraGraphAttributes;
"none"

3.6-3 ClearDrawingsExtraGraphAttributes
> ClearDrawingsExtraGraphAttributes( )( function )

This function sets the graph drawing attributes back to dot's defaults.

 Top of Book   Previous Chapter   Next Chapter 
Goto Chapter: Top 1 2 3 4 Bib Ind

generated by GAPDoc2HTML