TCayleyDiagram class
The Cayley diagram is one of the more interesting aspects of Group
Explorer, and its implementation less obvious than some of the other parts of
the software. Thus we take some time to address it in our technical
documentation, here.
Listed below are three of the the important/interesting member functions
for the class TCayleyDiagram, and a discussion of the algorithms that
implement them.
Functions
procedure loadFromFile (Ini : TIniFile; Section : string);
Calls functions from
GroupParsing.pas to read and parse information from a .gp
file. The TIniFile class is a Borland Delphi
class which reads all settings in a text file of the appropriate format into a
data structure in memory, so that they can then be accessed in any order
(rather than in the linear order of the file). Group Explorer adopts the
.INI file format for its .gp files (see
the Group Authoring page), and so this
loadFromFile procedure can simply ask, for each piece of information it
needs to build a Cayley diagram, whether that information exists in the given
section of the data structure
Ini that is passed as the first the parameter.
This routine is called by the loadFromFile routine of
TVisualGroup, and it is
called once for each section that declares a custom Cayley diagram.
Pieces of information this routine extracts from the section are listed
here.
- The name the author gave to this custom diagram
- Each node in the diagram, including its location, color, size, and the
group element it represents
procedure makeFromGroup (
G : TGroup; gens : TGroupElts; axes : TAxes;
AxisToGen, DimToGen : TPermIndex);
This routine is half of the inner workings that auto-generate Cayley
diagrams; the other half is the orbitGrid
function. Recall that a TCayleyDiagram (class
documented here) object associates elements of the group with positions in
space. This function examines a group and some parameters for
auto-generating a Cayley diagram for it, and then alters the TCayleyDiagram
object from which it as called to shape it into a suitable association of
group elements with points in space.
The quantity of parameters to this routine necessitates a discussion of
each.
 | G is the group whose Cayley diagram we wish to create. |
 | gens is a set of generators for the group, the set that
should be used to generate the diagram. |
 | axes is one of a predefined list of possible ways to lay
out the grid of group elements in space (e.g. rectangular, polar,
cylindrical, etc.). Such choices are available to the user from
the Edit Cayley Diagram dialog box. |
 | AxisToGen is a permutation mapping axes to generators.
That is, for each index i, axis i corresponds to
generator AxisToGen[i]. This is customizable by the
user through the Edit Cayley Diagram
dialog box. |
 | DimToGen is a permutation mapping dimensions (priorities)
to generators. That is, for each index i, generator
AxisToGen[i] has priority i (where lower numbers
are higher priority). This is customizable by the user through
the Edit Cayley Diagram dialog box. |
The algorithm for this procedure is lengthy, requiring many subroutines to
implement its details, but the big picture can be described in just a few
steps. We do so here.
- Permute the generators in
gens according to the
permutation in DimToGen.
- Use the
potentGens
function to ensure the generators list is not redundant, and remove any
redundant ones.
- Ensure the number of generators that remain is equal to the dimension
of
axes.
- Arrange the elements of the group into a grid using the
orbitGrid function.
- Loop through the generated grid and determine the coordinates in
Euclidean three-space for each element of the group from its position
within the grid, the system of
axes chosen, and the
permutation AxisToGen.
procedure findGoodPermutations (
G : TGroup; gens : TGroupElts; axes : TAxes;
var AxisToGen : TPermIndex; var DimToGen : TPermIndex);
When Group Explorer first opens a Cayley diagram, it does not know what
values of AxisToGen and DimToGen it should pass to
makeFromGroup (above) to generate an aesthetically pleasing
diagram. This routine uses a few heuristics to choose good values for
those permutations. The heuristics it follows are listed in the
following table.
For linear, circular, rectangular, or rectangular solid axes,
the identity permutations work as well as any.
For line of rectangular solids,
permute the generators in such a way as to create an
orbit grid dimension that is as short as possible, and assign that
dimension to the w axis.
For polar, toroidal, ring of lines, ring of rectangles, or ring of
rectangular solids,
permute the generators in such a way as to create an
orbit grid dimension that is as long as possible, and assign that
dimension to the rotational axis (theta for polar, major for toroidal,
or the ring axis).
For polar, cylindrical, or ring of circles axis,
permute the generators in such a way as to create an
orbit grid dimension that is as long as possible, and assign that
dimension to the theta axis.
For ring of polars, ring of hollow cylinders, or ring of cylinders,
permute the generators in such a way as to create an
orbit grid dimension that is as long as possible, and assign that
dimension to the theta axis, then find the next longest dimension and
assign it to the ring axis.
For ring of tori,
permute the generators in such a way as to create an
orbit grid dimension that is as long as possible, and assign that
dimension to the theta axis, then find the next longest dimension and
assign it to the major axis.
For line of cylinders,
permute the generators in such a way as to create an
orbit grid dimension that is as short as possible, and assign that
dimension to the w axis, then find the next longest dimension and assign
it to the theta axis.
|