‣ ShowEggBoxDiagram ( semigroup[, options] ) | ( function ) |
Returns: nothing
This function displays a visualization called an "egg-box diagram" of the given semigroup to the user by calling the display tools in the underlying JupyterViz package. Egg-box diagrams are described in Chapter 2.
Using the JupyterViz package means that one of two methods will be used for showing the user the resulting visualization:
If this function is called in a Jupyter Notebook, it returns an object that, when rendered by that notebook, will result in the visualization appearing in the correct output cell.
If run outside of a Jupyter Notebook, such as in the GAP REPL, this function creates an HTML page containing the given visualization and then opens the page in the system default web browser.
It accepts the following arguments.
The first parameter must be a semigroup, as created by GAP's Semigroups Package.
The second argument is optional but if it is present, it should be a GAP record whose contents will govern how this function does its work, as indicated below.
The fields you can provide in the options
parameter are as follows. Each is optional, and its default value is documented below.
ToString
can be a function mapping elements of the semigroup to strings, as documented in SGPVIZ_HClassToRecord
(4.2-1).
NrDClassesIncluded
can be the maximum number of D-classes to compute and include in the JSON object to be visualized. This is useful if the semigroup is extremely large, and you want to send only a manageable amount of JSON data to be displayed, so that the computation becomes feasible. This defaults to 20. Set it to 0 for no limit (if you know your semigroup is of a reasonable size).
NrRClassesIncludedPerDClass
can be the maximum number of R-classes to compute for any one D-class and include in the JSON, for the same reasons as described above for NrDClassesIncluded
. This defaults to 20. Set it to 0 for no limit (if you know your semigroup's D-classes have a reasonable number of R-classes each).
NrLClassesIncludedPerRClass
can be the maximum number of L-classes to compute for any one D/R-class and include in the JSON, for the same reasons as described above for NrDClassesIncluded
. This defaults to 20. Set it to 0 for no limit (if you know your semigroup's D-classes have a reasonable number of L-classes each).
NrElementsIncludedPerHClass
can be the maximum number of elements to compute for any one H-class and include in the JSON, for the same reasons as described above for NrDClassesIncluded
. This defaults to 20. Set it to 0 for no limit (if you know your semigroup's H-classes have a reasonable number of elements each).
‣ ShowCayleyGraph ( semigroup[, options] ) | ( function ) |
Returns: nothing by default but see ReturnJSON
option below
This function displays the Cayley graph of the given semigroup to the user by calling the display tools in the underlying JupyterViz package. Cayley graphs are described in Chapter 3.
Using the JupyterViz package means that one of two methods will be used for showing the user the resulting visualization:
If this function is called in a Jupyter Notebook, it returns an object that, when rendered by that notebook, will result in the visualization appearing in the correct output cell.
If run outside of a Jupyter Notebook, such as in the GAP REPL, this function creates an HTML page containing the given visualization and then opens the page in the system default web browser.
It accepts the following arguments.
The first parameter must be a semigroup, as created by GAP's Semigroups Package.
The second argument is optional but if it is present, it should be a GAP record whose contents will govern how this function does its work, as indicated below.
The fields you can provide in the options
parameter are as follows. Each is optional, and its default value is documented below.
ToString
can be a function mapping elements of the semigroup to strings, as documented in SGPVIZ_HClassToRecord
(4.2-1).
Generators
can be a list of elements of the semigroup to use as generators (which are drawn as arrows in the Cayley graph). If this is not provided, the function GeneratorsOfSemigroup
is called to find a generating set and then a small subset of that is chosen, just enough to ensure the resulting graph is connected.
ShowElementNames
may be a boolean, whether to show names of elements on the graph's vertices. The default is true.
ShowActionNames
may be a boolean, whether to show names of elements on the graph's edges, indicating which element's multiplication the edge represents. The default is false.
Multiplication
may be a string indicating whether the graph should show its action by left or right multiplication. The default is "right"
.
ReturnJSON
may be a boolean and it defaults to false. If set to true, then instead of calling the CreateVisualization
function in the JupyterViz and returning its result, this function will return the GAP record that it would have passed to CreateVisualization
for conversion into JSON and rendering. Such data will be in a form amenable to rendering by Cytoscape, as documented in the JupyterViz package manual. This option is useful if you wish to make some custom changes to that data before passing it to CreateVisualization
, such as positioning the vertices in the plane or changing vertex or edge styles.
None of these methods should need to be called by a client of this package. We provide this documentation here for completeness, not out of necessity.
‣ SGPVIZ_HClassToRecord ( semigroup, hclass, options ) | ( function ) |
Returns: a GAP record obeying the options passed in the third argument
This function converts the given H-class from the given semigroup into a GAP record amenable to conversion to JSON for passing to one of the HTML-based visualization tools from the JupyterViz package. Such conversion can be done by GAP's JSON package.
The first parameter must be a semigroup, as created by GAP's Semigroups Package.
The second argument must be a single H-class from that semigroup, which you can form in a number of ways, such as by choosing a D-class, lifting out its first R- and L-classes, and interesecting them.
The final argument should be a GAP record whose contents will govern how this function does its work, as indicated below.
Attributes in the resulting record include:
size
is the number of elements in the H-class
representative
is a string representation of the H-class's representative. The string representation will be computed by passing the H-class's representative element to the options.ToString
function.
elements
is an array of string representations of all the elements in the class, by default, or some subset of them if options.NrElementsIncludedPerHClass > 0
and smaller than the number of elements in this particular class. The representative is always first on this list. These string representations are also computed by options.ToString
.
‣ SGPVIZ_DClassToRecord ( semigroup, dclass, options ) | ( function ) |
Returns: a GAP record obeying the options passed in the third argument
This function converts the given D-class from the given semigroup into a GAP record amenable to conversion to JSON for passing to one of the HTML-based visualization tools from the JupyterViz package. Such conversion can be done by GAP's JSON package.
The first parameter must be a semigroup, as created by GAP's Semigroups Package.
The second argument must be a single D-class from that semigroup, which you can form in a number of ways, such as Dclasses(semigroup)[1]
.
The final argument should be a GAP record whose contents will govern how this function does its work, as indicated below.
Attributes in the resulting record include:
size
is the number of R-classes in the D-class
RClasses
is an array of records, each of which has the following attributes:
size
is the number of L-classes in the R-class (though not all of these need be included in the return value; you can set a smaller limit in options.NrRClassesIncludedPerDClass
)
HClasses
is an array of records, each of which is produced by a call to SGPVIZ_HClassToRecord
(4.2-1), passing this semigroup
, one of its H-classes, and the same options
object passed to us. See that function, above, for details on its output format. (Not all H-classes need be included in the return value; you can set a smaller limit in options.NrLClassesIncludedPerRClass
, recalling that choosing an L-class and an R-class determines an H-class.)
‣ SGPVIZ_EggBoxDiagramRecord ( semigroup, options ) | ( function ) |
Returns: a GAP record obeying the options passed in the third argument
This function converts the given semigroup into a GAP record amenable to conversion to JSON for passing to one of the HTML-based visualization tools from the JupyterViz package. Such conversion can be done by GAP's JSON package.
The first parameter must be a semigroup, as created by GAP's Semigroups Package.
The second argument should be a GAP record whose contents will govern how this function does its work, as indicated below.
Attributes in the resulting record include:
name
is a string describing the semigroup. This will come directly from options.name
if you include such a field, or will be computed from ViewString(semigroup)
if you do not (by removing angle brackets and line break characters).
size
is the number of D-classes in the semigroup
DClasses
is an array of records, each of which is produced by a call to SGPVIZ_DClassToRecord
(4.2-2), passing this semigroup
, one of its D-classes, and the same options
object passed to us. See that function, above, for details on its output format. (Not all D-classes need be included in the return value; you can set a smaller limit in options.NrDClassesIncluded
.)
options
is a copy of the options record passed as the second parameter, with the exception of its ToString
and name
fields. (This is because the ToString
field is a function, and thus not amenable to JSON conversion, and the name
field has already been included as the name
field of the entire return value.)
‣ SGPVIZ_HSV2RGB ( hue, saturation, value ) | ( function ) |
Returns: a GAP list containing three integers in the range [0..255]
, to be interpreted as a point in RGB color space
This function converts a point in HSV color space into a point in RGB color space using the standard algorithm for doing so, available from many sources on the web.
hue
should be a number in the range [0..360]
, where 0 is the beginning of the color wheel (red) and 360 is the end (violet, becoming red again).
saturation
should be a float in the range \([0,1]\), where 0 means no saturation of the chosen hue (white/gray/black only) and 1 means full saturation (a vibrant color from the chosen hue).
value
(sometimes called brightness or lightness) should be a float in the range \([0,1]\), where 0 means a fully dark color (always black) and 1 means a fully bright color (the brightest color in RGB color space, subject to the constraints set by hue
and saturation
).
This function is used internally by ShowCayleyGraph
(4.1-2) to create distinct colors for each generator's edges.
‣ SGPVIZ_GeneratorsAreSufficient ( semigroup, generators, options ) | ( function ) |
Returns: a boolean indicating whether the given list of generators is sufficient to make a Cayley graph for the given semigroup connected
This function defines a binary relation on the elements of the semigroup, meaning "there is a generator connecting these elements." It then asks GAP to compute the smallest equivalence relation containing that relation. If that equivalence relation has just one equivalence class, the Cayley graph would be connected.
semigroup
must be a semigroup, as defined by GAP's Semigroups package.
generators
should be a list of elements from that semigroup, to be treated as generators in this computation.
options
should be the same options object passed to ShowCayleyGraph
(4.1-2), because that function replaces the options.Multiplication
option with a function that does either left or right multiplication, which this function then uses.
This function is used internally by ShowCayleyGraph
(4.1-2) to choose as few generators as possible to obtain a connected graph. See also SGPVIZ_GeneratorsSmallSubset
(4.2-6).
‣ SGPVIZ_GeneratorsSmallSubset ( semigroup, generators, options ) | ( function ) |
Returns: a sublist of the given list of generators, one just large enough to ensure that the Cayley graph of the given semigroup is connected
This function removes generators from the given list as long as doing so does not cause SGPVIZ_GeneratorsAreSufficient
(4.2-5) to return false. When it cannot remove any more generators without violating that constraint, it returns the list it reached. This is done recursively. Note that not all branches of the recursion are followed, for the sake of efficiency.
semigroup
must be a semigroup, as defined by GAP's Semigroups package.
generators
should be a list of elements from that semigroup, to be treated as generators in this computation.
options
should be the same options object passed to ShowCayleyGraph
(4.1-2), because that function replaces the options.Multiplication
option with a function that does either left or right multiplication, which this function then uses.
This function is used internally by ShowCayleyGraph
(4.1-2) to choose as few generators as possible to obtain a connected graph. See also SGPVIZ_GeneratorsAreSufficient
(4.2-5).
generated by GAPDoc2HTML