SDSL 3.0.3
Succinct Data Structure Library
Loading...
Searching...
No Matches
sdsl::bp_support_sada< t_sml_blk, t_med_deg, t_rank, t_select > Class Template Reference

A class that provides support for bit_vectors that represent a BP sequence. More...

#include <bp_support_sada.hpp>

Public Types

typedef bit_vector::size_type size_type
typedef bit_vector::difference_type difference_type
typedef int_vector sml_block_array_type
typedef int_vector med_block_array_type
typedef t_rank rank_type
typedef t_select select_type

Public Member Functions

 bp_support_sada ()
 bp_support_sada (bp_support_sada const &v)
 Copy constructor.
 bp_support_sada (bp_support_sada &&bp_support)
 Move constructor.
bp_support_sadaoperator= (bp_support_sada &&bp_support)
 Assignment operator.
bp_support_sadaoperator= (bp_support_sada const &v)
 Assignment operator.
 bp_support_sada (bit_vector const *bp)
 Constructor.
void set_vector (bit_vector const *bp)
difference_type excess (size_type i) const
 Calculates the excess value at index i.
size_type rank (size_type i) const
 Returns the number of opening parentheses up to and including index i.
size_type select (size_type i) const
 Returns the index of the i-th opening parenthesis.
size_type find_close (size_type i) const
 Calculate the index of the matching closing parenthesis to the parenthesis at index i.
size_type find_open (size_type i) const
 Calculate the matching opening parenthesis to the closing parenthesis at position i.
size_type enclose (size_type i) const
 Calculate the index of the opening parenthesis corresponding to the closest matching parenthesis pair enclosing i.
size_type rr_enclose (const size_type i, const size_type j) const
 The range restricted enclose operation for parentheses pairs $(i,\mu(i))$ and $(j,\mu(j))$.
size_type rmq_open (const size_type l, const size_type r) const
 Search the interval [l,r-1] for an opening parenthesis, say i, such that find_close(i) >= r.
size_type median_block_rmq (size_type l_sblock, size_type r_sblock, bit_vector::difference_type &min_ex) const
size_type rmq (size_type l, size_type r) const
 The range minimum query (rmq) returns the index of the parenthesis with minimal excess in the range $[l..r]$.
size_type rr_enclose_naive (size_type i, size_type j) const
 The range restricted enclose operation.
size_type double_enclose (size_type i, size_type j) const
 The double enclose operation.
size_type preceding_closing_parentheses (size_type i) const
 Return the number of zeros which proceed position i in the balanced parentheses sequence.
size_type level_anc (size_type i, size_type d) const
 Returns the level ancestor of the node i.
size_type size () const
 The size of the supported balanced parentheses sequence.
size_type serialize (std::ostream &out, structure_tree_node *v=nullptr, std::string name="") const
 Serializes the bp_support_sada to a stream.
void load (std::istream &in, bit_vector const *bp)
 Load the bp_support_sada for a bit_vector v.
template<typename archive_t>
void CEREAL_SAVE_FUNCTION_NAME (archive_t &ar) const
template<typename archive_t>
void CEREAL_LOAD_FUNCTION_NAME (archive_t &ar)
bool operator== (bp_support_sada const &other) const noexcept
 Equality operator.
bool operator!= (bp_support_sada const &other) const noexcept
 Inequality operator.

Public Attributes

rank_type const & bp_rank = m_bp_rank
 RS for the underlying BP sequence.
select_type const & bp_select = m_bp_select
 SS for the underlying BP sequence.
sml_block_array_type const & sml_block_min_max = m_sml_block_min_max
 Small blocks array.
med_block_array_type const & med_block_min_max = m_med_block_min_max
 Array containing the min max tree of the medium blocks.

Detailed Description

template<uint32_t t_sml_blk = 256, uint32_t t_med_deg = 32, class t_rank = rank_support_v5<>, class t_select = select_support_mcl<>>
class sdsl::bp_support_sada< t_sml_blk, t_med_deg, t_rank, t_select >

A class that provides support for bit_vectors that represent a BP sequence.

This data structure supports the following operations:

  • find_open
  • find_close
  • enclose
  • double_enclose
  • rank
  • select
  • excess
  • rr_enclose An opening parenthesis in the balanced parentheses sequence is represented by a 1 in the bit_vector and a closing parenthesis by a 0.
