GAP (Semigroups) - Chapter 16: Visualising semigroups and elements

Goto Chapter: Top 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 Bib Ind
[Top of Book] [Contents] [Previous Chapter] [Next Chapter]

[MathJax on]

16 Visualising semigroups and elements
16.1 `dot` pictures
16.1-1 DotString
16.1-2 DotString
16.1-3 DotSemilatticeOfIdempotents
16.1-4 DotLeftCayleyDigraph
16.2 `tex` output
16.2-1 TexString
16.3 `tikz` pictures
16.3-1 TikzString
16.3-2 TikzLeftCayleyDigraph

### 16 Visualising semigroups and elements

There are two operations `TikzString` (16.3-1) and `DotString` (16.1-1) in Semigroups for creating LaTeX and `dot` (also known as GraphViz) format pictures of the Green's class structure of a semigroup and for visualising certain types of elements of a semigroup. There is also a function `Splash` (Digraphs: Splash) for automatically processing the output of `TikzString` (16.3-1) and `DotString` (16.1-1) and opening the resulting pdf file.

#### 16.1 `dot` pictures

In this section, we describe the operations in Semigroups for creating pictures in `dot` format.

The operations described in this section return strings, which can be written to a file using the function `FileString` (GAPDoc: FileString) or viewed using `Splash` (Digraphs: Splash).

##### 16.1-1 DotString

`‣ DotString`( S[, options] ) | ( operation )

Returns: A string.

If the argument S is a semigroup, and the optional second argument options is a record, then this operation produces a graphical representation of the partial order of the D-classes of the semigroup S together with the eggbox diagram of each D-class. The output is in `dot` format (also known as `GraphViz`) format. For details about this file format, and information about how to display or edit this format see https://www.graphviz.org.

The string returned by `DotString` can be written to a file using the command `FileString` (GAPDoc: FileString).

The D-classes are shown as eggbox diagrams with L-classes as rows and R-classes as columns; group H-classes are shaded gray and contain an asterisk. The L-classes and R-classes within a D-class are arranged to correspond to the normalization of the principal factor given by `NormalizedPrincipalFactor` (10.4-8). The D-classes are numbered according to their index in `GreensDClasses(S)`, so that an `i` appears next to the eggbox diagram of `GreensDClasses(S)[i]`. A line from one D-class to another indicates that the higher D-class is greater than the lower one in the D-order on S.

If the optional second argument options is present, it can be used to specify some options for output.

number

  if `options.number` is `false`, then the D-classes in the diagram are not numbered according to their index in the list of D-classes of S. The default value for this option is `true`.

maximal

  if `options.maximal` is `true`, then the structure description of the group H-classes is displayed; see `StructureDescription` (Reference: StructureDescription). Setting this attribute to `true` can adversely affect the performance of `DotString`. The default value for this option is `false`.

