![]() |
libsemigroups
v3.0.0
C++ library for semigroups and monoids
|
This namespace contains helper functions for the Ukkonen class.
Functions | |
void | add_word (Ukkonen &u, char const *w) |
Add a word to the suffix tree. | |
template<typename Iterator> | |
void | add_word (Ukkonen &u, Iterator first, Iterator last) |
Add a word to the suffix tree. | |
template<typename Word> | |
void | add_word (Ukkonen &u, Word const &w) |
Add a word to the suffix tree. | |
void | add_word (Ukkonen &u, word_type const &w) |
Add a word to the suffix tree. | |
void | add_word_no_checks (Ukkonen &u, char const *w) |
Add a word to the suffix tree. | |
template<typename Iterator> | |
void | add_word_no_checks (Ukkonen &u, Iterator first, Iterator last) |
Add a word to the suffix tree. | |
template<typename Word> | |
void | add_word_no_checks (Ukkonen &u, Word const &w) |
Add a word to the suffix tree. | |
void | add_word_no_checks (Ukkonen &u, word_type const &w) |
Add a word to the suffix tree. | |
template<typename Iterator1, typename Iterator2> | |
void | add_words (Ukkonen &u, Iterator1 first, Iterator2 last) |
Add all words in a range to a Ukkonen object. | |
void | add_words (Ukkonen &u, std::vector< word_type > const &words) |
Add all words in a range to a Ukkonen object. | |
template<typename Iterator1, typename Iterator2> | |
void | add_words_no_checks (Ukkonen &u, Iterator1 first, Iterator2 last) |
Add all words in a range to a Ukkonen object. | |
void | add_words_no_checks (Ukkonen &u, std::vector< word_type > const &words) |
Add all words in a std::vector to a Ukkonen object. | |
template<typename T> | |
auto | dfs (Ukkonen const &u, T &helper) |
Perform a depth first search in a suffix tree. | |
Dot | dot (Ukkonen const &u) |
Returns a Dot object representing a suffix tree. | |
bool | is_piece (Ukkonen const &u, char const *w) |
Check if a word is a piece (occurs in two distinct places in the words of the suffix tree). | |
template<typename Iterator> | |
bool | is_piece (Ukkonen const &u, Iterator first, Iterator last) |
Check if a word is a piece (occurs in two distinct places in the words of the suffix tree). | |
template<typename Word> | |
bool | is_piece (Ukkonen const &u, Word const &w) |
Check if a word is a piece (occurs in two distinct places in the words of the suffix tree). | |
bool | is_piece (Ukkonen const &u, word_type const &w) |
Check if a word is a piece (occurs in two distinct places in the words of the suffix tree). | |
bool | is_piece_no_checks (Ukkonen const &u, char const *w) |
Check if a word is a piece (occurs in two distinct places in the words of the suffix tree). | |
template<typename Iterator> | |
bool | is_piece_no_checks (Ukkonen const &u, Iterator first, Iterator last) |
Check if a word is a piece (occurs in two distinct places in the words of the suffix tree). | |
template<typename Word> | |
bool | is_piece_no_checks (Ukkonen const &u, Word const &w) |
Check if a word is a piece (occurs in two distinct places in the words of the suffix tree). | |
bool | is_piece_no_checks (Ukkonen const &u, word_type const &w) |
Check if a word is a piece (occurs in two distinct places in the words of the suffix tree). | |
bool | is_subword (Ukkonen const &u, char const *w) |
Check if a word is a subword of any word in a suffix tree. | |
template<typename Iterator> | |
bool | is_subword (Ukkonen const &u, Iterator first, Iterator last) |
Check if a word is a subword of any word in a suffix tree. | |
template<typename Word> | |
bool | is_subword (Ukkonen const &u, Word const &w) |
Check if a word is a subword of any word in a suffix tree. | |
bool | is_subword (Ukkonen const &u, word_type const &w) |
Check if a word is a subword of any word in a suffix tree. | |
bool | is_subword_no_checks (Ukkonen const &u, char const *w) |
Check if a word is a subword of any word in a suffix tree. | |
template<typename Iterator> | |
bool | is_subword_no_checks (Ukkonen const &u, Iterator first, Iterator last) |
Check if a word is a subword of any word in a suffix tree. | |
template<typename Word> | |
bool | is_subword_no_checks (Ukkonen const &u, Word const &w) |
Check if a word is a subword of any word in a suffix tree. | |
bool | is_subword_no_checks (Ukkonen const &u, word_type const &w) |
Check if a word is a subword of any word in a suffix tree. | |
bool | is_suffix (Ukkonen const &u, char const *w) |
Check if a word is a suffix of any word in a suffix tree. | |
template<typename Iterator> | |
bool | is_suffix (Ukkonen const &u, Iterator first, Iterator last) |
Check if a word is a suffix of any word in a suffix tree. | |
template<typename Word> | |
bool | is_suffix (Ukkonen const &u, Word const &w) |
Check if a word is a suffix of any word in a suffix tree. | |
bool | is_suffix (Ukkonen const &u, word_type const &w) |
Check if a word is a suffix of any word in a suffix tree. | |
bool | is_suffix_no_checks (Ukkonen const &u, char const *w) |
Check if a word is a suffix of any word in a suffix tree. | |
template<typename Iterator> | |
bool | is_suffix_no_checks (Ukkonen const &u, Iterator first, Iterator last) |
Check if a word is a suffix of any word in a suffix tree. | |
template<typename Word> | |
bool | is_suffix_no_checks (Ukkonen const &u, Word const &w) |
Check if a word is a suffix of any word in a suffix tree. | |
bool | is_suffix_no_checks (Ukkonen const &u, word_type const &w) |
Check if a word is a suffix of any word in a suffix tree. | |
size_t | length_maximal_piece_prefix (Ukkonen const &u, char const *w) |
Find the length of the maximal prefix of a word occurring in two different places in a word in a suffix tree. | |
template<typename Iterator> | |
size_t | length_maximal_piece_prefix (Ukkonen const &u, Iterator first, Iterator last) |
Find the length of the maximal prefix of a word occurring in two different places in a word in a suffix tree. | |
template<typename Word> | |
size_t | length_maximal_piece_prefix (Ukkonen const &u, Word const &w) |
Find the length of the maximal prefix of a word occurring in two different places in a word in a suffix tree. | |
size_t | length_maximal_piece_prefix (Ukkonen const &u, word_type const &w) |
Find the length of the maximal prefix of a word occurring in two different places in a word in a suffix tree. | |
size_t | length_maximal_piece_prefix_no_checks (Ukkonen const &u, char const *w) |
Find the length of the maximal prefix of a word occurring in two different places in a word in a suffix tree. | |
template<typename Iterator> | |
size_t | length_maximal_piece_prefix_no_checks (Ukkonen const &u, Iterator first, Iterator last) |
Find the length of the maximal prefix of a word occurring in two different places in a word in a suffix tree. | |
template<typename Word> | |
size_t | length_maximal_piece_prefix_no_checks (Ukkonen const &u, Word const &w) |
Find the length of the maximal prefix of a word occurring in two different places in a word in a suffix tree. | |
size_t | length_maximal_piece_prefix_no_checks (Ukkonen const &u, word_type const &w) |
Find the length of the maximal prefix of a word occurring in two different places in a word in a suffix tree. | |
size_t | length_maximal_piece_suffix (Ukkonen const &u, char const *w) |
Find the length of the maximal suffix of a word occurring in two different places in a word in a suffix tree. | |
template<typename Iterator> | |
size_t | length_maximal_piece_suffix (Ukkonen const &u, Iterator first, Iterator last) |
Find the length of the maximal suffix of a word occurring in two different places in a word in a suffix tree. | |
template<typename Word> | |
size_t | length_maximal_piece_suffix (Ukkonen const &u, Word const &w) |
Find the length of the maximal suffix of a word occurring in two different places in a word in a suffix tree. | |
size_t | length_maximal_piece_suffix (Ukkonen const &u, word_type const &w) |
Find the length of the maximal suffix of a word occurring in two different places in a word in a suffix tree. | |
size_t | length_maximal_piece_suffix_no_checks (Ukkonen const &u, char const *w) |
Find the length of the maximal suffix of a word occurring in two different places in a word in a suffix tree. | |
template<typename Iterator> | |
size_t | length_maximal_piece_suffix_no_checks (Ukkonen const &u, Iterator first, Iterator last) |
Find the length of the maximal suffix of a word occurring in two different places in a word in a suffix tree. | |
template<typename Word> | |
size_t | length_maximal_piece_suffix_no_checks (Ukkonen const &u, Word const &w) |
Find the length of the maximal suffix of a word occurring in two different places in a word in a suffix tree. | |
size_t | length_maximal_piece_suffix_no_checks (Ukkonen const &u, word_type const &w) |
Find the length of the maximal suffix of a word occurring in two different places in a word in a suffix tree. | |
char const * | maximal_piece_prefix (Ukkonen const &u, char const *w) |
Find the maximal prefix of a word occurring in two different places in a word in a suffix tree. | |
template<typename Iterator> | |
Iterator | maximal_piece_prefix (Ukkonen const &u, Iterator first, Iterator last) |
Find the maximal prefix of a word occurring in two different places in a word in a suffix tree. | |
template<typename Word> | |
Word::const_iterator | maximal_piece_prefix (Ukkonen const &u, Word const &w) |
Find the maximal prefix of a word occurring in two different places in a word in a suffix tree. | |
word_type::const_iterator | maximal_piece_prefix (Ukkonen const &u, word_type const &w) |
Find the maximal prefix of a word occurring in two different places in a word in a suffix tree. | |
char const * | maximal_piece_prefix_no_checks (Ukkonen const &u, char const *w) |
Find the maximal prefix of a word occurring in two different places in a word in a suffix tree. | |
template<typename Iterator> | |
Iterator | maximal_piece_prefix_no_checks (Ukkonen const &u, Iterator first, Iterator last) |
Find the maximal prefix of a word occurring in two different places in a word in a suffix tree. | |
template<typename Word> | |
Word::const_iterator | maximal_piece_prefix_no_checks (Ukkonen const &u, Word const &w) |
Find the maximal prefix of a word occurring in two different places in a word in a suffix tree. | |
word_type::const_iterator | maximal_piece_prefix_no_checks (Ukkonen const &u, word_type const &w) |
Find the maximal prefix of a word occurring in two different places in a word in a suffix tree. | |
char const * | maximal_piece_suffix (Ukkonen const &u, char const *w) |
Find the maximal suffix of a word occurring in two different places in a word in a suffix tree. | |
template<typename Iterator> | |
Iterator | maximal_piece_suffix (Ukkonen const &u, Iterator first, Iterator last) |
Find the maximal suffix of a word occurring in two different places in a word in a suffix tree. | |
template<typename Word> | |
Word::const_iterator | maximal_piece_suffix (Ukkonen const &u, Word const &w) |
Find the maximal suffix of a word occurring in two different places in a word in a suffix tree. | |
word_type::const_iterator | maximal_piece_suffix (Ukkonen const &u, word_type const &w) |
Find the maximal suffix of a word occurring in two different places in a word in a suffix tree. | |
char const * | maximal_piece_suffix_no_checks (Ukkonen const &u, char const *w) |
Find the maximal suffix of a word occurring in two different places in a word in a suffix tree. | |
template<typename Iterator> | |
Iterator | maximal_piece_suffix_no_checks (Ukkonen const &u, Iterator first, Iterator last) |
Find the maximal suffix of a word occurring in two different places in a word in a suffix tree. | |
template<typename Word> | |
Word::const_iterator | maximal_piece_suffix_no_checks (Ukkonen const &u, Word const &w) |
Find the maximal suffix of a word occurring in two different places in a word in a suffix tree. | |
word_type::const_iterator | maximal_piece_suffix_no_checks (Ukkonen const &u, word_type const &w) |
Find the maximal suffix of a word occurring in two different places in a word in a suffix tree. | |
size_t | number_of_distinct_subwords (Ukkonen const &u) |
Returns the number of distinct subwords of the words in a suffix tree. | |
size_t | number_of_pieces (Ukkonen const &u, char const *w) |
Find the number of pieces in a decomposition of a word (if any). | |
template<typename Iterator> | |
size_t | number_of_pieces (Ukkonen const &u, Iterator first, Iterator last) |
Find the number of pieces in a decomposition of a word (if any). | |
template<typename Word> | |
size_t | number_of_pieces (Ukkonen const &u, Word const &w) |
Find the number of pieces in a decomposition of a word (if any). | |
size_t | number_of_pieces (Ukkonen const &u, word_type const &w) |
Find the number of pieces in a decomposition of a word (if any). | |
size_t | number_of_pieces_no_checks (Ukkonen const &u, char const *w) |
Find the number of pieces in a decomposition of a word (if any). | |
template<typename Iterator> | |
size_t | number_of_pieces_no_checks (Ukkonen const &u, Iterator first, Iterator last) |
Find the number of pieces in a decomposition of a word (if any). | |
template<typename Word> | |
size_t | number_of_pieces_no_checks (Ukkonen const &u, Word const &w) |
Find the number of pieces in a decomposition of a word (if any). | |
size_t | number_of_pieces_no_checks (Ukkonen const &u, word_type const &w) |
Find the number of pieces in a decomposition of a word (if any). | |
std::vector< std::string > | pieces (Ukkonen const &u, char const *w) |
Find the pieces in a decomposition of a word (if any). | |
template<typename Iterator> | |
std::vector< Iterator > | pieces (Ukkonen const &u, Iterator first, Iterator last) |
Find the pieces in a decomposition of a word (if any). | |
template<typename Word> | |
std::vector< Word > | pieces (Ukkonen const &u, Word const &w) |
Find the pieces in a decomposition of a word (if any). | |
std::vector< word_type > | pieces (Ukkonen const &u, word_type const &w) |
Find the pieces in a decomposition of a word (if any). | |
std::vector< std::string > | pieces_no_checks (Ukkonen const &u, char const *w) |
Find the pieces in a decomposition of a word (if any). | |
template<typename Iterator> | |
std::vector< Iterator > | pieces_no_checks (Ukkonen const &u, Iterator first, Iterator last) |
Find the pieces in a decomposition of a word (if any). | |
template<typename Word> | |
std::vector< Word > | pieces_no_checks (Ukkonen const &u, Word const &w) |
Find the pieces in a decomposition of a word (if any). | |
std::vector< word_type > | pieces_no_checks (Ukkonen const &u, word_type const &w) |
Find the pieces in a decomposition of a word (if any). | |
std::pair< Ukkonen::State, char const * > | traverse (Ukkonen const &u, char const *w) |
Traverse the suffix tree from the root. | |
template<typename Word> | |
auto | traverse (Ukkonen const &u, Word const &w) |
Traverse the suffix tree from the root. | |
std::pair< Ukkonen::State, word_type::const_iterator > | traverse (Ukkonen const &u, word_type const &w) |
Traverse the suffix tree from the root. | |
char const * | traverse (Ukkonen::State &st, Ukkonen const &u, char const *w) |
Traverse the suffix tree from the root. | |
template<typename Word> | |
auto | traverse (Ukkonen::State &st, Ukkonen const &u, Word const &w) |
Traverse the suffix tree from the root. | |
word_type::const_iterator | traverse (Ukkonen::State &st, Ukkonen const &u, word_type const &w) |
Traverse the suffix tree from the root. | |
std::pair< Ukkonen::State, char const * > | traverse_no_checks (Ukkonen const &u, char const *w) |
Traverse the suffix tree from the root. | |
template<typename Word> | |
auto | traverse_no_checks (Ukkonen const &u, Word const &w) |
Traverse the suffix tree from the root. | |
std::pair< Ukkonen::State, word_type::const_iterator > | traverse_no_checks (Ukkonen const &u, word_type const &w) |
Traverse the suffix tree from the root. | |
char const * | traverse_no_checks (Ukkonen::State &st, Ukkonen const &u, char const *w) |
Traverse the suffix tree from the root. | |
template<typename Word> | |
auto | traverse_no_checks (Ukkonen::State &st, Ukkonen const &u, Word const &w) |
Traverse the suffix tree from the root. . | |
word_type::const_iterator | traverse_no_checks (Ukkonen::State &st, Ukkonen const &u, word_type const &w) |
Traverse the suffix tree from the root. | |
void add_word | ( | Ukkonen & | u, |
char const * | w ) |
See add_word_no_checks.
LibsemigroupsException | if u.throw_if_contains_unique_letter(w, w + std::strlen(w)) throws. |
void add_word | ( | Ukkonen & | u, |
Iterator | first, | ||
Iterator | last ) |
See add_word_no_checks.
LibsemigroupsException | if throw_if_contains_unique_letter(first, last) throws. |
void add_word | ( | Ukkonen & | u, |
Word const & | w ) |
See add_word_no_checks.
LibsemigroupsException | if throw_if_contains_unique_letter(w) throws. |
See add_word_no_checks.
LibsemigroupsException | if throw_if_contains_unique_letter(w) throws. |
void add_word_no_checks | ( | Ukkonen & | u, |
char const * | w ) |
See add_word_no_checks.
void add_word_no_checks | ( | Ukkonen & | u, |
Iterator | first, | ||
Iterator | last ) |
See add_word_no_checks.
void add_word_no_checks | ( | Ukkonen & | u, |
Word const & | w ) |
See add_word_no_checks.
See add_word_no_checks.
void add_words | ( | Ukkonen & | u, |
Iterator1 | first, | ||
Iterator2 | last ) |
See add_words_no_checks(Ukkonen&, Iterator1, Iterator2).
LibsemigroupsException | if u.throw_if_contains_unique_letter(w) throws for any w in [first, last) . |
void add_words | ( | Ukkonen & | u, |
std::vector< word_type > const & | words ) |
See vector<word_type> const&).
LibsemigroupsException | if u.throw_if_contains_unique_letter(w) throws for any w in words . |
void add_words_no_checks | ( | Ukkonen & | u, |
Iterator1 | first, | ||
Iterator2 | last ) |
Add all words in a range to a Ukkonen object.
Iterator | the type of the 2nd and 3rd parameters. |
u | the Ukkonen object. |
first | iterator pointing to the first letter of the word. |
last | one beyond the last letter of the word. |
first
and last
contains any of the unique letters appended to the end of any existing word in the tree, then bad things will happen. void add_words_no_checks | ( | Ukkonen & | u, |
std::vector< word_type > const & | words ) |
Add all words in a std::vector to a Ukkonen object.
u | the Ukkonen object. |
words | the words to add. |
first
and last
contains any of the unique letters appended to the end of any existing word in the tree, then bad things will happen. auto dfs | ( | Ukkonen const & | u, |
T & | helper ) |
This function can be used to perform a depth first search in the suffix tree u
. The 2nd parameter is a helper object that must implement:
void pre_order(Ukkonen const& u, size_t i)
;void post_order(Ukkonen const& u, size_t i)
; andauto yield(Ukkonen const& u)
.The function T::pre_order
is called when the node n
with index i
is first encountered in the depth-first search, and the function T::post_order
is called when the subtree rooted at n
has been completely explored.
The function yield
is called at the end of the depth-first search and its return value is returned by this function.
T | the type of the helper object. |
u | the Ukkonen object. |
helper | the helper object. |
T::yield
.This function returns a Dot object representing the suffix tree defined by u
.
Internally, all words added to the suffix tree are stored as a single string delimited by unique letters. The edge labels present in this Dot object correspond to intervals of letters in that delimited string.
u | the Ukkonen object. |
LibsemigroupsException | if u does not contain any words. |
LibsemigroupsException | if the number of words in u is greater than 24. |
|
inline |
See is_piece_no_checks(Ukkonen const&, Iterator, Iterator).
LibsemigroupsException | if u.throw_if_contains_unique_letter(w, w + std::strlen(w)) throws. |
bool is_piece | ( | Ukkonen const & | u, |
Iterator | first, | ||
Iterator | last ) |
See is_piece_no_checks(Ukkonen const&, Iterator, Iterator).
LibsemigroupsException | if u.throw_if_contains_unique_letter(first, last) throws. |
bool is_piece | ( | Ukkonen const & | u, |
Word const & | w ) |
See is_piece_no_checks(Ukkonen const&, Iterator, Iterator).
LibsemigroupsException | if u.throw_if_contains_unique_letter(w.cbegin(), w.cend()) throws. |
See is_piece_no_checks(Ukkonen const&, Iterator, Iterator).
LibsemigroupsException | if u.throw_if_contains_unique_letter(w) throws. |
|
inline |
bool is_piece_no_checks | ( | Ukkonen const & | u, |
Iterator | first, | ||
Iterator | last ) |
Returns true
if the word corresponding to first
and last
that occurs in at least \(2\) different (possibly overlapping) places in the words contained in u
. If no such prefix exists, then false
is returned.
Iterator | the type of the 2nd and 3rd parameters. |
u | the Ukkonen object. |
first | iterator pointing to the first letter of the word. |
last | one beyond the last letter of the word. |
bool
.first
and last
.first
and last
contains any of the unique letters appended to the end of any existing word in the tree, then bad things will happen. bool is_piece_no_checks | ( | Ukkonen const & | u, |
Word const & | w ) |
bool is_subword | ( | Ukkonen const & | u, |
char const * | w ) |
See is_subword_no_checks(Ukkonen const&, Iterator, Iterator).
LibsemigroupsException | if u.throw_if_contains_unique_letter(w, w + std::strlen(w)) throws. |
bool is_subword | ( | Ukkonen const & | u, |
Iterator | first, | ||
Iterator | last ) |
See is_subword_no_checks(Ukkonen const&, Iterator, Iterator).
LibsemigroupsException | if u.throw_if_contains_unique_letter(first, last) throws. |
bool is_subword | ( | Ukkonen const & | u, |
Word const & | w ) |
See is_subword_no_checks(Ukkonen const&, Iterator, Iterator).
LibsemigroupsException | if u.throw_if_contains_unique_letter(w.cbegin(), w.cend()) throws. |
See is_subword_no_checks(Ukkonen const&, Iterator, Iterator).
LibsemigroupsException | if u.throw_if_contains_unique_letter(w) throws. |
bool is_subword_no_checks | ( | Ukkonen const & | u, |
char const * | w ) |
bool is_subword_no_checks | ( | Ukkonen const & | u, |
Iterator | first, | ||
Iterator | last ) |
Returns true
if the word corresponding to first
and last
is a subword of one of the words in the suffix tree represented by the Ukkonen instance u
.
Iterator | the type of the 2nd and 3rd parameters. |
u | the Ukkonen object. |
first | iterator pointing to the first letter of the word. |
last | one beyond the last letter of the word. |
bool
.first
and last
.first
and last
contains any of the unique letters appended to the end of any existing word in the tree, then bad things will happen. bool is_subword_no_checks | ( | Ukkonen const & | u, |
Word const & | w ) |
bool is_suffix | ( | Ukkonen const & | u, |
char const * | w ) |
See is_suffix_no_checks(Ukkonen const&, Iterator, Iterator).
LibsemigroupsException | if u.throw_if_contains_unique_letter(w, w + std::strlen(w)) throws. |
bool is_suffix | ( | Ukkonen const & | u, |
Iterator | first, | ||
Iterator | last ) |
See is_suffix_no_checks(Ukkonen const&, Iterator, Iterator).
LibsemigroupsException | if u.throw_if_contains_unique_letter(first, last) throws. |
bool is_suffix | ( | Ukkonen const & | u, |
Word const & | w ) |
See is_suffix_no_checks(Ukkonen const&, Iterator, Iterator).
LibsemigroupsException | if u.throw_if_contains_unique_letter(w.begin(), w.end()) throws. |
See is_suffix_no_checks(Ukkonen const&, Iterator, Iterator).
LibsemigroupsException | if u.throw_if_contains_unique_letter(w) throws. |
bool is_suffix_no_checks | ( | Ukkonen const & | u, |
char const * | w ) |
bool is_suffix_no_checks | ( | Ukkonen const & | u, |
Iterator | first, | ||
Iterator | last ) |
Returns true
if the word corresponding to first
and last
is a suffix of one of the words in the suffix tree represented by the Ukkonen instance u
.
Iterator | the type of the 2nd and 3rd parameters. |
u | the Ukkonen object. |
first | iterator pointing to the first letter of the word. |
last | one beyond the last letter of the word. |
bool
.first
and last
.first
and last
contains any of the unique letters appended to the end of any existing word in the tree, then bad things will happen. bool is_suffix_no_checks | ( | Ukkonen const & | u, |
Word const & | w ) |
|
inline |
See length_maximal_piece_prefix_no_checks(Ukkonen const&, Iterator, Iterator).
LibsemigroupsException | if u.throw_if_contains_unique_letter(w, w + std::strlen(w)) throws. |
size_t length_maximal_piece_prefix | ( | Ukkonen const & | u, |
Iterator | first, | ||
Iterator | last ) |
See length_maximal_piece_prefix_no_checks(Ukkonen const&, Iterator, Iterator).
LibsemigroupsException | if u.throw_if_contains_unique_letter(first, last) throws. |
size_t length_maximal_piece_prefix | ( | Ukkonen const & | u, |
Word const & | w ) |
See length_maximal_piece_prefix_no_checks(Ukkonen const&, Iterator, Iterator).
LibsemigroupsException | if u.throw_if_contains_unique_letter(w.cbegin(), w.cend()) throws. |
See length_maximal_piece_prefix_no_checks(Ukkonen const&, Iterator, Iterator).
LibsemigroupsException | if u.throw_if_contains_unique_letter(w) throws. |
|
inline |
size_t length_maximal_piece_prefix_no_checks | ( | Ukkonen const & | u, |
Iterator | first, | ||
Iterator | last ) |
Returns the length of the maximal length prefix of the word corresponding to first
and last
that occurs in at least \(2\) different (possibly overlapping) places in the words contained in u
. If no such prefix exists, then 0
is returned.
Iterator | the type of the 2nd and 3rd parameters. |
u | the Ukkonen object. |
first | iterator pointing to the first letter of the word. |
last | one beyond the last letter of the word. |
Iterator
.first
and last
.first
and last
contains any of the unique letters appended to the end of any existing word in the tree, then bad things will happen. size_t length_maximal_piece_prefix_no_checks | ( | Ukkonen const & | u, |
Word const & | w ) |
|
inline |
See length_maximal_piece_suffix_no_checks(Ukkonen const&, Iterator, Iterator).
LibsemigroupsException | if u.throw_if_contains_unique_letter(w, w + std::strlen(w)) throws. |
size_t length_maximal_piece_suffix | ( | Ukkonen const & | u, |
Iterator | first, | ||
Iterator | last ) |
See length_maximal_piece_suffix_no_checks(Ukkonen const&, Iterator, Iterator).
LibsemigroupsException | if u.throw_if_contains_unique_letter(first, last) throws. |
size_t length_maximal_piece_suffix | ( | Ukkonen const & | u, |
Word const & | w ) |
See length_maximal_piece_suffix_no_checks(Ukkonen const&, Iterator, Iterator).
LibsemigroupsException | if u.throw_if_contains_unique_letter(w.cbegin(), w.cend()) throws. |
See length_maximal_piece_suffix_no_checks(Ukkonen const&, Iterator, Iterator).
LibsemigroupsException | if u.throw_if_contains_unique_letter(w) throws. |
|
inline |
size_t length_maximal_piece_suffix_no_checks | ( | Ukkonen const & | u, |
Iterator | first, | ||
Iterator | last ) |
Returns the length of the maximal length prefix of the word corresponding to first
and last
that occurs in at least \(2\) different (possibly overlapping) places in the words contained in u
. If no such prefix exists, then 0
is returned.
Iterator | the type of the 2nd and 3rd parameters. |
u | the Ukkonen object. |
first | iterator pointing to the first letter of the word. |
last | one beyond the last letter of the word. |
Iterator
.first
and last
.first
and last
contains any of the unique letters appended to the end of any existing word in the tree, then bad things will happen. size_t length_maximal_piece_suffix_no_checks | ( | Ukkonen const & | u, |
Word const & | w ) |
|
inline |
See maximal_piece_prefix_no_checks(Ukkonen const&, Iterator, Iterator).
LibsemigroupsException | if u.throw_if_contains_unique_letter(w, w + std::strlen(w)) throws. |
Iterator maximal_piece_prefix | ( | Ukkonen const & | u, |
Iterator | first, | ||
Iterator | last ) |
See maximal_piece_prefix_no_checks(Ukkonen const&, Iterator, Iterator).
LibsemigroupsException | if u.throw_if_contains_unique_letter(first, last) throws. |
Word::const_iterator maximal_piece_prefix | ( | Ukkonen const & | u, |
Word const & | w ) |
See maximal_piece_prefix_no_checks(Ukkonen const&, Iterator, Iterator).
LibsemigroupsException | if u.throw_if_contains_unique_letter(w.cbegin(), w.cend()) throws. |
See maximal_piece_prefix_no_checks(Ukkonen const&, Iterator, Iterator).
LibsemigroupsException | if u.throw_if_contains_unique_letter(w) throws. |
|
inline |
Iterator maximal_piece_prefix_no_checks | ( | Ukkonen const & | u, |
Iterator | first, | ||
Iterator | last ) |
Returns an iterator pointing one past the last letter in the maximal length prefix of the word corresponding to first
and last
that occurs in at least \(2\) different (possibly overlapping) places in the words contained in u
. If no such prefix exists, then first
is returned.
Iterator | the type of the 2nd and 3rd parameters. |
u | the Ukkonen object. |
first | iterator pointing to the first letter of the word. |
last | one beyond the last letter of the word. |
Iterator
.first
and last
.first
and last
contains any of the unique letters appended to the end of any existing word in the tree, then bad things will happen. Word::const_iterator maximal_piece_prefix_no_checks | ( | Ukkonen const & | u, |
Word const & | w ) |
|
inline |
See maximal_piece_suffix_no_checks(Ukkonen const&, Iterator, Iterator).
LibsemigroupsException | if u.throw_if_contains_unique_letter(w, w + std::strlen(w)) throws. |
Iterator maximal_piece_suffix | ( | Ukkonen const & | u, |
Iterator | first, | ||
Iterator | last ) |
See maximal_piece_suffix_no_checks(Ukkonen const&, Iterator, Iterator).
LibsemigroupsException | if u.throw_if_contains_unique_letter(first, last) throws. |
Word::const_iterator maximal_piece_suffix | ( | Ukkonen const & | u, |
Word const & | w ) |
See maximal_piece_suffix_no_checks(Ukkonen const&, Iterator, Iterator).
LibsemigroupsException | if u.throw_if_contains_unique_letter(w.cbegin(), w.cend()) throws. |
See maximal_piece_suffix_no_checks(Ukkonen const&, Iterator, Iterator).
LibsemigroupsException | if u.throw_if_contains_unique_letter(w) throws. |
|
inline |
Iterator maximal_piece_suffix_no_checks | ( | Ukkonen const & | u, |
Iterator | first, | ||
Iterator | last ) |
Returns an iterator pointing at the first letter in the maximal length suffix of the word corresponding to first
and last
that occurs in at least \(2\) different (possibly overlapping) places in the words contained in u
. If no such suffix exists, then first
is returned.
Iterator | the type of the 2nd and 3rd parameters. |
u | the Ukkonen object. |
first | iterator pointing to the first letter of the word. |
last | one beyond the last letter of the word. |
Iterator
.first
and last
and \(n\) is the return value of Ukkonen::length_of_distinct_words.first
and last
contains any of the unique letters appended to the end of any existing word in the tree, then bad things will happen. Word::const_iterator maximal_piece_suffix_no_checks | ( | Ukkonen const & | u, |
Word const & | w ) |
size_t number_of_distinct_subwords | ( | Ukkonen const & | u | ) |
Returns the total number of distinct subwords of the words in the suffix tree u
.
u | the Ukkonen object. |
size_t
.Ukkonen::length_of_distinct_words
.
|
inline |
See number_of_pieces_no_checks(Ukkonen const&, Iterator, Iterator).
LibsemigroupsException | if u.throw_if_contains_unique_letter(w, w + std::strlen(w)) throws. |
size_t number_of_pieces | ( | Ukkonen const & | u, |
Iterator | first, | ||
Iterator | last ) |
See number_of_pieces_no_checks(Ukkonen const&, Iterator, Iterator).
LibsemigroupsException | if u.throw_if_contains_unique_letter(first, last) throws. |
size_t number_of_pieces | ( | Ukkonen const & | u, |
Word const & | w ) |
See number_of_pieces_no_checks(Ukkonen const&, Iterator, Iterator).
LibsemigroupsException | if u.throw_if_contains_unique_letter(w.cbegin(), w.cend()) throws. |
See number_of_pieces_no_checks(Ukkonen const&, Iterator, Iterator).
LibsemigroupsException | if u.throw_if_contains_unique_letter(w) throws. |
|
inline |
size_t number_of_pieces_no_checks | ( | Ukkonen const & | u, |
Iterator | first, | ||
Iterator | last ) |
Returns minimum number of pieces whose product equals the word corresponding to first
and last
if such a product exists, and 0
if no such product exists. Recall that a piece is a word that occurs in two distinct positions (possibly overlapping) of the words in the suffix tree u
.
Iterator | the type of the 2nd and 3rd parameters. |
u | the Ukkonen object. |
first | iterator pointing to the first letter of the word. |
last | one beyond the last letter of the word. |
size_t
.first
and last
.first
and last
contains any of the unique letters appended to the end of any existing word in the tree, then bad things will happen. size_t number_of_pieces_no_checks | ( | Ukkonen const & | u, |
Word const & | w ) |
|
inline |
See pieces_no_checks(Ukkonen const&, Iterator, Iterator).
LibsemigroupsException | if u.throw_if_contains_unique_letter(w, w + std::strlen(w)) throws. |
std::vector< Iterator > pieces | ( | Ukkonen const & | u, |
Iterator | first, | ||
Iterator | last ) |
See pieces_no_checks(Ukkonen const&, Iterator, Iterator).
LibsemigroupsException | if u.throw_if_contains_unique_letter(first, last) throws. |
std::vector< Word > pieces | ( | Ukkonen const & | u, |
Word const & | w ) |
See pieces_no_checks(Ukkonen const&, Iterator, Iterator).
LibsemigroupsException | if u.throw_if_contains_unique_letter(w.cbegin(), w.cend()) throws. |
|
inline |
See pieces_no_checks(Ukkonen const&, Iterator, Iterator).
LibsemigroupsException | if u.throw_if_contains_unique_letter(w) throws. |
std::vector< std::string > pieces_no_checks | ( | Ukkonen const & | u, |
char const * | w ) |
std::vector< Iterator > pieces_no_checks | ( | Ukkonen const & | u, |
Iterator | first, | ||
Iterator | last ) |
Returns a std::vector of iterators pointing one past the last letter in the pieces whose product equals the word corresponding to first
and last
if such a product exists, and an empty std::vector if no such product exists. Recall that a piece is a word that occurs in two distinct positions (possibly overlapping) of the words in the suffix tree u
.
Iterator | the type of the 2nd and 3rd parameters. |
u | the Ukkonen object. |
first | iterator pointing to the first letter of the word. |
last | one beyond the last letter of the word. |
std::vector<Iterator>
.first
and last
.first
and last
contains any of the unique letters appended to the end of any existing word in the tree, then bad things will happen. std::vector< Word > pieces_no_checks | ( | Ukkonen const & | u, |
Word const & | w ) |
std::vector< word_type > pieces_no_checks | ( | Ukkonen const & | u, |
word_type const & | w ) |
std::pair< Ukkonen::State, char const * > traverse | ( | Ukkonen const & | u, |
char const * | w ) |
See traverse_no_checks(Iterator, Iterator) const.
LibsemigroupsException | if u.throw_if_contains_unique_letter(w, w + std::strlen(w)) throws. |
auto traverse | ( | Ukkonen const & | u, |
Word const & | w ) |
See traverse_no_checks(Iterator, Iterator) const.
LibsemigroupsException | if u.throw_if_contains_unique_letter(w.cbegin(), w.cend()) throws. |
std::pair< Ukkonen::State, word_type::const_iterator > traverse | ( | Ukkonen const & | u, |
word_type const & | w ) |
See traverse_no_checks(Iterator, Iterator) const.
LibsemigroupsException | if u.throw_if_contains_unique_letter(w.cbegin(), w.cend()) throws. |
char const * traverse | ( | Ukkonen::State & | st, |
Ukkonen const & | u, | ||
char const * | w ) |
See State&, Iterator, Iterator) const.
LibsemigroupsException | if u.throw_if_contains_unique_letter(w, w + std::strlen(w)) throws. |
auto traverse | ( | Ukkonen::State & | st, |
Ukkonen const & | u, | ||
Word const & | w ) |
See State&, Iterator, Iterator) const.
LibsemigroupsException | if u.throw_if_contains_unique_letter(w.cbegin(), w.cend()) throws. |
word_type::const_iterator traverse | ( | Ukkonen::State & | st, |
Ukkonen const & | u, | ||
word_type const & | w ) |
See State&, Iterator, Iterator) const.
LibsemigroupsException | if u.throw_if_contains_unique_letter(w.cbegin(), w.cend()) throws. |
std::pair< Ukkonen::State, char const * > traverse_no_checks | ( | Ukkonen const & | u, |
char const * | w ) |
auto traverse_no_checks | ( | Ukkonen const & | u, |
Word const & | w ) |
std::pair< Ukkonen::State, word_type::const_iterator > traverse_no_checks | ( | Ukkonen const & | u, |
word_type const & | w ) |
char const * traverse_no_checks | ( | Ukkonen::State & | st, |
Ukkonen const & | u, | ||
char const * | w ) |
auto traverse_no_checks | ( | Ukkonen::State & | st, |
Ukkonen const & | u, | ||
Word const & | w ) |
word_type::const_iterator traverse_no_checks | ( | Ukkonen::State & | st, |
Ukkonen const & | u, | ||
word_type const & | w ) |