Template Parameters
t_sml_blkThe size of the small blocks. Denoted as s in Sadakane's paper.
t_med_degNumber of small blocks that a medium block contains. Denoted as l in Sadakane's paper.
t_rankType of rank support used for the underlying bitvector.
t_selectType of select support used for the underlying bitvector.
References
  • Kunihiko Sadakane: The Ultimate Balanced Parentheses Technical Report 2008.
  • Kunihiko Sadakane, Gonzalo Navarro: Fully-Functional Succinct Trees. SODA 2010: 134-149

Definition at line 67 of file bp_support_sada.hpp.

Member Typedef Documentation

◆ difference_type

template<uint32_t t_sml_blk = 256, uint32_t t_med_deg = 32, class t_rank = rank_support_v5<>, class t_select = select_support_mcl<>>
typedef bit_vector::difference_type sdsl::bp_support_sada< t_sml_blk, t_med_deg, t_rank, t_select >::difference_type

Definition at line 71 of file bp_support_sada.hpp.

◆ med_block_array_type

template<uint32_t t_sml_blk = 256, uint32_t t_med_deg = 32, class t_rank = rank_support_v5<>, class t_select = select_support_mcl<>>
typedef int_vector sdsl::bp_support_sada< t_sml_blk, t_med_deg, t_rank, t_select >::med_block_array_type

Definition at line 73 of file bp_support_sada.hpp.

◆ rank_type

template<uint32_t t_sml_blk = 256, uint32_t t_med_deg = 32, class t_rank = rank_support_v5<>, class t_select = select_support_mcl<>>
typedef t_rank sdsl::bp_support_sada< t_sml_blk, t_med_deg, t_rank, t_select >::rank_type

Definition at line 74 of file bp_support_sada.hpp.

◆ select_type

template<uint32_t t_sml_blk = 256, uint32_t t_med_deg = 32, class t_rank = rank_support_v5<>, class t_select = select_support_mcl<>>
typedef t_select sdsl::bp_support_sada< t_sml_blk, t_med_deg, t_rank, t_select >::select_type

Definition at line 75 of file bp_support_sada.hpp.

◆ size_type

template<uint32_t t_sml_blk = 256, uint32_t t_med_deg = 32, class t_rank = rank_support_v5<>, class t_select = select_support_mcl<>>
typedef bit_vector::size_type sdsl::bp_support_sada< t_sml_blk, t_med_deg, t_rank, t_select >::size_type

Definition at line 70 of file bp_support_sada.hpp.

◆ sml_block_array_type

template<uint32_t t_sml_blk = 256, uint32_t t_med_deg = 32, class t_rank = rank_support_v5<>, class t_select = select_support_mcl<>>
typedef int_vector sdsl::bp_support_sada< t_sml_blk, t_med_deg, t_rank, t_select >::sml_block_array_type

Definition at line 72 of file bp_support_sada.hpp.

Constructor & Destructor Documentation

◆ bp_support_sada() [1/4]

template<uint32_t t_sml_blk = 256, uint32_t t_med_deg = 32, class t_rank = rank_support_v5<>, class t_select = select_support_mcl<>>
sdsl::bp_support_sada< t_sml_blk, t_med_deg, t_rank, t_select >::bp_support_sada ( )
inline

Definition at line 371 of file bp_support_sada.hpp.

◆ bp_support_sada() [2/4]

template<uint32_t t_sml_blk = 256, uint32_t t_med_deg = 32, class t_rank = rank_support_v5<>, class t_select = select_support_mcl<>>
sdsl::bp_support_sada< t_sml_blk, t_med_deg, t_rank, t_select >::bp_support_sada ( bp_support_sada< t_sml_blk, t_med_deg, t_rank, t_select > const & v)
inline

Copy constructor.

Definition at line 375 of file bp_support_sada.hpp.

◆ bp_support_sada() [3/4]

template<uint32_t t_sml_blk = 256, uint32_t t_med_deg = 32, class t_rank = rank_support_v5<>, class t_select = select_support_mcl<>>
sdsl::bp_support_sada< t_sml_blk, t_med_deg, t_rank, t_select >::bp_support_sada ( bp_support_sada< t_sml_blk, t_med_deg, t_rank, t_select > && bp_support)
inline