normal

  if `options.normal` is `false`, then the L- and R-classes within each D-class arranged to correspond to `PrincipalFactor` (10.4-8). If `options.normal` is `true`, they are instead arranged to correspond to `NormalizedPrincipalFactor` (10.4-8). Setting this attribute to `false` may improve the performance of `DotString` as it avoids the computation of `InjectionNormalizedPrincipalFactor` (10.4-7). The default value for this option is `true`.

    gap> S := FullTransformationMonoid(3);
    <full transformation monoid of degree 3>
    gap> DotString(S);
    "//dot\ndigraph  DClasses {\nnode [shape=plaintext]\nedge [color=blac\
    k,arrowhead=none]\n1 [shape=box style=invisible label=<\n<TABLE BORDE\
    R=\"0\" CELLBORDER=\"1\" CELLPADDING=\"10\" CELLSPACING=\"0\" PORT=\"\
    1\">\n<TR BORDER=\"0\"><TD COLSPAN=\"1\" BORDER = \"0\" > 1</TD></TR>\
    <TR><TD BGCOLOR=\"gray\">*</TD></TR>\n</TABLE>>];\n2 [shape=box style\
    =invisible label=<\n<TABLE BORDER=\"0\" CELLBORDER=\"1\" CELLPADDING=\
    \"10\" CELLSPACING=\"0\" PORT=\"2\">\n<TR BORDER=\"0\"><TD COLSPAN=\"\
    3\" BORDER = \"0\" > 2</TD></TR><TR><TD BGCOLOR=\"gray\">*</TD><TD BG\
    COLOR=\"gray\">*</TD><TD BGCOLOR=\"white\"></TD></TR>\n<TR><TD BGCOLO\
    R=\"gray\">*</TD><TD BGCOLOR=\"white\"></TD><TD BGCOLOR=\"gray\">*</T\
    D></TR>\n<TR><TD BGCOLOR=\"white\"></TD><TD BGCOLOR=\"gray\">*</TD><T\
    D BGCOLOR=\"gray\">*</TD></TR>\n</TABLE>>];\n3 [shape=box style=invis\
    ible label=<\n<TABLE BORDER=\"0\" CELLBORDER=\"1\" CELLPADDING=\"10\"\
     CELLSPACING=\"0\" PORT=\"3\">\n<TR BORDER=\"0\"><TD COLSPAN=\"1\" BO\
    RDER = \"0\" > 3</TD></TR><TR><TD BGCOLOR=\"gray\">*</TD></TR>\n<TR><\
    TD BGCOLOR=\"gray\">*</TD></TR>\n<TR><TD BGCOLOR=\"gray\">*</TD></TR>\
    \n</TABLE>>];\n1 -> 2\n2 -> 3\n }"
    gap> FileString("t3.dot", DotString(S));
    1040

##### 16.1-2 DotString

`‣ DotString`( digraph ) | ( operation )

Returns: A string.

If digraph is a `Digraph` (Digraphs: Digraph) in the category `IsCayleyDigraph` (Digraphs: IsCayleyDigraph), then `DotString` returns a graphical representation of digraph. The output is in `dot` format (also known as `GraphViz`) format. For details about this file format, and information about how to display or edit this format see https://www.graphviz.org.

The string returned by `DotString` can be written to a file using the command `FileString` (GAPDoc: FileString).

See also `DotLeftCayleyDigraph` (16.1-4) and `TikzLeftCayleyDigraph` (16.3-2).

##### 16.1-3 DotSemilatticeOfIdempotents

`‣ DotSemilatticeOfIdempotents`( S ) | ( attribute )

Returns: A string.

This function produces a graphical representation of the semilattice of the idempotents of an inverse semigroup S where the elements of S have a unique semigroup inverse accessible via `Inverse` (Reference: inverse). The idempotents are grouped by the D-class they belong to.

The output is in `dot` format (also known as `GraphViz`) format. For details about this file format, and information about how to display or edit this format see https://www.graphviz.org.

    gap> S := DualSymmetricInverseMonoid(4);
    <inverse block bijection monoid of degree 4 with 3 generators>
    gap> DotSemilatticeOfIdempotents(S);
    "//dot\ngraph graphname {\n  node [shape=point]\nranksep=2;\nsubgraph \
    cluster_1{\n15 \n}\nsubgraph cluster_2{\n5 11 14 12 13 8 \n}\nsubgraph\
     cluster_3{\n2 10 6 3 4 9 7 \n}\nsubgraph cluster_4{\n1 \n}\n2 -- 1\n3\
     -- 1\n4 -- 1\n5 -- 2\n5 -- 3\n5 -- 4\n6 -- 1\n7 -- 1\n8 -- 2\n8 -- 6\
    \n8 -- 7\n9 -- 1\n10 -- 1\n11 -- 2\n11 -- 9\n11 -- 10\n12 -- 3\n12 -- \
    6\n12 -- 9\n13 -- 3\n13 -- 7\n13 -- 10\n14 -- 4\n14 -- 6\n14 -- 10\n15\
     -- 5\n15 -- 8\n15 -- 11\n15 -- 12\n15 -- 13\n15 -- 14\n }"

##### 16.1-4 DotLeftCayleyDigraph

`‣ DotLeftCayleyDigraph`( S ) | ( operation )

`‣ DotRightCayleyDigraph`( S ) | ( operation )

Returns: A string.

