This page contains details of the functionality in libsemigroups related to generating words in a given range and in a given order.
This file contains documentation for functionality for:
Namespaces | |
| namespace | libsemigroups::literals |
| Namespace containing some custom literals for creating words. | |
| namespace | libsemigroups::words |
| Namespace containing some operators for creating words. | |
Classes | |
| class | StringRange |
| Class for generating strings in a given range and in a particular order. More... | |
| class | ToString |
| Class for converting word_type into std::string with specified alphabet. More... | |
| class | ToWord< From > |
| Class for converting strings to word_type with specified alphabet. More... | |
| class | WordRange |
| Class for generating words in a given range and in a particular order. More... | |
Functions | |
| detail::const_wilo_iterator | cbegin_wilo (size_t n, size_t upper_bound, word_type &&first, word_type &&last) |
Returns a forward iterator pointing to the 3rd parameter first. | |
| detail::const_wilo_iterator | cbegin_wilo (size_t n, size_t upper_bound, word_type const &first, word_type const &last) |
Returns a forward iterator pointing to the 3rd parameter first. | |
| detail::const_wislo_iterator | cbegin_wislo (size_t n, word_type &&first, word_type &&last) |
Returns a forward iterator pointing to the 2nd parameter first. | |
| detail::const_wislo_iterator | cbegin_wislo (size_t n, word_type const &first, word_type const &last) |
Returns a forward iterator pointing to the 2nd parameter first. | |
| detail::const_wilo_iterator | cend_wilo (size_t n, size_t upper_bound, word_type &&first, word_type &&last) |
Returns a forward iterator pointing to one after the end of the range from first to last. | |
| detail::const_wilo_iterator | cend_wilo (size_t n, size_t upper_bound, word_type const &first, word_type const &last) |
Returns a forward iterator pointing to one after the end of the range from first to last. | |
| detail::const_wislo_iterator | cend_wislo (size_t n, word_type &&first, word_type &&last) |
Returns a forward iterator pointing to one after the end of the range from first to last. | |
| detail::const_wislo_iterator | cend_wislo (size_t n, word_type const &first, word_type const &last) |
Returns a forward iterator pointing to one after the end of the range from first to last. | |
| uint64_t | number_of_words (size_t n, size_t min, size_t max) |
| Returns the number of words over an alphabet with a given number of letters with length in a specified range. | |
| std::string | random_string (std::string const &alphabet, size_t length) |
| Returns a random string. | |
| std::string | random_string (std::string const &alphabet, size_t min, size_t max) |
| Returns a random string. | |
| auto | random_strings (std::string const &alphabet, size_t number, size_t min, size_t max) |
| Returns a range object of random strings. | |
| word_type | random_word (size_t length, size_t nr_letters) |
| Returns a random word. | |
| template<typename Word> | |
| Word & | reverse (Word &&w) |
| Reverse an object. | |
| std::string | to_human_readable_repr (StringRange const &sr, size_t max_width=72) |
| Return a human readable representation of a StringRange object. | |
| std::string | to_human_readable_repr (ToString const &tstr) |
| Return a human readable representation of a ToString object. | |
| std::string | to_human_readable_repr (WordRange const &wr, size_t max_width=72) |
| Return a human readable representation of a WordRange object. | |
| template<typename From> | |
| std::string | to_human_readable_repr (ToWord< From > const &twrd) |
| Return a human readable representation of a ToWord object. | |
|
nodiscard |
Returns a forward iterator used to iterate over words in lexicographic order (wilo). If incremented, the iterator will point to the next least lexicographic word after first over an n letter alphabet with length less than upper_bound. Iterators of the type returned by this function are equal whenever they are obtained by advancing the return value of any call to cbegin_wilo by the same amount, or they are both obtained by any call to cend_wilo.
| n | the number of letters in the alphabet. |
| upper_bound | only words of length less than this value are considered. |
| first | the starting point for the iteration. |
| last | the value one past the end of the last value in the iteration. |
first.upper_bound is required because lexicographical ordering is not a well-ordering, and there might be infinitely many words between a given pair of words.++it the iterator it returned by cbegin_wilo is significantly cheaper than postfix incrementing it++.
|
nodiscard |
Returns a forward iterator pointing to the 3rd parameter first.
Returns a forward iterator used to iterate over words in lexicographic order (wilo). If incremented, the iterator will point to the next least lexicographic word after first over an n letter alphabet with length less than upper_bound. Iterators of the type returned by this function are equal whenever they are obtained by advancing the return value of any call to cbegin_wilo by the same amount, or they are both obtained by any call to cend_wilo.
| n | the number of letters in the alphabet. |
| upper_bound | only words of length less than this value are considered. |
| first | the starting point for the iteration. |
| last | the value one past the end of the last value in the iteration. |
first.upper_bound is required because lexicographical ordering is not a well-ordering, and there might be infinitely many words between a given pair of words.++it the iterator it returned by cbegin_wilo is significantly cheaper than postfix incrementing it++.
|
nodiscard |
Returns a forward iterator used to iterate over words in short-lexicographic order (wislo). If incremented, the iterator will point to the next least short-lex word after w over an n letter alphabet. Iterators of the type returned by this function are equal whenever they are obtained by advancing the return value of any call to cbegin_wislo by the same amount, or they are both obtained by any call to cend_wislo.
| n | the number of letters in the alphabet. |
| first | the starting point for the iteration. |
| last | the ending point for the iteration. |
first.++it the iterator it returned by cbegin_wislo is significantly cheaper than postfix incrementing it++.
|
nodiscard |
Returns a forward iterator pointing to the 2nd parameter first.
Returns a forward iterator used to iterate over words in short-lexicographic order (wislo). If incremented, the iterator will point to the next least short-lex word after w over an n letter alphabet. Iterators of the type returned by this function are equal whenever they are obtained by advancing the return value of any call to cbegin_wislo by the same amount, or they are both obtained by any call to cend_wislo.
| n | the number of letters in the alphabet. |
| first | the starting point for the iteration. |
| last | the ending point for the iteration. |
first.++it the iterator it returned by cbegin_wislo is significantly cheaper than postfix incrementing it++.
|
nodiscard |
The iterator returned by this function is still dereferenceable and incrementable, but does not point to a word in the correct range.
|
nodiscard |
Returns a forward iterator pointing to one after the end of the range from first to last.
The iterator returned by this function is still dereferenceable and incrementable, but does not point to a word in the correct range.
|
nodiscard |
The iterator returned by this is still dereferenceable and incrementable, but does not point to a word in the correct range.
|
nodiscard |
Returns a forward iterator pointing to one after the end of the range from first to last.
The iterator returned by this is still dereferenceable and incrementable, but does not point to a word in the correct range.
|
nodiscard |
Returns the number of words over an alphabet with a given number of letters with length in a specified range.
| n | the number of letters in the alphabet. |
| min | the minimum length of a word. |
| max | one greater than the maximum length of a word. |
uint64_t.| std::string random_string | ( | std::string const & | alphabet, |
| size_t | length ) |
Returns a random string with length length over alphabet alphabet.
| alphabet | the alphabet over which the string is constructed. |
| length | the length of the string. |
std::string.| std::string random_string | ( | std::string const & | alphabet, |
| size_t | min, | ||
| size_t | max ) |
Returns a random string with random length in the range [min, max) over alphabet alphabet.
| alphabet | the alphabet over which the string is constructed. |
| min | the minimum length of the returned string. |
| max | one above the maximum length of the returned string. |
std::string.| LibsemigroupsException | if either:
|
|
inline |
Returns a range object of random strings, each of which with random length in the range [min, max) over alphabet alphabet.
| alphabet | the alphabet over which the string is constructed. |
| number | the number of random strings to construct. |
| min | the minimum length of the returned string. |
| max | one above the maximum length of the returned string. |
| LibsemigroupsException | if either:
|
|
nodiscard |
Returns a random word on \(\{0, \ldots, n - 1\}\) of length length where \(n\) is nr_letters.
| length | the length of the word. |
| nr_letters | the size of the alphabet. |
word_type.| LibsemigroupsException | if nr_letters is 0. |
| Word & reverse | ( | Word && | w | ) |
This function just calls std::reverse(w.begin(), w.end()) and is for convenience.
| Word. |
| w | the word to reverse. |
w.
|
nodiscard |
Return a human readable representation of a StringRange object.
| sr | the StringRange object. |
| max_width | the maximum width of the returned string (default: 72). |
|
inlinenodiscard |
Return a human readable representation of a ToString object.
| tstr | the ToString object. |
|
nodiscard |
Return a human readable representation of a WordRange object.
| wr | the WordRange object. |
| max_width | the maximum width of the returned string (default: 72). |
|
nodiscard |
Return a human readable representation of a ToWord object.
| twrd | the ToWord object. |