Registry / devops / permutation

permutation

JSON →
library0.5.0pypypi✓ verified 79d ago

Library for generating and manipulating permutations of finitely many positive integers. Current version 0.5.0, updated occasionally.

pip install permutation
INSTALL
IMPORT
SIG · PERMUTATION
P
permutation
devopspythonv0.5.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Permutation
from permutation import Permutation
from permutation import Perm

Create and manipulate permutations using Perm class. Perm accepts values 1..n in order of images.

from permutation import Perm p = Perm(2, 3, 1) print(p) # (2 3 1) print(list(p)) # [2, 3, 1] print(len(p)) # 3 q = Perm(1, 3)(2, 4) print(q) # (1 3)(2 4) print(p * q) # composition print(~p) # inverse
Debug
Known issues
gotchaPerm constructor expects a list of images for 1..n, not cycle notation. For cycles use separate Perm objects and multiply.
fix
Use Perm(2,3,1) to get the permutation mapping 1→2, 2→3, 3→1. For cycles use Perm(1,3) to denote transposition (1 3).
affects: all
gotchaPerm objects are 1-indexed. The domain is positive integers from 1 to n. Do not include 0.
fix
Ensure all inputs are positive integers starting from 1.
affects: all
gotchaMultiplication order: p * q means apply q first, then p (left-to-right convention).
fix
Be consistent with notation. In many textbooks permutations are applied right-to-left; this library uses left-to-right.
affects: all
gotchaThe library provides limited support for large degrees; performance may degrade with large n.
fix
For combinatorial algorithms with many permutations, consider specialized libraries.
affects: all
Upgrade
Version history
0.5.0latest on PyPI · released Dec 1, 2024
Audit
Dependencies

No dependency data recorded yet.

Agent activity
12 hits · last 30 days
node
12
Resources

No resource links recorded.

permutation — pip install permutation · libregistry