Move constructor.

Definition at line 391 of file bp_support_sada.hpp.

◆ bp_support_sada() [4/4]

template<uint32_t t_sml_blk = 256, uint32_t t_med_deg = 32, class t_rank = rank_support_v5<>, class t_select = select_support_mcl<>>
sdsl::bp_support_sada< t_sml_blk, t_med_deg, t_rank, t_select >::bp_support_sada ( bit_vector const * bp)
inlineexplicit

Constructor.

Definition at line 430 of file bp_support_sada.hpp.

Member Function Documentation

◆ CEREAL_LOAD_FUNCTION_NAME()

template<uint32_t t_sml_blk = 256, uint32_t t_med_deg = 32, class t_rank = rank_support_v5<>, class t_select = select_support_mcl<>>
template<typename archive_t>
void sdsl::bp_support_sada< t_sml_blk, t_med_deg, t_rank, t_select >::CEREAL_LOAD_FUNCTION_NAME ( archive_t & ar)
inline

Definition at line 1034 of file bp_support_sada.hpp.

◆ CEREAL_SAVE_FUNCTION_NAME()

template<uint32_t t_sml_blk = 256, uint32_t t_med_deg = 32, class t_rank = rank_support_v5<>, class t_select = select_support_mcl<>>
template<typename archive_t>
void sdsl::bp_support_sada< t_sml_blk, t_med_deg, t_rank, t_select >::CEREAL_SAVE_FUNCTION_NAME ( archive_t & ar) const
inline

Definition at line 1021 of file bp_support_sada.hpp.

◆ double_enclose()

template<uint32_t t_sml_blk = 256, uint32_t t_med_deg = 32, class t_rank = rank_support_v5<>, class t_select = select_support_mcl<>>
size_type sdsl::bp_support_sada< t_sml_blk, t_med_deg, t_rank, t_select >::double_enclose ( size_type i,
size_type j ) const
inline

The double enclose operation.

Parameters
iIndex of an opening parenthesis.
jIndex of an opening parenthesis $ i<j \wedge findclose(i) < j $.
Returns
The maximal opening parenthesis, say k, such that $ k<j \wedge k>findclose(j) $. If such a k does not exists, double_enclose(i,j) returns size().

Definition at line 921 of file bp_support_sada.hpp.

◆ enclose()

template<uint32_t t_sml_blk = 256, uint32_t t_med_deg = 32, class t_rank = rank_support_v5<>, class t_select = select_support_mcl<>>
size_type sdsl::bp_support_sada< t_sml_blk, t_med_deg, t_rank, t_select >::enclose ( size_type i) const
inline

Calculate the index of the opening parenthesis corresponding to the closest matching parenthesis pair enclosing i.

Parameters
iIndex of an opening parenthesis.
Returns
The index of the opening parenthesis corresponding to the closest matching parenthesis pair enclosing i, or size() if no such pair exists.

Definition at line 620 of file bp_support_sada.hpp.

◆ excess()

template<uint32_t t_sml_blk = 256, uint32_t t_med_deg = 32, class t_rank = rank_support_v5<>, class t_select = select_support_mcl<>>
difference_type sdsl::bp_support_sada< t_sml_blk, t_med_deg, t_rank, t_select >::excess ( size_type i) const
inline

Calculates the excess value at index i.

Parameters
iThe index of which the excess value should be calculated.

Definition at line 512 of file bp_support_sada.hpp.

◆ find_close()

template<uint32_t t_sml_blk = 256, uint32_t t_med_deg = 32, class t_rank = rank_support_v5<>, class t_select = select_support_mcl<>>
size_type sdsl::bp_support_sada< t_sml_blk, t_med_deg, t_rank, t_select >::find_close ( size_type i) const
inline

Calculate the index of the matching closing parenthesis to the parenthesis at index i.

Parameters
iIndex of an parenthesis. 0 <= i < size().
Returns
* i, if the parenthesis at index i is closing,
  • the position j of the matching closing parenthesis, if a matching parenthesis exists,
  • size() if no matching closing parenthesis exists.

