Succinct, compact, and compressed data structures for data-intensive applications
Project description
Succinct
Succinct, compact, and compressed data structures for data-intensive applications.
Notable features
-
State of the art broadword select implementation based on Sebastiano Vigna's fastutil library.
-
"Space-Efficient, High-Performance Rank and Select Structures on Uncompressed Bit Sequences" that supports bit arrays with up to
2^64
bits. This is a data structure that endows Python's bitarray data structure with the following operations:-
rank(i: int) -> int
: The number of one bits to the left of, and including, thei
th position. -
rank_zero(i: int) -> int
: The number of zero bits to the left of, and including, thei
th position. -
select(bit_rank: int) -> int
: The index of the left-most bit in thebitarray
whose rank isbit_rank
. -
select_zero(bit_rank_zero: int) -> int
: The index of the left-most bit in thebitarray
whose rank_zero isbit_rank
. The current implementation ofselect_zero
is not as efficient as the implementation ofselect
, as it uses a binary search overrank_zero
rather than a sophisticated data structure. This may change in the future.
-
-
Elias-Fano representation of monotone sequences of natural numbers. Using this encoding, "an element occupies a number of bits bounded by two plus the logarithm of the average gap" (source). This can be an excellent data structure for representing lists of monotonically-increasing natural numbers. Applications include inverted indexes, pointers into massive arrays, etc. See this blog post for more information.
-
Compressed bit array representations supporting
rank
,rank_zero
,select
, andselect_zero
:-
CompressedRunsBitArray
: A compressed bit array representation that is effective for compactly representing bit sequences consisting of many runs of consecutive 1s and 0s (i.e., low first-order entropy). It supports reasonably performantselect
andselect_zero
, and currently supports a less-performant but correctrank
andrank_zero
operations. Future work will make them all faster. This data structure is described in Section 4.4.3 "Bitvectors with Runs" of Gonzalo Navarro's Compact Data Structures book. -
EliasFanoBitArray
: A compressed bit array representation that uses Elias-Fano representation of monotone sequences of natural numbers to store the locations of 1 bits in sparse bit sequences. It supportsrank
,rank_zero
,select
, andselect_zero
. This is described in Section 4.3 "Very Sparse Bitvectors" of Gonzalo Navarro's Compact Data Structures book. (NOTE: Some implementation details vary from the description in the book.) -
RunLengthEncodedBitArray
: A compressed bit array representation using rudimentary run-length encoding to encode intervals of contiguous runs of 1's.
-
-
"On Compressing Permutations and Adaptive Sorting" by Barbay and Navarro, which can be very useful for maintaining massive permutations in memory while allowing efficient inverse lookups. This data structure is most useful when the permutation consists of many runs of increasing values.
-
LOUDS representation of binary tree topology, using (in theory) slightly more than two bits per tree node while providing efficient tree navigation.
-
(In progress)
StringIndex
: A potentially novel (research TBD) compressed succint string self-index capable of representing multisets of strings. You can think of it as a compression algorithm that provides random access to any string in the multiset, where the index of each string is defined according to an implicit minimal perfect hash function. Preliminary experiments indicate that it achieves space savings that are comparable togzip
compression; index sizes are within 1.5x to 4x the size of the gzipped text.Future work will improve the runtime performance of the index, as well as add search operations that one would expect from a succinct string self-index. This Python implementation is based on a never-released Scala prototype that I made several years ago, which does feature those operations.
Installation
At the command line:
$ pip install succinct
Alternatively, you can install succinct
from source by cloning this repo and running the provided setup.sh
script.
Version History
0.0.7: (Release 9/24/2020)
-
Fix bug in
Poppy.select
that was due to accidentally truncating the binary search within 64-byte basic blocks. The unit testtest_select_binary_search_bug_is_not_present_2020_09_06
was added to witness the bug fix. -
Added the compressed bit sequence data structures
RunLengthEncodedBitArray
,EliasFanoBitArray
, andCompressedRunsBitArray
. -
Sprinkled some assertions throughout the codebase for good measure.
-
Added the (work in progress)
StringIndex
succinct string self-index data structure. Correctness and compactness appear to be good, but some performance tuning is in order. Stick around to see what the future holds. I have big plans for this data structure. -
Allow
EliasFano
constructor to take a prescribed number of bits to use for recording lower-order bits in a special bit vector. Changing this value for a given bit vector may result in better compression ratios.
Statement of public good
This project is made possible by The Mathematics and Informatics Institute of Ohio. The author gratefully acknowledges Root Insurance Company for providing 12 "hack days" per year for engineers to work on projects such as this one.
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
File details
Details for the file succinct-0.0.7.tar.gz
.
File metadata
- Download URL: succinct-0.0.7.tar.gz
- Upload date:
- Size: 17.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.7.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 692b51bfad6c5371b576153cdae1d90b81ef60593ad012fa8e7534c8e9ba3447 |
|
MD5 | e780d9f5f68250a759b8750f27b9fb12 |
|
BLAKE2b-256 | f55b8433b60677b8be3b152c97397fdcdfde065b9a6816d823bfa8625c7388b4 |