word_to_class_index¶
-
class_index_type
libsemigroups::KnuthBendixCongruenceByPairs::word_to_class_index(word_type const &w)¶ If the congruence, that an object of this type represents, is defined over a semigroup with generators \(A\), then this function defines a surjective function from the set of all words over \(A\) to either \(\{0, 1, \ldots, n - 1\}\), where \(n\) is the number of classes, or to the non-negative integers \(\{0, 1, \ldots\}\) if
thishas infinitely many classes.- Return
The index of the congruence class corresponding to
word.- Complexity
See warning.
- Warning
The function for finding the structure of a congruence may be non-deterministic, or undecidable, and this function may never return a result.
- Note
CongruenceInterface::word_to_class_index and CongruenceInterface::class_index_to_word are mutually inverse functions.
- Parameters
w: the word whose class index we want to find. The parameterwmust be a libsemigroups::word_type consisting of indices of the generators of the semigroup over whichthisis defined.
- Exceptions
LibsemigroupsException: ifwcontains a letter that is out of bounds, or the object has not been fully initialised.std::bad_alloc: if the (possibly infinite) computation uses all the available memory.