ADS
Algorithms and Data Structures
Loading...
Searching...
No Matches
HuffmanFMIndex.h File Reference

The FM-index on the wavelet tree shaped by the code of Huffman, i.e., the succinct suffix array of Mäkinen and Navarro (beyond the book): the transform \( L \) of Burrows and Wheeler of a text \( s \) of \( n \) bytes as a HuffmanWaveletTree [see HuffmanWaveletTree.h], in \( n ( H_0 + 1 ) ( 1 + o( 1 ) ) \) bits, with the same operations as the FM-index of chapter 14, Block-Sorting Compression, of Ferragina's book [see FMIndex.h], which keeps \( L \) as it is with counts every \( b \) places, \( 8 n + 32 \sigma n / b \) bits. More...

#include "ADS/Contract.h"
#include "ADS/compression/BurrowsWheeler.h"
#include "ADS/external/MappedFile.h"
#include "ADS/succinct/BitVector.h"
#include "ADS/succinct/HuffmanWaveletTree.h"
#include <algorithm>
#include <array>
#include <bit>
#include <cstddef>
#include <cstdint>
#include <string>
#include <string_view>
#include <utility>
#include <vector>
#include "ADS/compression/impl/HuffmanFMIndex.tpp"

Go to the source code of this file.

Classes

class  ADS::HuffmanFMIndex< RS >
 the FM-index of a text on the wavelet tree of Huffman of its transform, with the places of the suffixes at the multiples of \( \mu \) More...

Namespaces

namespace  ADS

Detailed description

The FM-index on the wavelet tree shaped by the code of Huffman, i.e., the succinct suffix array of Mäkinen and Navarro (beyond the book): the transform \( L \) of Burrows and Wheeler of a text \( s \) of \( n \) bytes as a HuffmanWaveletTree [see HuffmanWaveletTree.h], in \( n ( H_0 + 1 ) ( 1 + o( 1 ) ) \) bits, with the same operations as the FM-index of chapter 14, Block-Sorting Compression, of Ferragina's book [see FMIndex.h], which keeps \( L \) as it is with counts every \( b \) places, \( 8 n + 32 \sigma n / b \) bits.

  • count( P ) is the backward search: the rows prefixed by \( c P' \) are \( [ C[ c ] + \mathrm{rank}_c( \mathit{first} ) , C[ c ] + \mathrm{rank}_c( \mathit{last} ) ) \) for the range \( [ \mathit{first} , \mathit{last} ) \) of \( P' \), in \( O( p ( H_0 + 1 ) ) \) steps on average, each one a rank of the bits of the tree;
  • locate( P ) walks each row of the range by the LF-mapping, \( \mathit{LF}( r ) = C[ L[ r ] ] + \mathrm{rank}_{L[ r ]}( r ) \), found by one descent of the tree (accessRank()), until a row whose suffix starts at a multiple of \( \mu \), marked and sampled;
  • extract( i , j ) starts from the row of the sampled suffix at or after \( j \) and walks back by the LF-mapping.

The symbols of \( L \) are the bytes plus 1, the end of the text being 0. The backward search takes the two ranks of a step by one descent of the tree, as they meet the same nodes. The samples are \( \lceil n / \mu \rceil \) places and as many rows of \( \lceil \log_2 ( n + 1 ) \rceil \) bits each, and the marks are \( n + 1 \) bits with the compact rank of CompactRankSelect [see CompactRankSelect.h], since a step of locate() tests the bit alone and the rank is needed once per occurrence; the parameter RS is the rank and select of the tree, RankSelect or CompactRankSelect. The transform comes from the suffix array of SA-IS [see BurrowsWheeler.h], in \( O( n ) \) time.

The contracts [see Contract.h]: \( \mu > 0 \), \( n < 2^{32} \), a pattern is not empty, \( i \le j \le n \); each place found by locate() is an occurrence, an audit. The functions are defined in HuffmanFMIndex.tpp.

See also
V. Mäkinen, G. Navarro, Succinct suffix arrays based on run-length encoding, Proc. 16th CPM, LNCS 3537, 45-56, 2005, doi:10.1007/11496656_5
P. Ferragina, G. Manzini, Indexing compressed text, Journal of the ACM 52(4), 552-581, 2005, doi:10.1145/1082036.1082039
P. Ferragina, G. Manzini, V. Mäkinen, G. Navarro, Compressed representations of sequences and full-text indexes, ACM Transactions on Algorithms 3(2), 20, 2007, doi:10.1145/1240233.1240243
G. Navarro, V. Mäkinen, Compressed full-text indexes, ACM Computing Surveys 39(1), 2, 2007, doi:10.1145/1216370.1216372
P. Ferragina, Pearls of Algorithm Engineering, Cambridge University Press, 2023, chapter 14, Block-Sorting Compression, doi:10.1017/9781009128933
Author
Donato Meoli
Dipartimento di Informatica
Università di Pisa