Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mikolalysenko/cycle-decomposition
Computes cycle decompositions for permutations
https://github.com/mikolalysenko/cycle-decomposition
Last synced: 6 days ago
JSON representation
Computes cycle decompositions for permutations
- Host: GitHub
- URL: https://github.com/mikolalysenko/cycle-decomposition
- Owner: mikolalysenko
- License: mit
- Created: 2013-03-04T16:44:48.000Z (almost 12 years ago)
- Default Branch: master
- Last Pushed: 2014-05-01T02:33:45.000Z (over 10 years ago)
- Last Synced: 2024-12-16T22:34:50.961Z (9 days ago)
- Language: JavaScript
- Size: 153 KB
- Stars: 2
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
cycle-decomposition
===================
Computes the [cycle decomposition for a permutation](http://en.wikipedia.org/wiki/Cycle_decomposition_%28group_theory%29)# Example
```javascript
console.log(require("cycle-decomposition")([3,2,1,0]))
```Output:
```javascript
[ [0,3], [1,2] ]
```# Install
```
npm install cycle-decomposition
```# API
#### `require("cycle-decomposition")(permutation)`
The main function in this library takes a length n permutation represented as a sequence of integers from 0 to n-1 describing how the permutation acts on a finite set according to the rule `i --> permutation[i]`.* `permutation` is a permutation
**Returns** A list of cycles.
Credits
=======
(c) 2013-2014 Mikola Lysenko. MIT License