bsym.permutations
- bsym.permutations.number_of_unique_permutations(seq: list) int[source]
Calculate the number of unique permutations of a sequence seq.
- Parameters:
seq (list) – list of items.
- Returns:
The number of unique permutations of seq
- Return type:
int
- bsym.permutations.unique_permutations(seq: Sequence[T]) Generator[tuple[T, ...], None, None][source]
Yield only unique permutations of seq in an efficient way.
A python implementation of Knuth’s “Algorithm L”, also known from the std::next_permutation function of C++, and as the permutation algorithm of Narayana Pandita.