If S is a semigroup satisfying `CanUseFroidurePin` (6.1-4), then `DotLeftCayleyDigraph` is simply short for `DotString(LeftCayleyDigraph(S))`.

`DotRightCayleyDigraph` can be used to produce a dot string for the right Cayley graph of S.

See `DotString` (16.1-1) for more details, and see also `TikzLeftCayleyDigraph` (16.3-2).

    gap> DotLeftCayleyDigraph(Semigroup(IdentityTransformation));
    "//dot\ndigraph hgn{\nnode [shape=circle]\n1 [label=\"a\"]\n1 -> 1\n}\
    \n"
    gap> DotRightCayleyDigraph(Semigroup(IdentityTransformation));
    "//dot\ndigraph hgn{\nnode [shape=circle]\n1 [label=\"a\"]\n1 -> 1\n}\
    \n"

#### 16.2 `tex` output

In this section, we describe the operations in Semigroups for creating LaTeX representations of GAP objects. For pictures of GAP objects please see Section 16.3.

##### 16.2-1 TexString

`‣ TexString`( f[, n] ) | ( operation )

Returns: A string.

This function produces a string containing LaTeX code for the transformation f. If the optional paramater n is used, then this is taken to be the degree of the transformation f, if the parameter n is not given, then `DegreeOfTransformation` (Reference: DegreeOfTransformation) is used by default. If n is less than the degree of f, then an error is given.

    gap> TexString(Transformation([6, 2, 4, 3, 6, 4]));
    "\\begin{pmatrix}\n  1 & 2 & 3 & 4 & 5 & 6 \\\\\n  6 & 2 & 4 & 3 & 6 &\
     4\n\\end{pmatrix}"
    gap> TexString(Transformation([1, 2, 1, 3]), 5);
    "\\begin{pmatrix}\n  1 & 2 & 3 & 4 & 5 \\\\\n  1 & 2 & 1 & 3 & 5\n\\en\
    d{pmatrix}"

#### 16.3 `tikz` pictures

In this section, we describe the operations in Semigroups for creating pictures in `tikz` format.

The functions described in this section return a string, which can be written to a file using the function `FileString` (GAPDoc: FileString) or viewed using `Splash` (Digraphs: Splash).

##### 16.3-1 TikzString

`‣ TikzString`( obj[, options] ) | ( operation )

Returns: A string.

This function produces a graphical representation of the object obj using the `tikz` package for LaTeX. More precisely, this operation outputs a string containing a minimal LaTeX document which can be compiled using LaTeX to produce a picture of obj.

Currently the following types of objects are supported:

blocks

  If obj is the left or right blocks of a bipartition, then `TikzString` returns a graphical representation of these blocks; see Section 3.6.

bipartitions

  If obj is a bipartition, then `TikzString` returns a graphical representation of obj.

  If the optional second argument options is a record with the component `colors` set to `true`, then the blocks of f will be colored using the standard `tikz` colors. Due to the limited number of colors available in `tikz` this option only works when the degree of obj is less than 20. See Chapter 3 for more details about bipartitions.

pbrs

  If obj is a `PBR` (4.2-1), then `TikzString` returns a graphical representation obj; see Chapter 4.

