Members
globalRepo :PermutationRepository
- Description:
Singleton instance of the PermutationRepository. All permutation operations should typically go through this global instance to ensure consistent ID management and memory optimization.
- Source:
Singleton instance of the PermutationRepository. All permutation operations should typically go through this global instance to ensure consistent ID management and memory optimization.
Type:
Methods
analyzeGenerators(candidateIds) → {Object}
- Description:
Analyzes a list of candidate generators to determine a minimal (fundamental) generating set. It uses the Schreier-Sims Algorithm to identify and separate redundant generators.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
candidateIds |
Array.<number> | PermutationSet | An array of permutation IDs that are potential generators. |
Returns:
An object containing:
fundamental: An array of permutation IDs that form a minimal generating set.redundant: An array of permutation IDs that are generated by thefundamentalset.ssa: TheSchreierSimsAlgorithminstance computed from thefundamentalgenerators.
- Type
- Object
areIsomorphic(groupA, groupB) → {number}
- Description:
Heuristically checks if two groups
groupAandgroupBare isomorphic. This function compares structural invariants (order, abelian-ness, derived series length). It cannot definitively prove isomorphism without constructing an explicit isomorphism map, but it can reliably prove non-isomorphism and provide a strong indication for isomorphism.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
groupA |
PermutationSet | SchreierSimsAlgorithm | The first group. |
groupB |
PermutationSet | SchreierSimsAlgorithm | The second group. |
Returns:
1 (Isomorphic, if strictly proven - rare), 0 (Not isomorphic, strictly proven), -1 (Uncertain - heuristically likely isomorphic but not strictly proven).
- Type
- number
calcApproxOrder(perm, limitopt) → {number}
- Description:
Computes an approximate order of a permutation by finding the LCM of its cycle lengths. If the order exceeds limit, it returns limit+1 as a sentinel value.
- Source:
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
perm |
* | The permutation array. |
||
limit |
number |
<optional> |
60
|
The upper limit for the order. |
Returns:
- The approximate order of the permutation.
- Type
- number
createAlternating(n) → {PermutationSet}
- Description:
Creates generators for the Alternating Group A_n. Contains even permutations. Order: n! / 2.
Generators used: 3-cycles of the form (1 2 i) for i = 3..n [0-based: (0 1 i) for i=2..n-1].
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
n |
number | The degree. |
Returns:
A set containing n-2 generators.
- Type
- PermutationSet
createCyclic(n) → {PermutationSet}
- Description:
Creates generators for the Cyclic Group C_n. Order: n.
Generator used: One cycle (1 2 ... n) [0-based: (0 1 ... n-1)].
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
n |
number | The degree. |
Returns:
A set containing 1 generator.
- Type
- PermutationSet
createDihedral(n) → {PermutationSet}
- Description:
Creates generators for the Dihedral Group D_n. Symmetries of a regular n-gon. Order: 2n.
Generators used:
- Rotation r: (1 2 ... n)
- Reflection s: Fixes 1, maps k -> n-k+2 (mod n check) 0-based logic: Fixes 0, Maps k -> -k mod n.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
n |
number | The number of vertices. |
Returns:
A set containing 2 generators.
- Type
- PermutationSet
createDirectProduct(groupA, groupB, …extraGroups) → {PermutationSet}
- Description:
Creates the Direct Product of two groups: G x H. The resulting group acts on disjoint sets of points. Degree = Degree(G) + Degree(H).
- Source:
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
groupA |
PermutationSet | Generators for group G. |
|
groupB |
PermutationSet | Generators for group H. |
|
extraGroups |
PermutationSet |
<repeatable> |
Additional groups to include in the direct product. |
Returns:
Generators for G x H.
- Type
- PermutationSet
createFromCycleStrings(cyclesStrArr, degreeopt) → {PermutationSet}
- Description:
Creates a generator set from a list of cycle strings. Convenient wrapper for parsing multiple permutations and registering them.
- Source:
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
cyclesStrArr |
Array.<string> | Array of strings, e.g. ["(1 2 3)", "(1 2)"]. |
||
degree |
number |
<optional> |
0
|
Force a specific degree. If 0, auto-detected per string (max). |
Returns:
The set of generators.
- Type
- PermutationSet
createFromRawArrays(arrays) → {PermutationSet}
- Description:
Creates a group from raw integer arrays. Registers each raw permutation array into the global repository and returns a PermutationSet of their IDs. Useful for loading from JSON or UI input.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
arrays |
Array.<(Int32Array|Array.<number>)> | An array of raw permutation arrays (e.g., |
Returns:
A PermutationSet containing the registered permutation IDs.
- Type
- PermutationSet
createIcosahedral() → {PermutationSet}
- Description:
Icosahedral Group (Rotations of a regular icosahedron). Isomorphic to A5. Order 60.
- Source:
Returns:
A PermutationSet representing the generators of the Icosahedral Group.
- Type
- PermutationSet
createKleinFour() → {PermutationSet}
- Description:
Creates generators for the Klein Four-Group V_4. A subgroup of S_4 isomorphic to C_2 x C_2. Order: 4.
Generators used:
- (1 2)(3 4) [0-based: (0 1)(2 3)]
- (1 3)(2 4) [0-based: (0 2)(1 3)]
- Source:
Returns:
A set containing 2 generators on 4 points.
- Type
- PermutationSet
createOctahedral() → {PermutationSet}
- Description:
Octahedral Group (Rotations of a regular octahedron). Isomorphic to S4. Order 24.
- Source:
Returns:
A PermutationSet representing the generators of the Octahedral Group.
- Type
- PermutationSet
createQuaternion() → {PermutationSet}
- Description:
Creates generators for the Quaternion Group Q8. Order: 8. Non-abelian. Defined via Regular Representation in S8. Elements: {1, i, j, k, -1, -i, -j, -k}
- Source:
Returns:
- Type
- PermutationSet
createSymmetric(n) → {PermutationSet}
- Description:
Creates generators for the Symmetric Group S_n. Contains all n! permutations of n elements.
Generators used:
- Transposition (1 2) [0-based: (0 1)]
- Long Cycle (1 2 ... n) [0-based: (0 1 ... n-1)]
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
n |
number | The degree (number of points). |
Returns:
A set containing the generators.
- Type
- PermutationSet
createTetrahedral() → {PermutationSet}
- Description:
Tetrahedral Group (Rotations of a regular tetrahedron). Isomorphic to A4. Order 12.
- Source:
Returns:
A PermutationSet representing the generators of the Tetrahedral Group.
- Type
- PermutationSet
createTrivial() → {PermutationSet}
- Description:
Creates the Trivial Group (Identity).
- Source:
Returns:
- Type
- PermutationSet
decomposeToCycles(perm) → {string}
- Description:
Decomposes a permutation into disjoint cycle notation string. Uses 1-based indexing for the output string.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
perm |
number | Int32Array | Array.<number> | Permutation ID (in globalRepo) or raw array. |
Returns:
Cycle notation, e.g., "(1 2 3)(4 5)". Returns "()" for identity.
- Type
- string
findCoxeterLikeGenerators(inputGenerators, optionsopt) → {PermutationSet}
- Description:
Attempts to find a set of generators that mimic a Coxeter system (strong generating set of involutions).
- Source:
Parameters:
| Name | Type | Attributes | Description | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
inputGenerators |
PermutationSet | Array.<number> | The initial generators defining the group. |
|||||||||||||||||||||
options |
Object |
<optional> |
Configuration options. Properties
|
Returns:
A new set of generators.
- Type
- PermutationSet
findLowOrderGenerators(inputGenerators, maxOrder, maxSearchSizeopt) → {PermutationSet|null}
- Description:
Attempts to find a new set of generators for the group where every generator has an order less than or equal to
maxOrder.It explores the group structure (via BFS) to find candidate elements of low order. If it finds enough low-order elements to generate the original group (verified by SSA), it returns this new set. Otherwise, returns null.
- Source:
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
inputGenerators |
PermutationSet | Array.<number> | The original generators of the group. |
||
maxOrder |
number | The maximum allowed order for the new generators. |
||
maxSearchSize |
number |
<optional> |
50000
|
Limit on the number of group elements to explore during search. |
Returns:
A new PermutationSet if successful, or null if failed.
- Type
- PermutationSet | null
generateCayleyGraphForPlotly(inputIds, customConfigopt, extraGeneratorsopt) → {CayleyGraphData|Object}
- Description:
Generates the graph data structure for a Cayley graph, including nodes, links, and a physics simulator. This function can return either a full data structure for advanced usage or a Plotly-ready frame.
- Source:
- See:
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
inputIds |
Array.<number> | PermutationSet | Array of generator IDs used to construct the group. |
||
customConfig |
Partial.<_CayleyGraphConfig> |
<optional> |
{}
|
Optional physics configuration overrides. |
extraGenerators |
Array.<number> | PermutationSet |
<optional> |
[]
|
Optional additional generators to visualize but exclude from physics forces. |
Throws:
-
If no generators are provided.
- Type
- Error
Returns:
Returns a CayleyGraphData object if config.advancedMode is true, otherwise returns a Plotly-compatible object {data, layout, nameMap}.
- Type
- CayleyGraphData | Object
generateGroup(generators) → {PermutationSet}
- Description:
Generates a subgroup from a set of generator permutations. This method uses an iterative closure approach by repeatedly multiplying the current group by the generators until no new elements are found.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
generators |
PermutationSet | Array.<number> | SchreierSimsAlgorithm | A PermutationSet or an array of permutation IDs or a SchreierSimsAlgorithm instance to generate the group from. |
Throws:
-
If
generatorsis an unknown type. - Type
- Error
Returns:
The fully generated subgroup (isGroup=true).
- Type
- PermutationSet
generateMultiplicationTable(inputIds, nameMapopt) → {Object}
- Description:
Generates a Multiplication (Cayley) Table for a group.
inputIdsare treated as candidate generators. The function will determine a fundamental set of generators, expand the group to all its elements, and generate names for them. The table will represent the full group.return an object A 2D array where
matrix[row][col]is the permutation ID ofrowElement * colElement. A 2D array wheregrid[row][col]is the algebraic name (string) ofrowElement * colElement. A Map where keys are permutation IDs and values are their 1-based cycle notation strings (e.g., "(1 2 3)"). An HTML string representation of the Cayley table with semantic coloring and tooltips.
- Source:
- See:
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
inputIds |
Array.<number> | An array of candidate generator IDs. |
||
nameMap |
Map.<number, string> |
<optional> |
null
|
Optional. A custom map of all permutation IDs to their display names. Use generateNames to generate. |
Throws:
-
If
nameMapis provided in manual mode but is incomplete (missing names forinputIds). - Type
- Error
Returns:
An object containing the generated table data.
- Type
- Object
generateNames(allElementIds, generatorIds, genLabelsopt) → {Map.<number, string>}
- Description:
Generates human-readable algebraic names for all group elements (e.g., 'e', 'a', 'b', 'ab', 'a^2'). This function uses a Breadth-First Search (BFS) approach, starting from the identity and generators, to construct the shortest and most intuitive names based on generator products.
- Source:
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
allElementIds |
Array.<number> | PermutationSet | A sorted list of all unique permutation IDs belonging to the group. |
|
generatorIds |
Array.<number> | PermutationSet | A list of permutation IDs that are the fundamental generators of the group. |
|
genLabels |
Array.<string> |
<optional> |
A list of strings that are the labels for the generators. Default to undefined means to use a,b,c,... |
Returns:
A Map where keys are permutation IDs and values are their corresponding generated algebraic names.
- Type
- Map.<number, string>
getCommutatorSubgroup(group) → {SchreierSimsAlgorithm}
- Description:
Computes the commutator subgroup G' = [G, G] of a group G. This subgroup is generated by all commutators
[g1, g2] = g1^-1 * g2^-1 * g1 * g2forg1, g2in G.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
group |
PermutationSet | SchreierSimsAlgorithm | The group G. |
Returns:
The SchreierSimsAlgorithm instance representing the commutator subgroup.
getLowerCentralSeries(group) → {Array.<SchreierSimsAlgorithm>}
- Description:
Computes the lower central series of a group G. The series is defined recursively as: G_0 = G G_{i+1} = [G_i, G] (the mixed commutator subgroup of G_i and G). The series terminates when G_{i+1} = G_i or G_i = {e}.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
group |
PermutationSet | SchreierSimsAlgorithm | The group G. |
Returns:
An array of SchreierSimsAlgorithm instances, representing the subgroups in the lower central series: [G_0, G_1, ..., G_k].
- Type
- Array.<SchreierSimsAlgorithm>
getMixedCommutatorSubgroup(groupG, subA, subB) → {SchreierSimsAlgorithm}
- Description:
Computes the mixed commutator subgroup
[subA, subB]of two subgroupssubAandsubBwithin a larger groupgroupG. The result is the normal closure of all commutators[a, b](whereais fromsubAandbis fromsubB) within the groupgroupG.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
groupG |
PermutationSet | SchreierSimsAlgorithm | The containing parent group G, used for computing the normal closure. |
subA |
PermutationSet | SchreierSimsAlgorithm | The first subgroup A. |
subB |
PermutationSet | SchreierSimsAlgorithm | The second subgroup B. |
Returns:
The SchreierSimsAlgorithm instance representing the mixed commutator subgroup [A, B].
getNormalClosure(groupG, subsetS) → {SchreierSimsAlgorithm}
- Description:
Computes the normal closure of a subset
subsetSwithin the groupgroupG. The normal closure is the smallest normal subgroup ofgroupGthat containssubsetS. It is generated by all conjugates of elements ofsubsetSby elements ofgroupG.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
groupG |
PermutationSet | SchreierSimsAlgorithm | The containing group G. |
subsetS |
PermutationSet | Array.<number> | number | The subset S (generators, array of IDs, or single ID). |
Returns:
The SchreierSimsAlgorithm instance representing the normal closure.
getQuotientStructure(groupG, normalN, maxIndexopt) → {QuotientGroupMap}
- Description:
Computes the structure of the quotient group G/N, along with a mapping that lifts elements from G/N back to representatives in G. This function is computationally intensive and only feasible for quotient groups with a small index
[G:N].
- Source:
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
groupG |
PermutationSet | SchreierSimsAlgorithm | The group G. |
||
normalN |
PermutationSet | SchreierSimsAlgorithm | The normal subgroup N of G. |
||
maxIndex |
number |
<optional> |
2000
|
The maximum allowed index |
Throws:
-
If N is not a normal subgroup of G, or if
[G:N]exceedsmaxIndex. - Type
- Error
Returns:
An object containing the quotient group (as PermutationSet) and an array of representatives for each coset.
- Type
- QuotientGroupMap
getSylowSubgroup(group, p) → {PermutationSet}
- Description:
Computes a Sylow p-subgroup of a given group G. A Sylow p-subgroup is a maximal p-subgroup of G, with order p^k where p^k divides |G| and p^(k+1) does not. The algorithm uses a randomized greedy approach with restarts.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
group |
PermutationSet | SchreierSimsAlgorithm | The group G for which to find a Sylow p-subgroup. |
p |
number | The prime number p. |
Throws:
-
If the algorithm fails to construct a Sylow p-subgroup within the configured random search limits.
- Type
- Error
Returns:
A PermutationSet containing the generators of a Sylow p-subgroup.
- Type
- PermutationSet
isNilpotent(group) → {number}
- Description:
Checks if a group is nilpotent. A group G is nilpotent if its lower central series terminates at the trivial group {e}. Every nilpotent group is solvable.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
group |
PermutationSet | SchreierSimsAlgorithm | The group G to check for nilpotency. |
Returns:
1 (Nilpotent), 0 (Not Nilpotent).
- Type
- number
isNormal(superGroup, normalN) → {boolean}
- Description:
Checks if
normalNis a normal subgroup ofsuperGroup(N ◁ G). This is verified by checking if for every generatorgofsuperGroupand every generatornofnormalN, the conjugateg * n * g^-1is an element ofnormalN.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
superGroup |
PermutationSet | SchreierSimsAlgorithm | The supergroup G. |
normalN |
PermutationSet | SchreierSimsAlgorithm | The potential normal subgroup N. |
Returns:
True if N is a normal subgroup of G, false otherwise.
- Type
- boolean
isSimple(group, randomTestsopt) → {number}
- Description:
Checks if a group is simple. A group G is simple if its only normal subgroups are the trivial group {e} and G itself. This function uses a probabilistic approach for non-abelian groups and may return "uncertain" for large groups.
- Source:
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
group |
PermutationSet | SchreierSimsAlgorithm | The group G to check for simplicity. |
||
randomTests |
number |
<optional> |
10
|
Number of random conjugates to test for non-abelian groups. Higher values increase confidence but also computation time. |
Returns:
1 (Proven Simple), 0 (Proven Not Simple), -1 (Uncertain - heuristically likely simple but not strictly proven).
- Type
- number
isSolvable(group) → {boolean}
- Description:
Checks if a group is solvable. A group G is solvable if its derived series terminates in the trivial group {e}. The derived series is G^(0) = G, G^(n+1) = [G^(n), G^(n)].
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
group |
PermutationSet | SchreierSimsAlgorithm | The group G to check for solvability. |
Returns:
True if the group is solvable, false otherwise.
- Type
- boolean
isSubgroup(superGroup, subGroup) → {boolean}
- Description:
Checks if
subGroupis a subgroup ofsuperGroup. This is determined by verifying that all generators ofsubGroupare contained withinsuperGroup.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
superGroup |
PermutationSet | SchreierSimsAlgorithm | The potential supergroup G. |
subGroup |
PermutationSet | SchreierSimsAlgorithm | The potential subgroup H. |
Returns:
True if H is a subgroup of G, false otherwise.
- Type
- boolean
parseCycles(str, degreeopt) → {Int32Array}
- Description:
Parses a string in cycle notation into a flat permutation array. Supports standard disjoint cycle notation, e.g., "(1 2 3)(4 5)".
Assumptions:
- Input uses 1-based indexing (standard mathematical notation).
- Output is 0-based Int32Array.
- Source:
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
str |
string | The cycle string (e.g., "(1 2 3)"). |
||
degree |
number |
<optional> |
0
|
The required degree (size) of the permutation. If 0, inferred from max element. |
Returns:
The permutation in array form [p[0], p[1], ...].
- Type
- Int32Array
resetGlobalRepo()
- Description:
Resets the global permutation repository. This function clears all registered permutations and re-initializes
globalRepoto a new empty PermutationRepository instance. Use with caution, as all previously obtained permutation IDs will become invalid.
- Source:
Type Definitions
CayleyGraphData
- Source:
Properties:
| Name | Type | Description |
|---|---|---|
nodes |
Array.<object> | Array of node objects with id, name, x, y, z, vx, vy, vz properties. |
links |
Array.<object> | Array of link objects with source, target, genId, color, order, isDirected properties. |
legend |
Array.<object> | Array of legend objects with label, color, genId properties. |
simulator |
VisualizerCayleyForceSimulator | The force simulator instance. |
config |
_CayleyGraphConfig | The effective physics configuration used. |
nameMap |
Map.<number, string> | the used nameMap |
Type:
- object
_CayleyGraphConfig
- Source:
- See:
Properties:
| Name | Type | Description |
|---|---|---|
d0 |
number | Base distance factor. Used to determine ideal edge length (d0 / order). |
repulsion |
number | Strength of the Coulomb-like repulsive force between all nodes. |
edgeStrength |
number | Spring constant for edges directly connecting elements (Hooke's law). |
chordStrength |
number | Spring constant for 'chord' edges in cycles, maintaining their geometric shape. |
planarStrength |
number | Strength of the force that flattens cycles onto a plane. |
convexityStrength |
number | Strength of the force that pushes nodes away from the center of a cycle, maintaining convexity. |
initialOffsetDist |
number | Magnitude of random initial displacement applied to cycle groups to untangle them during setup. |
decay |
number | Velocity damping factor, reducing oscillation. |
centerPull |
number | Strength of the gravitational force pulling all nodes towards the origin. |
timeStep |
number | Simulation time step for integration. |
jitterMax |
number | Maximum random displacement applied to nodes during the initial annealing phase. |
dynamicAngleUpdateRate |
number | How often (in ticks) to recalculate average angles for chord length adjustment. Set to 0 to disable. |
warmupRuns |
number | Number of simulation ticks to run during the warmup phase for initial layout. |
advancedMode |
boolean | If true, returns detailed simulator objects; otherwise, returns only Plotly frame. |
nameMap |
Map.<number, string> | the nameMap to use for the full group elements. Use generateNames to generate. |
rewriteToStrongGenerators |
boolean | use SSA to rewrite generators to StrongGenerators. |
Type:
- object