Skip to main content

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) == '='

PoSet must be a DAG. For large posets we encourage batching via from_chains over many small add() calls.

Release files for hasse 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for hasse 0.2.0
File Size Uploaded
hasse-0.2.0.tar.gz 2.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for hasse 0.2.0
File Interpreter ABI Platform
hasse-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 6.4 kB

Release files / hasse-0.2.0.tar.gz

Download URL hasse-0.2.0.tar.gz
Size 2.9 kB
Tags Source
SHA-256 checksum
How to use checksums
4d21df7a57551e6f2af615d12a6cee75bf5d988f7b9a4d2a91e0a22d80374718
BLAKE2b-256 checksum
How to use checksums
aa0933f8a0179c110a2d4512dc37f0a93d3ad0fab4e22de9a0c55759e62add73
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.2 CPython/3.12.3 Linux/6.15.1

Release files / hasse-0.2.0-py3-none-any.whl

Download URL hasse-0.2.0-py3-none-any.whl
Size 3.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
62771aa1dbbf70b57d6e19cab0c816aa700a12d83405b15e598580ac093b7d1f
BLAKE2b-256 checksum
How to use checksums
4e559c20e42e47615fba1ef1b1097b43a5ef5424047cfe53f371c12845802ad9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.2 CPython/3.12.3 Linux/6.15.1

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page