Definition at line 554 of file bp_support_sada.hpp.

◆ find_open()

template<uint32_t t_sml_blk = 256, uint32_t t_med_deg = 32, class t_rank = rank_support_v5<>, class t_select = select_support_mcl<>>
size_type sdsl::bp_support_sada< t_sml_blk, t_med_deg, t_rank, t_select >::find_open ( size_type i) const
inline

Calculate the matching opening parenthesis to the closing parenthesis at position i.

Parameters
iIndex of a closing parenthesis.
Returns
* i, if the parenthesis at index i is closing,
  • the position j of the matching opening parenthesis, if a matching parenthesis exists,
  • size() if no matching closing parenthesis exists.

Definition at line 583 of file bp_support_sada.hpp.

◆ level_anc()

template<uint32_t t_sml_blk = 256, uint32_t t_med_deg = 32, class t_rank = rank_support_v5<>, class t_select = select_support_mcl<>>
size_type sdsl::bp_support_sada< t_sml_blk, t_med_deg, t_rank, t_select >::level_anc ( size_type i,
size_type d ) const
inline

Returns the level ancestor of the node i.

Parameters
iThe index of a parenthesis (i.e., a node).
dThe level, i.e., which node to select on the path from the node i up to the root. The level d = 0 will return the node itself, d = 1 will return its parent, and so on.

Definition at line 957 of file bp_support_sada.hpp.

◆ load()

template<uint32_t t_sml_blk = 256, uint32_t t_med_deg = 32, class t_rank = rank_support_v5<>, class t_select = select_support_mcl<>>
void sdsl::bp_support_sada< t_sml_blk, t_med_deg, t_rank, t_select >::load ( std::istream & in,
bit_vector const * bp )
inline

Load the bp_support_sada for a bit_vector v.

Parameters
inThe instream from which the data strucutre is read.
bpBit vector representing a balanced parentheses sequence that is supported by this data structure.

Definition at line 1004 of file bp_support_sada.hpp.

◆ median_block_rmq()

template<uint32_t t_sml_blk = 256, uint32_t t_med_deg = 32, class t_rank = rank_support_v5<>, class t_select = select_support_mcl<>>
size_type sdsl::bp_support_sada< t_sml_blk, t_med_deg, t_rank, t_select >::median_block_rmq ( size_type l_sblock,
size_type r_sblock,
bit_vector::difference_type & min_ex ) const
inline

Definition at line 703 of file bp_support_sada.hpp.

◆ operator!=()

template<uint32_t t_sml_blk = 256, uint32_t t_med_deg = 32, class t_rank = rank_support_v5<>, class t_select = select_support_mcl<>>
bool sdsl::bp_support_sada< t_sml_blk, t_med_deg, t_rank, t_select >::operator!= ( bp_support_sada< t_sml_blk, t_med_deg, t_rank, t_select > const & other) const
inlinenoexcept

Inequality operator.

Definition at line 1056 of file bp_support_sada.hpp.

◆ operator=() [1/2]

template<uint32_t t_sml_blk = 256, uint32_t t_med_deg = 32, class t_rank = rank_support_v5<>, class t_select = select_support_mcl<>>
bp_support_sada & sdsl::bp_support_sada< t_sml_blk, t_med_deg, t_rank, t_select >::operator= ( bp_support_sada< t_sml_blk, t_med_deg, t_rank, t_select > && bp_support)
inline

Assignment operator.

Definition at line 397 of file bp_support_sada.hpp.

◆ operator=() [2/2]

template<uint32_t t_sml_blk = 256, uint32_t t_med_deg = 32, class t_rank = rank_support_v5<>, class t_select = select_support_mcl<>>
bp_support_sada & sdsl::bp_support_sada< t_sml_blk, t_med_deg, t_rank, t_select >::operator= ( bp_support_sada< t_sml_blk, t_med_deg, t_rank, t_select > const & v)
inline

Assignment operator.

Definition at line 419 of file bp_support_sada.hpp.

◆ operator==()

template<uint32_t t_sml_blk = 256, uint32_t t_med_deg = 32, class t_rank = rank_support_v5<>, class t_select = select_support_mcl<>>
bool sdsl::bp_support_sada< t_sml_blk, t_med_deg, t_rank, t_select >::operator== ( bp_support_sada< t_sml_blk, t_med_deg, t_rank, t_select > const & other) const
inlinenoexcept

