Skip to main content

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.

Graph of benchmarking data

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

  • pytest to run unit tests

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ttgen-1.0.2.tar.gz (17.2 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ttgen-1.0.2-py3-none-any.whl (3.8 kB view details)

Uploaded Python 3

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

Hashes for ttgen-1.0.2.tar.gz
Algorithm Hash digest
SHA256 6523acab38453e9066d0995b4c065b12deb625af2920b2882b8deabb6359aa06
MD5 8818b9f4c8ce61e93b8a4641fd2cec9e
BLAKE2b-256 06729c9424ebbafb3d18bf9b392c934a8a45cf9bb07c431cda069831522db0d3

See more details on using hashes here.

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

Hashes for ttgen-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 fef2b28f1a1e71514a094d428c3eca3bb7b80d7d3231f5e422088c6d143549c8
MD5 14e6cbc929ad0228c5ead7fca121a90d
BLAKE2b-256 0c75690cc6d44637039f007d5c5d2a22deb5314edbc375b45ab092df67eec900

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page