Efficient algorithm for generating all unique k-combinations of a set with duplicates, based on the algorithm by Tadao Takaoka (2015, O(1) Time Generation of Adjacent Multiset Combinations)
Project description
TTGen
Efficient algorithm for generating all unique k-combinations of a set with duplicates, based on the algorithm by Tadao Takaoka (2015, O(1) Time Generation of Adjacent Multiset Combinations).
This is a pure Python implementation of the Pascal code provided by Tadao Takaoka in the linked article.
Performance
This implementation provides incredible speed-up compared to the default itertools implementation when generating multiset combinations with many duplicated elements (up to 5000× speed-up in the best tested case).
For cases where all elements are distinct, the default itertools implementation is consistently faster.
Installation
Via pip
pip install ttgen
Locally for development via
pip install -e .[dev]
Publishing
Remember to increment the version number in pyproject.toml first.
python -m build
python -m twine upload dist/ttgen-X.Y.Z*
Maintenance
pytestto run unit tests
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ttgen-1.0.2.tar.gz.
File metadata
- Download URL: ttgen-1.0.2.tar.gz
- Upload date:
- Size: 17.2 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6523acab38453e9066d0995b4c065b12deb625af2920b2882b8deabb6359aa06
|
|
| MD5 |
8818b9f4c8ce61e93b8a4641fd2cec9e
|
|
| BLAKE2b-256 |
06729c9424ebbafb3d18bf9b392c934a8a45cf9bb07c431cda069831522db0d3
|
File details
Details for the file ttgen-1.0.2-py3-none-any.whl.
File metadata
- Download URL: ttgen-1.0.2-py3-none-any.whl
- Upload date:
- Size: 3.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fef2b28f1a1e71514a094d428c3eca3bb7b80d7d3231f5e422088c6d143549c8
|
|
| MD5 |
14e6cbc929ad0228c5ead7fca121a90d
|
|
| BLAKE2b-256 |
0c75690cc6d44637039f007d5c5d2a22deb5314edbc375b45ab092df67eec900
|