permutation-cycle-decomposer v1.0.5
PERMUTATION CYCLE DECOMPOSER
A simple and efficient JavaScript function to decompose a permutation into disjoint cycles. This utility can be used in various mathematical, combinatorial, or algorithmic applications where permutations need to be expressed as disjoint cycles.
Installation
To install the package, run the following command:
npm install permutation-cycle-decomposer
Installation
Once installed, you can require the package and use the decomposePermutation function in your JavaScript project.
Example
const decomposePermutation = require('permutation-cycle-decomposer');
const cycles = ['5234', '135', '437'];
const result = decomposePermutation(cycles);
console.log(result); // Output: "(1 7 4)(2 5)"
API
<decomposePermutation(cycles)> Decomposes a given set of permutation cycles into disjoint cycles.
Parameter
cycles (string[]) - An array of strings where each string represents a cycle, e.g., '5234', '135', '437'
Returns
string - A string representing the decomposition of the permutation into disjoint cycles, e.g., "(1 7 4)(2 5)"
License
This project is licensed under the MIT License - see the LICENSE file for details.
Authors
Gábor Soltész-Kéri