Giter VIP home page Giter VIP logo

perms-nim's Introduction

perms-nim

Permutation group calculations and factorization algorithms implemented in Nim. Several modules are provided which can be imported and used independently.

perm implements basic permutation calculations. Various constructors and formatting in cycle notation are provided, as well as conjugation, signature and other basic permutation properties.

permgroup provides data structures for constructing permutation groups by given generators and calculating various simple properties of such groups.

kalka module implements factorization algorithm described in the paper "Short expressions of permutations as products and cryptanalysis of the Algebraic Eraser" by Arkadius Kalka, Mina Teicher and Boaz Tsaban. It is only applicable in the case of full symmetric and alternating groups (S_n, A_n).

minkwitz module implements factorization algorithm invented by Torsten Minkwitz, see "An Algorithm for Solving the Factorization Problem in Permutation Groups".

schreier module implements Schreier-Sims algorithm constructing a BSGS - Base and Strong Generators System for a permutation group. Orbit and stabilizator calculations are included.

Check tests and examples subdirectories for usage scenarios.

Algorithms

Kalka-Teicher-Tsaban algorithm provides generator expressions of length O(n^2 log n) for n generators, which is significantly better than performance of Minkwitz algorithm.

The shortcoming of this approach is that factorization can only be performed in full symmetric or alternating group (S_n or A_n). Otherwise an involution or 3-cycle cannot be found in the first stage of algorithm, and exception will be raised.

See also the book "Permutation group algorithms" by Akos Seress for more information about the topic.

Applications

Main inspiration for this library was to solve certain permutation-based puzzles (similar to Rubik cube). See "Permutation Puzzles: A Mathematical Perspective" for more information.

Examples

  • mixing.nim measures average levels in breadth-first search needed to reach permutation with minimum moving points. Some results with two generators are included as comments at the bottom. It may be helpful for tuning the main factorization algorithm heuristic parameters.

  • rubik_periods.nim shows how to calculate periods of Rubik group permutations given by sequences of generators in standard notation.

  • rubik_mini1.nim shows a simple factorization in Mini Rubik (Pocket Rubik) group.

perms-nim's People

Contributors

remigijusj avatar sameuser2 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.