Skip to main content

A lightweight Python library for generating and analyzing combinatorial objects.

Project description

combpyter

A lightweight Python library for generating and analyzing combinatorial objects.

Installation

The latest release is simply pip-installable via PyPI. Simply run

pip install combpyter

to install the library.

Features

Please note that this is a personal and mostly research-driven project. As such, the implemented combinatorial structures span, for the time being, a narrow scope.

Currently, combpyter supports the following combinatorial objects:

  • Dyck paths (elements: DyckPath, generator: DyckPaths)

Example usage

This snippet iterates over all Dyck paths of semi-length 8 and computes the distribution of the number of peaks (which is a statistic described by Narayana numbers).

>>> from combpyter import DyckPaths
>>> from collections import defaultdict
>>> peak_distribution = defaultdict(int)
>>> for path in DyckPaths(8):
...     num_peaks = len(path.peaks())
...     peak_distribution[num_peaks] += 1
...
>>> for num_peaks, num_paths in peak_distribution.items():
...     print(f"There are {num_paths} Dyck paths with {num_peaks} peaks.")
...
There are 1 Dyck paths with 1 peaks.
There are 28 Dyck paths with 2 peaks.
There are 196 Dyck paths with 3 peaks.
There are 490 Dyck paths with 4 peaks.
There are 490 Dyck paths with 5 peaks.
There are 196 Dyck paths with 6 peaks.
There are 28 Dyck paths with 7 peaks.
There are 1 Dyck paths with 8 peaks.

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

combpyter-0.0.3.tar.gz (5.2 kB view details)

Uploaded Source

Built Distribution

combpyter-0.0.3-py3-none-any.whl (5.6 kB view details)

Uploaded Python 3

File details

Details for the file combpyter-0.0.3.tar.gz.

File metadata

  • Download URL: combpyter-0.0.3.tar.gz
  • Upload date:
  • Size: 5.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.13 CPython/3.9.10 Linux/5.11.0-1028-azure

File hashes

Hashes for combpyter-0.0.3.tar.gz
Algorithm Hash digest
SHA256 1b134288ce4f30e3b5ad0bec4c88c391e2e57db1b0d0cda3eca041ebbace69da
MD5 80455bcd1d8a6132c9f7142723ab6cd2
BLAKE2b-256 98969f73669ca19807c9f3ef9ecfafc2a3991e6e499b8c71c770ccfbd5c78113

See more details on using hashes here.

File details

Details for the file combpyter-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: combpyter-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 5.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.13 CPython/3.9.10 Linux/5.11.0-1028-azure

File hashes

Hashes for combpyter-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 dcfdd7be97a39b43da0f8bd02f43a36699d8c89e4224eb47c08790e27f5a3e0d
MD5 3d306cc2e30a21b92206699a1869fd44
BLAKE2b-256 52d01a638103d35c1b7429a947310a41b905669c5670cdf4ea14ade0e3afcd3d

See more details on using hashes here.

Supported by

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