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 hashes)

Uploaded Source

Built Distribution

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

Uploaded Python 3

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