Cayley graphs

  If obj is a `Digraph` (Digraphs: Digraph) in the category `IsCayleyDigraph` (Digraphs: IsCayleyDigraph), then `TikzString` returns a picture of obj. No attempt is made whatsoever to produce a sensible picture of the digraph obj, in fact, the vertices are all given the same coordinates. Human intervention is required to produce a meaningful picture from the value returned by this method. It is intended to make the task of drawing such a Cayley graph more straightforward by providing everything except the final layout of the graph. Please use `DotString` (16.1-1) if you want an automatically laid out diagram of the digraph obj.

    gap> x := Bipartition([[1, 4, -2, -3], [2, 3, 5, -5], [-1, -4]]);;
    gap> TikzString(RightBlocks(x));
    "%tikz\n\\documentclass{minimal}\n\\usepackage{tikz}\n\\begin{documen\
    t}\n\\begin{tikzpicture}\n  \\draw[ultra thick](5,2)circle(.115);\n  \
    \\draw(1.8,5) node [top] {{$1$}};\n  \\fill(4,2)circle(.125);\n  \\dr\
    aw(1.8,4) node [top] {{$2$}};\n  \\fill(3,2)circle(.125);\n  \\draw(1\
    .8,3) node [top] {{$3$}};\n  \\draw[ultra thick](2,2)circle(.115);\n \
     \\draw(1.8,2) node [top] {{$4$}};\n  \\fill(1,2)circle(.125);\n  \\d\
    raw(1.8,1) node [top] {{$5$}};\n\n  \\draw (5,2.125) .. controls (5,2\
    .8) and (2,2.8) .. (2,2.125);\n  \\draw (4,2.125) .. controls (4,2.6)\
     and (3,2.6) .. (3,2.125);\n\\end{tikzpicture}\n\n\\end{document}"
    gap> x := Bipartition([[1, 5], [2, 4, -3, -5], [3, -1, -2], [-4]]);;
    gap> TikzString(x);
    "%tikz\n\\documentclass{minimal}\n\\usepackage{tikz}\n\\begin{documen\
    t}\n\\begin{tikzpicture}\n\n  %block #1\n  %vertices and labels\n  \\\
    fill(1,2)circle(.125);\n  \\draw(0.95, 2.2) node [above] {{ $1$}};\n \
     \\fill(5,2)circle(.125);\n  \\draw(4.95, 2.2) node [above] {{ $5$}};\
    \n\n  %lines\n  \\draw(1,1.875) .. controls (1,1.1) and (5,1.1) .. (5\
    ,1.875);\n\n  %block #2\n  %vertices and labels\n  \\fill(2,2)circle(\
    .125);\n  \\draw(1.95, 2.2) node [above] {{ $2$}};\n  \\fill(4,2)circ\
    le(.125);\n  \\draw(3.95, 2.2) node [above] {{ $4$}};\n  \\fill(3,0)c\
    ircle(.125);\n  \\draw(3, -0.2) node [below] {{ $-3$}};\n  \\fill(5,0\
    )circle(.125);\n  \\draw(5, -0.2) node [below] {{ $-5$}};\n\n  %lines\
    \n  \\draw(2,1.875) .. controls (2,1.3) and (4,1.3) .. (4,1.875);\n  \
    \\draw(3,0.125) .. controls (3,0.7) and (5,0.7) .. (5,0.125);\n  \\dr\
    aw(2,2)--(3,0);\n\n  %block #3\n  %vertices and labels\n  \\fill(3,2)\
    circle(.125);\n  \\draw(2.95, 2.2) node [above] {{ $3$}};\n  \\fill(1\
    ,0)circle(.125);\n  \\draw(1, -0.2) node [below] {{ $-1$}};\n  \\fill\
    (2,0)circle(.125);\n  \\draw(2, -0.2) node [below] {{ $-2$}};\n\n  %l\
    ines\n  \\draw(1,0.125) .. controls (1,0.6) and (2,0.6) .. (2,0.125);\
    \n  \\draw(3,2)--(2,0);\n\n  %block #4\n  %vertices and labels\n  \\f\
    ill(4,0)circle(.125);\n  \\draw(4, -0.2) node [below] {{ $-4$}};\n\n \
    %lines\n\\end{tikzpicture}\n\n\\end{document}"
    gap> TikzString(UniversalPBR(2));
    "%latex\n\\documentclass{minimal}\n\\usepackage{tikz}\n\\begin{docume\
    nt}\n\\usetikzlibrary{arrows}\n\\usetikzlibrary{arrows.meta}\n\\newco\
    mmand{\\arc}{\\draw[semithick, -{>[width = 1.5mm, length = 2.5mm]}]}\
    \n\\begin{tikzpicture}[\n  vertex/.style={circle, draw, fill=black, i\
    nner sep =0.04cm},\n  ghost/.style={circle, draw = none, inner sep = \
    0.14cm},\n  botloop/.style={min distance = 8mm, out = -70, in = -110}\
    ,\n  toploop/.style={min distance = 8mm, out = 70, in = 110}]\n\n  % \
    vertices and labels\n  \\foreach \\i in {1,...,2} {\n    \\node [vert\
    ex] at (\\i/1.5, 3) {};\n    \\node [ghost] (\\i) at (\\i/1.5, 3) {};\
    \n  }\n\n  \\foreach \\i in {1,...,2} {\n    \\node [vertex] at (\\i/\
    1.5, 0) {};\n    \\node [ghost] (-\\i) at (\\i/1.5, 0) {};\n  }\n\n  \
    % arcs from vertex 1\n  \\arc (1) to (-2);\n  \\arc (1) to (-1);\n  \
    \\arc (1) edge [toploop] (1);\n  \\arc (1) .. controls (1.06666666666\
    66667, 2.125) and (0.93333333333333324, 2.125) .. (2);\n\n  % arcs fr\
    om vertex -1\n  \\arc (-1) .. controls (1.0666666666666667, 0.875) an\
    d (0.93333333333333324, 0.875) .. (-2);\n  \\arc (-1) edge [botloop] \
    (-1);\n  \\arc (-1) to (1);\n  \\arc (-1) to (2);\n\n  % arcs from ve\
    rtex 2\n  \\arc (2) to (-2);\n  \\arc (2) to (-1);\n  \\arc (2) .. co\
    ntrols (0.93333333333333324, 2.125) and (1.0666666666666667, 2.125) .\
    . (1);\n  \\arc (2) edge [toploop] (2);\n\n  % arcs from vertex -2\n \
     \\arc (-2) edge [botloop] (-2);\n  \\arc (-2) .. controls (0.9333333\
    3333333324, 0.875) and (1.0666666666666667, 0.875) .. (-1);\n  \\arc \
    (-2) to (1);\n  \\arc (-2) to (2);\n\n\\end{tikzpicture}\n\\end{docum\
    ent}"