Equality operator.

Definition at line 1047 of file bp_support_sada.hpp.

◆ preceding_closing_parentheses()

template<uint32_t t_sml_blk = 256, uint32_t t_med_deg = 32, class t_rank = rank_support_v5<>, class t_select = select_support_mcl<>>
size_type sdsl::bp_support_sada< t_sml_blk, t_med_deg, t_rank, t_select >::preceding_closing_parentheses ( size_type i) const
inline

Return the number of zeros which proceed position i in the balanced parentheses sequence.

Parameters
iIndex of an parenthesis.

Definition at line 935 of file bp_support_sada.hpp.

◆ rank()

template<uint32_t t_sml_blk = 256, uint32_t t_med_deg = 32, class t_rank = rank_support_v5<>, class t_select = select_support_mcl<>>
size_type sdsl::bp_support_sada< t_sml_blk, t_med_deg, t_rank, t_select >::rank ( size_type i) const
inline

Returns the number of opening parentheses up to and including index i.

Precondition
{ \f$ 0\leq i < size() \f$ }

Definition at line 520 of file bp_support_sada.hpp.

◆ rmq()

template<uint32_t t_sml_blk = 256, uint32_t t_med_deg = 32, class t_rank = rank_support_v5<>, class t_select = select_support_mcl<>>
size_type sdsl::bp_support_sada< t_sml_blk, t_med_deg, t_rank, t_select >::rmq ( size_type l,
size_type r ) const
inline

The range minimum query (rmq) returns the index of the parenthesis with minimal excess in the range $[l..r]$.

Parameters
lThe left border of the interval $[l..r]$ ( $l\leq r$).
rThe right border of the interval $[l..r]$ ( $l \leq r$).

Definition at line 732 of file bp_support_sada.hpp.

◆ rmq_open()

template<uint32_t t_sml_blk = 256, uint32_t t_med_deg = 32, class t_rank = rank_support_v5<>, class t_select = select_support_mcl<>>
size_type sdsl::bp_support_sada< t_sml_blk, t_med_deg, t_rank, t_select >::rmq_open ( const size_type l,
const size_type r ) const
inline

Search the interval [l,r-1] for an opening parenthesis, say i, such that find_close(i) >= r.

Parameters
lThe left end (inclusive) of the interval to search for the result.
rThe right end (exclusive) of the interval to search for the result.
Returns
The minimal opening parenthesis i with $ \ell \leq i < r $ and $ find_close(i) \geq r $; if no such i exists size() is returned.
Time complexity
$ \Order{block\_size} $

Definition at line 660 of file bp_support_sada.hpp.

◆ rr_enclose()

template<uint32_t t_sml_blk = 256, uint32_t t_med_deg = 32, class t_rank = rank_support_v5<>, class t_select = select_support_mcl<>>
size_type sdsl::bp_support_sada< t_sml_blk, t_med_deg, t_rank, t_select >::rr_enclose ( const size_type i,
const size_type j ) const
inline

The range restricted enclose operation for parentheses pairs $(i,\mu(i))$ and $(j,\mu(j))$.

Parameters
iFirst opening parenthesis.
jSecond opening parenthesis $ i<j \wedge findclose(i) < j $.
Returns
The smallest index, say k, of an opening parenthesis such that findclose(i) < k < j and findclose(j) < findclose(k). If such a k does not exists, restricted_enclose(i,j) returns size().
Time complexity
$ \Order{block\_size} $

Definition at line 642 of file bp_support_sada.hpp.

◆ rr_enclose_naive()

template<uint32_t t_sml_blk = 256, uint32_t t_med_deg = 32, class t_rank = rank_support_v5<>, class t_select = select_support_mcl<>>
size_type sdsl::bp_support_sada< t_sml_blk, t_med_deg, t_rank, t_select >::rr_enclose_naive ( size_type i,
size_type j ) const
inline

The range restricted enclose operation.

