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

The r-index on move structures, after the move-r of Bertram, Fischer and Nalbach (beyond the book): the operations of the r-index [see RIndex.h] with each step in \( O( 1 ) \) time instead of a predecessor search, from two move structures of Nishimoto and Tabei [see MoveStructure.h], at the price of a few more words per run of the transform \( L \) of Burrows and Wheeler of the text. More...

#include "ADS/Contract.h"
#include "ADS/compression/BurrowsWheeler.h"
#include "ADS/succinct/BitVector.h"
#include "ADS/succinct/RankSelect.h"
#include "ADS/succinct/HuffmanWaveletTree.h"
#include "ADS/succinct/MoveStructure.h"
#include <algorithm>
#include <array>
#include <bit>
#include <cstddef>
#include <cstdint>
#include <string>
#include <string_view>
#include <tuple>
#include <utility>
#include <vector>
#include "ADS/compression/impl/MoveRIndex.tpp"

Go to the source code of this file.

Classes

class  ADS::MoveRIndex
 the r-index of a text on move structures: count and locate with each step in \( O( 1 ) \) time More...

Namespaces

namespace  ADS

Detailed description

The r-index on move structures, after the move-r of Bertram, Fischer and Nalbach (beyond the book): the operations of the r-index [see RIndex.h] with each step in \( O( 1 ) \) time instead of a predecessor search, from two move structures of Nishimoto and Tabei [see MoveStructure.h], at the price of a few more words per run of the transform \( L \) of Burrows and Wheeler of the text.

The LF-mapping shifts each run of \( L \) alike onto the column \( F \), and is therefore a move structure on the runs. The backward search keeps the first and the last row of the range, \( [ \mathit{s} , \mathit{e} ] \), with their intervals; for the symbol \( c \) it moves \( \mathit{s} \) to the first row at or after it whose symbol is \( c \) (the start of the next interval of \( c \) if its own is not of \( c \)) and \( \mathit{e} \) to the last one at or before it (the end of the previous interval of \( c \)), by the rank and select of \( c \) on the tags of the intervals, kept in a wavelet tree of Huffman on RankSelect [see HuffmanWaveletTree.h], the fastest; it then maps both rows by the LF-mapping in \( O( 1 ) \) time each. Hence count( P ) takes \( O( p ) \) steps, plus the ranks for the intervals whose tag is not \( c \).

The function \( \phi( \mathit{SA}[ i ] ) = \mathit{SA}[ i - 1 ] \), taken cyclically (\( \phi( \mathit{SA}[ 0 ] ) = \mathit{SA}[ n ] \)), is a permutation of the places of the text that shifts each stretch between two places of the starts of the runs alike, and is a move structure too; locate( P ) keeps \( \mathit{SA}[ \mathit{e} ] \) along the search (the toehold, from the samples of \( \mathit{SA} \) at the end of each interval, with the interval of \( \phi \) of each), and then lists the occurrences by \( \mathit{e} - \mathit{s} \) steps of \( \phi \), each in \( O( 1 ) \) time.

The symbols of \( L \) are the bytes plus 1, the end of the text being 0; the transform comes from the suffix array of SA-IS [see BurrowsWheeler.h].

The contracts [see Contract.h]: \( n < 2^{32} \), a pattern is not empty; each place found by locate() is an occurrence, an audit against the text kept for it only at the level of the audits. The functions are defined in MoveRIndex.tpp.

See also
N. Bertram, J. Fischer, L. Nalbach, Move-r: optimizing the r-index, Proc. 22nd SEA, LIPIcs 301, 1, 2024, doi:10.4230/LIPIcs.SEA.2024.1
T. Nishimoto, Y. Tabei, Optimal-time queries on BWT-runs compressed indexes, Proc. 48th ICALP, LIPIcs 198, 101, 2021, doi:10.4230/LIPIcs.ICALP.2021.101
T. Gagie, G. Navarro, N. Prezza, Fully functional suffix trees and optimal text searching in BWT-runs bounded space, Journal of the ACM 67(1), 2, 2020, doi:10.1145/3375890
Author
Donato Meoli
Dipartimento di Informatica
Università di Pisa