Skip to main content

Python library for representing Partially Ordered sets via Hasse Diagrams.

Project description

hasse

Python library for representing Partially Ordered sets via Hasse Diagrams.

Build Status PyPI version License: MIT

Table of Contents

Installation

If you just need to use hasse, you can just run:

$ pip install hasse

For developers, note that this project uses the poetry python package/dependency management tool. Please familarize yourself with it and then run:

$ poetry install

Usage

hasse is centered around the hasse.PoSet class. An example is given below.

import hasse

poset = hasse.PoSet.from_chains(
    [1, 2, 4],  # 1 < 2 < 4
    [1, 3, 4],  # 1 < 3 < 4
)

# Test membership and size.
assert 2 in poset
assert len(poset) == 4
assert set(poset) == {1,2,3,4}

# Perform pair wise comparison.
assert poset.compare(1, 1) == '='
assert poset.compare(1, 4) == '<'
assert poset.compare(4, 2) == '>'
assert poset.compare(2, 3) == '||'

# Add an edge.
poset2 = poset.add([2, 1])
poset2.compare(1, 2) == '='

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

hasse-0.1.2.tar.gz (3.2 kB view details)

Uploaded Source

Built Distribution

hasse-0.1.2-py3-none-any.whl (3.3 kB view details)

Uploaded Python 3

File details

Details for the file hasse-0.1.2.tar.gz.

File metadata

  • Download URL: hasse-0.1.2.tar.gz
  • Upload date:
  • Size: 3.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.7 CPython/3.9.6 Linux/5.13.5-1-MANJARO

File hashes

Hashes for hasse-0.1.2.tar.gz
Algorithm Hash digest
SHA256 34f8d6b8f5a4bdcd0228d6da43197871f9d82ab551e50c9827d80e189029bd1f
MD5 8e4f955b52627cb6da05d1218dcbe263
BLAKE2b-256 454d667611ae317e24df1c6b141a0004de78f31ff170817d525858e7ffe703e6

See more details on using hashes here.

File details

Details for the file hasse-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: hasse-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 3.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.7 CPython/3.9.6 Linux/5.13.5-1-MANJARO

File hashes

Hashes for hasse-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 ad4f779335dfa6dc1e672c41a7182b0274745c3d1f9c0d9bc0498e661ee05b37
MD5 20baf2d624b20715381f7bcf1779cca3
BLAKE2b-256 ccbc4adb9a1fc36a7d5b92052d49b7a1d4a8cdf9531a1647c13f70a5e2f32b4c

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