Parameters
iIndex of an opening parenthesis.
jIndex of an opening parenthesis $ i<j \wedge findclose(i) < j $.
Returns
The minimal opening parenthesis, say k, such that $ findclose(i) < k < j$ and findclose(j) < findclose(k). If such a k does not exists, restricted_enclose(i,j) returns size().
Time complexity
$ \Order{size()}$ in the worst case.

Definition at line 895 of file bp_support_sada.hpp.

◆ select()

template<uint32_t t_sml_blk = 256, uint32_t t_med_deg = 32, class t_rank = rank_support_v5<>, class t_select = select_support_mcl<>>
size_type sdsl::bp_support_sada< t_sml_blk, t_med_deg, t_rank, t_select >::select ( size_type i) const
inline

Returns the index of the i-th opening parenthesis.

Parameters
iNumber of the parenthesis to select.
Precondition
{ \f$1\leq i < rank(size())\f$ }
Postcondition
{ \f$ 0\leq select(i) < size() \f$ }

Definition at line 530 of file bp_support_sada.hpp.

◆ serialize()

template<uint32_t t_sml_blk = 256, uint32_t t_med_deg = 32, class t_rank = rank_support_v5<>, class t_select = select_support_mcl<>>
size_type sdsl::bp_support_sada< t_sml_blk, t_med_deg, t_rank, t_select >::serialize ( std::ostream & out,
structure_tree_node * v = nullptr,
std::string name = "" ) const
inline

Serializes the bp_support_sada to a stream.

Parameters
outThe outstream to which the data structure is written.
Returns
The number of bytes written to out.

Definition at line 980 of file bp_support_sada.hpp.

◆ set_vector()

template<uint32_t t_sml_blk = 256, uint32_t t_med_deg = 32, class t_rank = rank_support_v5<>, class t_select = select_support_mcl<>>
void sdsl::bp_support_sada< t_sml_blk, t_med_deg, t_rank, t_select >::set_vector ( bit_vector const * bp)
inline

Definition at line 502 of file bp_support_sada.hpp.

◆ size()

template<uint32_t t_sml_blk = 256, uint32_t t_med_deg = 32, class t_rank = rank_support_v5<>, class t_select = select_support_mcl<>>
size_type sdsl::bp_support_sada< t_sml_blk, t_med_deg, t_rank, t_select >::size ( ) const
inline

The size of the supported balanced parentheses sequence.

Returns
the size of the supported balanced parentheses sequence.

Definition at line 970 of file bp_support_sada.hpp.

Member Data Documentation

◆ bp_rank

template<uint32_t t_sml_blk = 256, uint32_t t_med_deg = 32, class t_rank = rank_support_v5<>, class t_select = select_support_mcl<>>
rank_type const& sdsl::bp_support_sada< t_sml_blk, t_med_deg, t_rank, t_select >::bp_rank = m_bp_rank

RS for the underlying BP sequence.

Definition at line 364 of file bp_support_sada.hpp.

◆ bp_select

template<uint32_t t_sml_blk = 256, uint32_t t_med_deg = 32, class t_rank = rank_support_v5<>, class t_select = select_support_mcl<>>
select_type const& sdsl::bp_support_sada< t_sml_blk, t_med_deg, t_rank, t_select >::bp_select = m_bp_select

SS for the underlying BP sequence.

Definition at line 365 of file bp_support_sada.hpp.

◆ med_block_min_max

template<uint32_t t_sml_blk = 256, uint32_t t_med_deg = 32, class t_rank = rank_support_v5<>, class t_select = select_support_mcl<>>
med_block_array_type const& sdsl::bp_support_sada< t_sml_blk, t_med_deg, t_rank, t_select >::med_block_min_max = m_med_block_min_max

Array containing the min max tree of the medium blocks.

Definition at line 368 of file bp_support_sada.hpp.

◆ sml_block_min_max

template<uint32_t t_sml_blk = 256, uint32_t t_med_deg = 32, class t_rank = rank_support_v5<>, class t_select = select_support_mcl<>>
sml_block_array_type const& sdsl::bp_support_sada< t_sml_blk, t_med_deg, t_rank, t_select >::sml_block_min_max = m_sml_block_min_max

Small blocks array.

Rel. min/max for the small blocks.

Definition at line 366 of file bp_support_sada.hpp.


The documentation for this class was generated from the following file: