Class SuffixTree
Defined in File SuffixTree.h
Nested Relationships
Nested Types
Class Documentation
-
class SuffixTree
the suffix tree of T$, its nodes in a vector, the root at 0
Public Types
-
enum class Build
the construction
Values:
-
enumerator naive
-
enumerator mcCreight
-
enumerator suffixArray
-
enumerator naive
-
using size_type = std::size_t
-
using difference_type = std::ptrdiff_t
-
using reference = const_reference
-
using iterator = const_iterator
Public Functions
-
SuffixTree(void) = default
-
explicit SuffixTree(std::string_view T, Build b = Build::mcCreight)
the suffix tree of the bytes of T
-
SuffixTree(const Symbols &T, std::size_t K, Build b = Build::mcCreight)
the suffix tree of an integer text
- Pre:
every symbol of T is less than K
-
std::size_t textSize(void) const
the length n of T, without the terminator
-
inline std::size_t root(void) const
-
std::size_t leaf(std::size_t i) const
the leaf of the suffix i, the terminator being the suffix n
- Pre:
i <= textSize()
-
std::size_t symbol(std::size_t i) const
the symbol at the place i of T$ as stored: the symbols of T plus 1, and 0 for the terminator at n
- Pre:
i <= textSize()
-
std::size_t locus(std::string_view P) const
the extended locus of P, or npos if P does not occur
-
std::size_t count(std::string_view P) const
the number of occurrences of P
-
std::vector<std::size_t> locate(std::string_view P) const
the places of the occurrences of P, in lexicographic order of their suffixes; the empty pattern at the n places of the suffixes
-
std::size_t lca(std::size_t u, std::size_t v) const
the lowest common ancestor of u and v, O( 1 )
-
std::size_t lce(std::size_t i, std::size_t j) const
the length of the longest common prefix of the suffixes i and j of T
- Pre:
i <= textSize() and j <= textSize()
-
std::pair<std::vector<std::size_t>, std::vector<std::size_t>> toSuffixArray(void) const
SA and LCP of T, by a visit in order (Fact 10.5)
-
std::vector<std::size_t> preorder(void) const
the nodes in preorder, the children by increasing first symbol
-
inline std::size_t size(void) const
the number of nodes
-
inline const_iterator begin(void) const
-
inline const_iterator end(void) const
-
inline const_iterator cbegin(void) const
-
inline const_iterator cend(void) const
Public Static Attributes
-
static constexpr std::size_t npos = std::numeric_limits<std::size_t>::max()
no node, no suffix
-
struct Node
a node u; the edge into it is labelled by the symbols of T from pos + depth of the parent to pos + depth (the terminator at n)
-
enum class Build