##### 16.3-2 TikzLeftCayleyDigraph

`‣ TikzLeftCayleyDigraph`( S ) | ( operation )

`‣ TikzRightCayleyDigraph`( S ) | ( operation )

Returns: A string.

If S is a semigroup satisfying `CanUseFroidurePin` (6.1-4), then `TikzLeftCayleyDigraph` is simply short for `TikzString(LeftCayleyDigraph(S))`.

`TikzRightCayleyDigraph` can be used to produce a tikz string for the right Cayley graph of S.

See `TikzString` (16.3-1) for more details, and see also `DotLeftCayleyDigraph` (16.1-4).

    gap> TikzLeftCayleyDigraph(Semigroup(IdentityTransformation));
    "\\begin{tikzpicture}[scale=1, auto, \n  vertex/.style={c\
    ircle, draw, thick, fill=white, minimum size=0.65cm},\n  \
    edge/.style={arrows={-angle 90}, thick},\n  loop/.style={\
    min distance=5mm,looseness=5,arrows={-angle 90},thick}]\n\
    \n  % Vertices . . .\n  \\node [vertex] (a) at (0, 0) {};\
    \n  \\node at (0, 0) {$a$};\n\n  % Edges . . .\n  \\path[\
    ->] (a) edge [loop]\n           node {$a$} (a);\n\\end{ti\
    kzpicture}"
    gap> TikzRightCayleyDigraph(Semigroup(IdentityTransformation));
    "\\begin{tikzpicture}[scale=1, auto, \n  vertex/.style={c\
    ircle, draw, thick, fill=white, minimum size=0.65cm},\n  \
    edge/.style={arrows={-angle 90}, thick},\n  loop/.style={\
    min distance=5mm,looseness=5,arrows={-angle 90},thick}]\n\
    \n  % Vertices . . .\n  \\node [vertex] (a) at (0, 0) {};\
    \n  \\node at (0, 0) {$a$};\n\n  % Edges . . .\n  \\path[\
    ->] (a) edge [loop]\n           node {$a$} (a);\n\\end{ti\
    kzpicture}"

[Top of Book] [Contents] [Previous Chapter] [Next Chapter]
Goto Chapter: Top 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 Bib Ind

generated by GAPDoc2HTML