RoaringRel
RoaringRel is a low-level mutable data structure for finite relations R ⊆ X₁ × ... × Xₙ between finite sets, built on 64-bit roaring bitmaps.
It presumes that the component sets X₁,...,Xₙ are zero-based contiguous integer ranges Xⱼ = {0,...,sⱼ-1}: the tuple (s₁,...,sₙ) of component set sizes is the shape of the relation, and the tuples (x₁,...,xₙ) ∈ R are its entries.
Install
You can install the latest release from PyPI as follows:
$ pip install roaringrel
Usage
All functionality of the library is accessible from the Rel class, which is created from a shape and, optionally, some initial entries:
>>> from roaringrel import Rel
>>> r = Rel((2, 3, 4), [(0, 0, 0), (1, 1, 1), (1, 2, 3)])
>>> len(r)
3
>>> (0, 0, 0) in r
True
Relations behave as sets of entries, supporting the usual binary operators (&, |, ^, -), their in-place counterparts, containment comparison, and entry-wise mutation via add, remove and flip.
Because this is a low-level structure aimed at performance-critical code, entries are normalised rather than validated: out-of-range elements wrap around modulo their component set size, and no method rejects an entry.
This cannot corrupt a relation — every entry normalises into a valid slot — but it does mean that an out-of-range entry silently addresses a different one.
Use the validate_entry method where that tradeoff is not acceptable; it is never called internally, so validation costs nothing unless you ask for it.
For an overview of library features and usage, see the getting started guide.
Project structure
roaringrel/— the library itself, a single module defining theRelclass along with theShapeandEntrytype aliases.test/— the test suite, run withpytest.docs/— the Sphinx documentation sources, together with the scripts used to generate the API documentation.autodoc_typehints.py— a custom Sphinx extension which renders type hints in the API documentation.
API
For the full API documentation, see https://roaringrel.readthedocs.io/.
License
Metadata
Release files for roaringrel 1.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| roaringrel-1.1.0.tar.gz | 23.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| roaringrel-1.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 45.8 kB
Release files / roaringrel-1.1.0.tar.gz
| Download URL | roaringrel-1.1.0.tar.gz |
|---|---|
| Size | 23.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7d57254205ed0b2d807a83803dc5fdddb5721d71877442e59603a2cabd53615c
|
|
BLAKE2b-256 checksum How to use checksums |
ebf08cbd48b4033197a89c1cbb8b6937542db43aa5a891f3f00e7dd6f28d0add
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.14
|
Release files / roaringrel-1.1.0-py3-none-any.whl
| Download URL | roaringrel-1.1.0-py3-none-any.whl |
|---|---|
| Size | 22.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
db2fd2d3a1bea6987560c7f1587a956c351f8101c3bde5039588fee887a4086b
|
|
BLAKE2b-256 checksum How to use checksums |
c0c7e31f209c2cbc452568729ee05e745bf43f63b875ffa1e5a07f70e6dfe0b4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.14
|