Python library for representing Partially Ordered sets via Hasse Diagrams.
Project description
hasse
Python library for representing Partially Ordered sets via Hasse Diagrams.
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.
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
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 hasse-0.2.0.tar.gz.
File metadata
- Download URL: hasse-0.2.0.tar.gz
- Upload date:
- Size: 2.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.2 CPython/3.12.3 Linux/6.15.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4d21df7a57551e6f2af615d12a6cee75bf5d988f7b9a4d2a91e0a22d80374718
|
|
| MD5 |
5d5376557fe90176cc4fdce0d1984751
|
|
| BLAKE2b-256 |
aa0933f8a0179c110a2d4512dc37f0a93d3ad0fab4e22de9a0c55759e62add73
|
File details
Details for the file hasse-0.2.0-py3-none-any.whl.
File metadata
- Download URL: hasse-0.2.0-py3-none-any.whl
- Upload date:
- Size: 3.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.2 CPython/3.12.3 Linux/6.15.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
62771aa1dbbf70b57d6e19cab0c816aa700a12d83405b15e598580ac093b7d1f
|
|
| MD5 |
024779dc028967b29a0d57d9218d5fd6
|
|
| BLAKE2b-256 |
4e559c20e42e47615fba1ef1b1097b43a5ef5424047cfe53f371c12845802ad9
|