cycle-decomposition

1.0.1 • Public • Published

cycle-decomposition

Computes the cycle decomposition for a permutation

Example

console.log(require("cycle-decomposition")([3,2,1,0]))

Output:

[ [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

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.1
    4
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.0.1
    4
  • 1.0.0
    0
  • 0.0.1
    0
  • 0.0.0
    0

Package Sidebar

Install

npm i cycle-decomposition

Weekly Downloads

4

Version

1.0.1

License

MIT

Last publish

Collaborators

  • mikolalysenko