This package contains a new implementation of the standard orbit enumeration algorithm. The design principles for this implementation have been:
Allow partial orbit enumeration and later continuation.
Consequently use hashing techniques.
Implement stabiliser calculation and Schreier transversals on demand.
Allow for searching in orbits during orbit enumeration.
Some of these design principles made it necessary to change the user interface in comparison to the standard GAP one.
The enumeration of an orbit works in at least two stages: First an orbit object is created with all the necessary information to describe the orbit. Then the actual enumeration is started. The latter stage can be repeated as many times as needed in the case that the orbit enumeration stopped for some reason before the orbit was enumerated completely. See below for conditions under which this happens.
For orbit object creation there is the following function:
‣ Orb ( gens, point, op[, opt] ) | ( function ) |
Returns: An orbit object
The argument gens is either a GAP group, semigroup or monoid object or a list of generators of the magma acting, point is a point in the orbit to be enumerated, op is a GAP function describing the action of the generators on points in the usual way, that is, op(p,g)
returns the result of the action of the element g
on the point p
.
Note that in the case of a semigroup or monoid acting not all options make sense (for example stabilisers only work for groups). In this case the directed
or weak
orbit is computed.
The optional argument opt is a GAP record which can contain quite a few options changing the orbit enumeration. For a list of possible options see Subsection 3.1-4 at the end of this section.
The function returns an orbit
object that can later be used to enumerate (a part of) the orbit of point under the action of the group generated by gens.
If gens is a group, semigroup or monoid object, then its generators are taken as the list of generators acting. If a group object knows its size, then this size is used to speed up orbit and in particular stabiliser computations.
The following operation actually starts the orbit enumeration:
‣ Enumerate ( orb[, limit] ) | ( operation ) |
Returns: The orbit object orb
orb must be an orbit object created by Orb
(3.1-1). The optional argument limit must be a positive integer meaning that the orbit enumeration should stop if limit points have been found, regardless whether the orbit is complete or not. Note that the orbit enumeration can be continued by again calling the Enumerate
operation. If the argument limit is omitted, the whole orbit is enumerated, unless other options lead to prior termination.
To see whether an orbit is closed you can use the following operation:
‣ IsClosed ( orb ) | ( operation ) |
Returns: true
or false
The result indicates, whether the orbit orb is already complete or not.
Here is an example of an orbit enumeration:
gap> g := GeneratorsOfGroup(MathieuGroup(24)); [ (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23), (3,17,10,7,9)(4,13,14,19,5)(8,18,11,12,23)(15,20,22,21,16), (1,24)(2,23)(3,12)(4,16)(5,18)(6,10)(7,20)(8,14)(9,21)(11,17)(13,22)(15,19) ] gap> o := Orb(g,2,OnPoints); <open Int-orbit, 1 points> gap> Enumerate(o,20); <open Int-orbit, 21 points> gap> IsClosed(o); false gap> Enumerate(o); <closed Int-orbit, 24 points> gap> IsClosed(o); true
The orbit object o
now behaves like an immutable dense list, the entries of which are the points in the orbit in the order as they were found during the orbit enumeration (note that this is not always true when one uses the function AddGeneratorsToOrbit
(3.1-20)). So you can ask the orbit for its length, access entries, and ask, whether a given point lies in the orbit or not. Due to the hashing techniques used such lookups are quite fast, they usually only use a constant time regardless of the length of the orbit!
gap> Length(o); 24 gap> o[1]; 2 gap> o[2]; 3 gap> o{[3..5]}; [ 23, 4, 17 ] gap> 17 in o; true gap> Position(o,17); 5
The optional fourth argument opt of the function Orb
(3.1-1) is a GAP record and its components change the behaviour of the orbit enumeration. In this subsection we explain the use of the components of this options record. All components are themselves optional. For every component we also describe the possible values in the following list:
eqfunc
This component always has to be given together with the component hashfunc
. If both are given, they are used to set up a hash table to store the points in the orbit. You have to use this if the automatic mechanism to find a suitable hash function does not work for your starting point in the orbit.
Note that if you use this feature, the hash table cannot grow automatically any more, unless you also use the components hfbig
and hfdbig
as well. See the description of GrowHT
(4.4-5) for an explanation how to use this feature.
genstoapply
This is only used internally and is intentionally not documented.
gradingfunc
If this component is bound it must be bound to a function taking two arguments, the first is the orbit object, the second is a new point. This function is called for every new point and is supposed to compute a grade
for the point which can be an arbitrary GAP object. The resulting values are then stored in a list of equal length to the orbit and can later be queried with the Grades
(3.1-11) operation. If this feature is used the orbit object will lie in the filter IsGradedOrbit
(3.1-10). In connection with the onlygrades
option the enumeration of an orbit can be limited to points with certain grades, see below.
grpsizebound
Possible values for this component are positive integers. By setting this value one can help the orbit enumeration to complete earlier. The given number must be an upper bound for the order of the group. If the exact group order is given and the stabiliser is calculated during the orbit enumeration (see component permgens
), then the orbit enumeration can stop as soon as the orbit is found completely and the stabiliser is complete, which is usually much earlier than after all generator are applied to all points in the orbit.
forflatplainlists
If this component is set to true
then the user guarantees that all the points in the orbit will be flat plain lists, that is, plain lists with no subobjects. For example lists of immediate integers will fulfill this requirement, but ranges don't. In this case, a particularly good and efficient hash function will automatically be taken and the components hf
, hfd
, hfbig
and hfdbig
are ignored. Note that this cannot be automatically detected because it depends not only on the first point of the orbit but also on the other points in the orbit and thus on the group generators given.
hashfunc
This component always has to be given together with the eqfunc
component (see also there). The value should be a record with components func
and data
. The former is used as the hash function (component hf
in the options to HTCreate
(4.3-1)) and the latter as data argument (component hfd
). The length of the hash is determined by the value of the component hashlen
. If a tree hash is to be used, the component treehashsize
has to be used instead of hashlen
. If you want to use a hash table that can grow automatically, use the hfbig
and htdbig
components together with hashlen
for the initial size. See HTCreate
(4.3-1) for details.
hashlen
Possible values are positive integers. This component determines the initial size of the hash used for the orbit enumeration. The default value is 10000. If the hash table turns out not to be large enough, it is automatically increased by a factor of two during the calculation. Although this process is quite fast it still improves performance to give a sensible hash size in advance.
hfbig
and hfdbig
These components can only be used in connection with eqfunc
and hashfunc
and are otherwise ignored. There values are simply passed on to the hash table created. The idea is to still be able to grow the hash table if need be. See Section 4.5 for more details.
treehashsize
This component indicates that instead of a normal hash table a tree hash table (TreeHashTab) should be used (see Section 4.1). If bound, it must be set to the length of the tree hash table. You should still choose this length big enough, however, this type of hash table should be more resilient to bad hash functions since the performance of operations will only deteriorate up to log(n) instead of to n (number of entries). If you use this option your hash keys must be comparable by <
and not only by =
. You can supply your own three-way comparison function (see HTCreate
(4.3-1)) by using the cmpfunc
component.
cmpfunc
If the previous component treehashsize
is bound, you can specify a three-way comparison function for the hash keys in this component. See HTCreate
(4.3-1) and AVLCmp
(8.2-2) for details.
log
If this component is set to true
then a log of the enumeration of the orbit is written into the components log
, logind
and logpos
. Every time a new point is found in the orbit enumeration, two numbers are appended to the log, first the number of the generator applied, then the index, under which the new point is stored in the orbit. For each point in the orbit, the start of the entries for that point in log
is stored in logind
and the end of those entries is marked by storing the number of the last generator producing a new point negated.
The purpose of a log is the following: With a log one can later add group generators to the orbit and thus get a different Schreier tree, such that the resulting orbit enumeration is still a breadth first enumeration using the new generating set! This is desirable to decrease the depth of the Schreier tree. The log helps to implement this in a way, such that the old generators do not again have to be applied to all the points in the orbit. See AddGeneratorsToOrbit
(3.1-20) for details.
A log needs roughly 3 machine words per point in the orbit as memory.
lookingfor
This component is used to search for something in the orbit. The idea is that the orbit enumeration is stopped when some condition is met. This condition can be specified with a great flexibility. The first way is to store a list of points into orb.lookingfor
. In that case the orbit enumeration stops, when a point is found that is in that list. A second possiblity is to store a hash table object into orb.lookingfor
. Then every newly found point in the orbit is looked up in that hash table and the orbit enumeration stops as soon as a point is found that is also in the hash table. The third possibility is functional: You can store a GAP function into opt.lookingfor
which is called for every newly found point in the orbit. It gets both the orbit object and the point as its two arguments. This function has to return false
or true
and in the latter case the orbit enumeration is stopped.
Whenever the orbit enumeration is stopped the component found
is set to the number of the found point in the orbit. Access this information using PositionOfFound(orb)
.
matgens
This is not yet implemented. It will allow for stabiliser computations in matrix groups.
onlygrades
This option is to limit the orbit enumeration to points with certain grades (see option gradingfunc
). The primary way to do this is to bind onlygrades
to a function taking two arguments. The first is the grade value, the second is the value bound to the option onlygradesdata
below. The function is then called for every new point after its grade is computed. If the function returns true
the point is stored in the orbit as usual, if it returns false
the point is dropped. Note that using this option can (and ought to) lead to incomplete orbits which claim to be closed.
As a shorthand notation one can bind a list or hash table to the component onlygrades
. In this case a standard membership test of the grade value in the list or hash table is performed to decide whether or not the point is stored. One does not have to assign onlygradesdata
in this case.
onlygradesdata
As described above this component holds the data for the second argument of the onlygrades
test function. See option onlygrades
above.
onlystab
If this boolean flag is set to true
then the orbit enumeration stops once the stabiliser is completely determined. Note that this can only be known, if a bound for the group size is given in the opt.grpsizebound
option and when more than half of the orbit is already found, or when opt.stabsizebound
is given.
orbsizebound
Possible values for this component are positive integers. The given number must be an upper bound for the orbit length. Giving this number helps the orbit enumeration to stop earlier, when the orbit is found completely.
orbitgraph
If this component is true
then the so called orbit graph is computed. The vertices of this graph are the points of the orbit and the (directed) edges are given by the generators acting. So if a generator g maps point a to b then there is a directed edge from the vertex a to the vertex b. This graph can later be queried using the OrbitGraph
(3.1-12) and OrbitGraphAsSets
(3.1-13) operations. The data format in which the graph is returned is described there.
permbase
This component is used to tell the orbit enumerator that a certain list of points is a base of the permutation representation given in the opt.permgens
component. This information is often available beforehand and can drastically speed up the calculation of Schreier generators, especially for the common case that they are trivial. The value is just a list of integers.
permgens
If this component is set, it must be set to a list of permutations, that represent the same group as the generators used to define the orbit. This permutation representation is then used to calculate the stabiliser of the starting point. After the orbit enumeration is complete, you can call Stabilizer(orb)
with orb being the orbit object and get the stabiliser as a permutation group. The stabiliser is also stored in the stab
component of the orbit object. Furthermore, the size of the stabiliser is stored in the stabsize
component of the orbit object and the component stabwords
contains the stabiliser generators as words in the original group generators. Access these words with StabWords(orb)
. Here, a word is a list of integers, where positive integers are numbers of generators and a negative integer i indicates the inverse of the generator with number -i. In this way, complete information about the stabiliser can be derived from the orbit object.
report
Possible values are non-negative integers. This value asks for a status report whenever the orbit enumeration has applied all generators to opt.report
points. A value of 0, which is the default, switches off this report. In each report, the total number of points already found are given.
schreier
This boolean flag decides, whether a Schreier tree is stored together with the orbit. A Schreier tree just stores for each point, which generator was applied to which other point in the orbit to get it. Thus, having the Schreier tree enables the usage of the operations TraceSchreierTreeForward
(3.1-16) and TraceSchreierTreeBack
(3.1-17). A Schreier tree needs two additional machine words of memory per point in the orbit. The opt.schreier
flag is automatically set when a stabiliser is computed during orbit enumeration (see components opt.permgens
and opt.matgens
).
schreiergenaction
The value of this component must be a function with 4 arguments: the orbit object, an index i, an integer j, and an index pos. It is called, whenever during the orbit enumeration generator number j was applied to point number i and the result was an already known point with number pos. The function has to return true
or false
. The former case is used internally and triggers the evaluation of some conditions for stabiliser computations. Simply return false
if you do not want this to happen.
Once the component stabcomplete
is set to true
during the orbit computation (which happens when there is evidence that the stabiliser is already completely determined), no more calls to schreiergenaction
happen.
This component is mainly used internally when the permgens
component was set and the stabiliser is calculated.
seeds
In this component you can specify a list of additional seed points, which are appended to the orbit before the enumeration starts.
stab
This component is used to tell the orbit enumerator that a subgroup of the stabiliser of the starting point is already known. Store a subgroup of the group generated by the permutations in opt.permgens
stabilising the starting point into this component.
stabchainrandom
This value can be a positive integer between 1 and 1000. If opt.permgens
is given, an integer value is used to set the random
option when calculating a stabiliser chain to compute the size of the group generated by the Schreier generators. Although this size computation can be speeded up considerably, the user should be aware that for values smaller than 1000 this triggers a Monte Carlo algorithm that can produce wrong results with a certain error probability. A verification of the obtained results is advisable. Note however, that such computations can only err in one direction, namely underestimating the size of the group.
stabsizebound
Possible values for this component are positive integers. The given number must be an upper bound for the size of the stabiliser. Giving this number helps the orbit enumeration to stop earlier, when also opt.orbsizebound
or opt.grpsizebound
are given or when opt.onlystab
is set.
storenumbers
This boolean flag decides, whether the positions of points in the orbit are stored in the hash. The memory requirement for this is one machine word (4 or 8 bytes depending on the architecture) per point in the orbit. If you just need the orbit itself this is not necessary. If you however want to find the position of a point in the orbit efficiently after enumeration, then you should switch this on. That is, the operation \in
is always fast, but Position(orb, point)
is only fast if opt.storenumbers
was set to true
or the orbit is permutations acting on positive integers
. In the latter case this flag is ignored.
For some examples using these options see Chapter 11.
The following components are bound in an orbit object. There might be some more, but those are implementation specific and not guaranteed to be there in future versions. Note that you have to access these components using the
dot exclamation mark notation and you should avoid using these if at all possible..~
depth
and depthmarks
If the orbit has either a Schreier tree or a log, then the component depth
holds its depth, that is the maximal number of generator applications needed to reach any point in the orbit. The corresponding component depthmarks
is a list of indices, at position i it holds the index of the first point in the orbit in depth i in the Schreier tree.
gens
The list of group generators.
ht
If the orbit uses a hash table it is stored in this component.
op
The operation function.
orbind
If generators have been added to the orbit later then the order in which the points are actually stored in the orbit might not correspond to a breadth first search. To cover this case, the component orbind
contains in position i the index under which the i-th point in the breadth-first search using the new generating set is actually stored in the orbit.
schreiergen
and schreierpos
If a Schreier tree of the orbit was kept then both these components are lists containing integers. If point number i was found by applying generator number j to point number p then position i of schreiergen
is j and position i of schreierpos
is p. You can use the operations TraceSchreierTreeForward
(3.1-16) and TraceSchreierTreeBack
(3.1-17) to compute words in the generators using these two components.
tab
For an orbit in which permutations act on positive integers this component is bound to a list containing in position i the index in the orbit, where the number i is stored.
The following operations help to ask additional information about orbit objects:
‣ StabWords ( orb ) | ( operation ) |
Returns: A list of words
If the stabiliser was computed during the orbit enumeration, then this function returns the stabiliser generators found as words in the generators. A word is a sequence of integers, where positive integers stand for generators and negative numbers for their inverses.
‣ PositionOfFound ( orb ) | ( operation ) |
Returns: An integer
If during the orbit enumeration the option lookingfor
was used and the orbit enumerator looked for something, then this operation returns the index in the orbit, where the something was found most recently.
‣ UnderlyingPlist ( orb ) | ( operation ) |
Returns: An plain list
This returns the current elements in the orbit represented by orb as a plain list. This is guaranteed to be a very fast operation using only constant time. However, it does give you a part of the internal data structure of orb. Note that it is not allowed to change the resulting list in any way because that would corrupt the data structures of the orbit.
‣ DepthOfSchreierTree ( orb ) | ( operation ) |
Returns: An integer
If a Schreier tree or a log was stored during orbit enumeration, then this operation returns the depth of the Schreier tree.
‣ IsGradedOrbit ( orb ) | ( filter ) |
Returns: true
or false
If the option gradingfunc
has been used when creating the orbit object, then a grade
is computed for every point in the orbit. In this case the orbit object lies in this filter. The list of grades can then be queried using the Grades
(3.1-11) operation below.
‣ Grades ( orb ) | ( operation ) |
Returns: a list of grades
If the option gradingfunc
has been used when creating the orbit object, then a grade
is computed for every point in the orbit. This operation retrieves the list of grades from the orbit object orb. Note that this is in general a mutable list which must not be changed. It needs to be mutable if the orbit enumeration goes on and this operation does not copy it for efficiency reasons.
‣ OrbitGraph ( orb ) | ( operation ) |
Returns: a list of lists
The vertices of the orbit graph are the points of the orbit and the (directed) edges are given by the generators acting. So if a generator g maps point a to b then there is a directed edge from the vertex a to the vertex b. This operation returns the orbit graph can in the following format: The result is a list of equal length as the orbit. Each entry (corresponding to a point in the orbit) contains a list of orbit point numbers, one for each generator used for the orbit enumeration. That is, position [i][j] in the list contains the number in the orbit of the image of orbit point number i under the generator with number j.
Note that if the gradingfunc
and onlygrades
options are used some entries in these lists can be unbound. This shows that some edges of the complete orbit graph leave the part of the orbit which has been enumerated by the grade restriction.
‣ OrbitGraphAsSets ( orb ) | ( operation ) |
Returns: a list of sets
This operation returns the same graph as OrbitGraph
(3.1-12) in a slightly different format. The neighbours of a point are reported as a set of numbers rather than as a tuple. That is, position [i] of the resulting lists is the set of numbers of the (directed) neighbours of point number i.
We present a few more operations one can do with orbit objects. One can express the action of a given group element in the group generated by the generators given in the Orb
command on this orbit as a permutation:
‣ ActionOnOrbit ( orb, grpels ) | ( operation ) |
Returns: A permutation or fail
orb must be an orbit object and grpels a list of group elements acting on the orbit. This operation calculates the action of grpels on orb as GAP permutations, where the numbering of the points is in the same order as the points have been found in the orbit. Note that this operation is particularly fast if the orbit is an orbit of a permutation group acting on positive integers or if you used the option storenumbers
described in Subsection 3.1-4.
‣ OrbActionHomomorphism ( g, orb ) | ( operation ) |
Returns: An action homomorphism
The argument g must be a group and orb an orbit on which g acts in the action of the orbit object. This operation returns a homomorphism into a permutation group acquired by taking the action of g on the orbit.
‣ TraceSchreierTreeForward ( orb, nr ) | ( operation ) |
Returns: A word in the generators
orb must be an orbit object with a Schreier tree, that is, the option schreier
must have been set during creation, and nr must be the number of a point in the orbit. This operation traces the Schreier tree and returns a word in the generators that maps the starting point to the point with number nr. Here, a word is a list of positive integers which are numbers of generators of the orbit.
‣ TraceSchreierTreeBack ( orb, nr ) | ( operation ) |
Returns: A word in the generators
orb must be an orbit object with a Schreier tree, that is, the option schreier
must have been set during creation, and nr must be the number of a point in the orbit. This operation traces the Schreier tree and returns a word in the inverses of the generators that maps the point with number nr to the starting point. As above, a word is here a list of positive integers which are numbers of inverses of the generators of the orbit.
‣ ActWithWord ( gens, w, op, p ) | ( operation ) |
Returns: A point
gens must be a list of group generators, w a list of positive integers less than or equal to the length of gens, op an action function and p a point. This operation computes the action of the word w in the generators gens on the point p and returns the result.
‣ EvaluateWord ( gens, w ) | ( operation ) |
Returns: A group element
gens must be a list of group generators, w a list of positive integers less than or equal to the length of gens. This operation evaluates the word w in the generators gens and returns the result.
‣ AddGeneratorsToOrbit ( orb, l[, p] ) | ( operation ) |
Returns: The orbit object orb
orb must be an orbit object, l a list of new generators and, if given, p must be a list of permutations of equal length. p must be given if and only if the component permgens
was specified upon creation of the orbit object. The new generators are appended to the old list of generators. The orbit object is changed such that it then shows the outcome of a breadth-first orbit enumeration with the new list of generators. Note that the order of the points already enumerated will not be changed. However, the Schreier tree changes, the component orbind
is changed to indicate the order in which the points were found in the breadth-first search with the new generators and the components depth
and depthmarks
are changed.
Note that all this is particularly efficient if the orbit has a log. If you add generators to an orbit with log, the old generators do not have to be applied again to all points!
Note that new generators can actually enlarge an orbit if they generate a larger group than the old ones alone. Note also that when adding generators, the orbit is automatically enumerated completely
‣ MakeSchreierTreeShallow ( orb[, d] ) | ( operation ) |
Returns: nothing
The argument orb must be a closed orbit object with a log and a Schreier tree, that is, the options log
and schreier
must have been set to true during creation.
Uses AddGeneratorsToOrbit
(3.1-20) to add more generators to the orbit in order to make the Schreier tree shallower. If d it is given, generators are added until the depth is less than or equal to d or until three more generators did not reduce the depth any more. If d is not given, then the logarithm to base 2 of the orbit length is taken as a default value.
‣ FindSuborbits ( orb, subgens[, nrsuborbits] ) | ( operation ) |
Returns: A record
The argument orb must be a closed orbit object with a Schreier vector, subgens a list of generators for a subgroup of the originally acting group. If given, nrsuborbits must be a lower limit for the number of suborbits.
The returned record describes the suborbit structure of orb with respect to the group generated by subgens using the following components: issuborbitrecord
is bound to true
, o
is bound to orb, nrsuborbits
is bound to the number of suborbits and reps
is a list of length nrsuborbits
containing the index in the orbit of a representative for each suborbit. Likewise, words
contains words in the original group generators of the orbit that map the starting point of the orbit to those representatives. lens
is a list containing the lengths of the suborbits. The component suborbs
is bound to a list of lists, one for each suborbit containing the indices of the points in the orbit. The component suborbnr
is a list with the same length as the orbit, containing in position i the number of the suborbit in which point i in the orbit is contained.
Finally, the component conjsuborbit
is bound to a list of length nrsuborbits
, containing for each suborbit the number the suborbit reached from the starting point by the inverse of the word used to reach the orbit representative. This latter information probably only makes sense when the subgroup generated by subgens is contained in the point stabiliser of the starting point of the orbit, because then this is the so-called conjugate suborbit of a suborbit.
‣ OrbitIntersectionMatrix ( r, g ) | ( operation ) |
Returns: An integer matrix
The argument r must be a suborbit record as returned by the operation FindSuborbits
(3.1-22) above, describing the suborbit structure of an orbit with respect to a subgroup. g must be an element of the acting group. If k is the number of suborbits and the suborbits are O_1, ..., O_k, then the matrix returned by this operation has the integer |O_i ⋅ g ∩ O_j| in its (i,j)-entry.
‣ ORB_EstimateOrbitSize ( gens, pt, op, L, limit, timeout ) | ( function ) |
Returns: fail
or a record
The argument gens is a list of group generators for a group G, the argument pt a point and op and action function for a group action of G acting on points like pt. This function starts to act with random elements of G on pt producing random elements of the orbit pt*G and uses the birthday paradox to estimate the orbit size. To this end it creates points of the orbit until L coincidences (points found twice) have been found. If before this happens limit tries have been reached or if more than timeout milliseconds have ellapsed, the function gives up and returns fail
. Otherwise it estimates the orbit size giving an estimate in the component estimate
, a confidence interval described by the components lowerbound
and upperbound
, a list of generators for the stabiliser in the component Sgens
and the number of coincidences that were caused by picking the same group element. The length of Sgens
is L-grpcoinc
. Use at least 15 for L, otherwise the statistics are not valid.
generated by GAPDoc2HTML