Word to class index

This page contains documentation for the member functions of ToddCoxeter that can be used to convert a word into the index of congruence class.

ToddCoxeter.current_index_of(self: ToddCoxeter, w: list[int] | str) int | Undefined

Returns the current index of the class containing a word.

This function returns the current index of the class containing the word w No enumeration is triggered by calls to this function. Unless Runner.finished returns True, the index returned by this function is essentially arbitrary, and can only really be used to check whether or not two words are currently known to belong to the congruence. The returned index is obtained by following the path in current_word_graph from node 0 labelled by the word w. If there is no such path, then UNDEFINED is returned.

Parameters:

w (list[int] | str) – the word.

Returns:

The current index of the class containing the word.

Return type:

int | Undefined

Raises:

LibsemigroupsError – if any of the values in w is out of range, i.e. they do not belong to presentation().alphabet() and Presentation.throw_if_letter_not_in_alphabet raises.

ToddCoxeter.index_of(self: ToddCoxeter, w: list[int] | str) int

Returns the index of the class containing a word.

This function returns the index of the class containing the word w A full enumeration is triggered by calls to this function. If the current_word_graph has not already been standardized, then this function first standardizes it with respect to Order.shortlex; otherwise the existing standardization order is used. The returned index is obtained by following the path in current_word_graph from node 0 labelled by the word w Since a full enumeration is triggered by calls to this function, the word graph is complete, and so the return value is never UNDEFINED.

Parameters:

w (list[int] | str) – the word.

Returns:

The index of the class containing the word.

Return type:

int

Raises:

LibsemigroupsError – if any of the values in w, i.e. they do not belong to presentation().alphabet() and Presentation.throw_if_letter_not_in_alphabet raises.