Suffix automaton

Short description: Deterministic finite automaton accepting set of all suffixes of particular string

Suffix automaton

Type| Substring index
Invented| 1983
Invented by| Anselm Blumer; Janet Blumer; Andrzej Ehrenfeucht; David Haussler; Ross McConnell
Time complexity in big O notation
| Algorithm|  |  Average|  Worst case

|
|
|

Space|  |  [math]\displaystyle{ O(n) }[/math]|  [math]\displaystyle{ O(n) }[/math]

In computer science, a suffix automaton is an efficient data structure for representing the substring index of a given string which allows the storage, processing, and retrieval of compressed information about all its substrings. The suffix automaton of a string [math]\displaystyle{ S }[/math] is the smallest directed acyclic graph with a dedicated initial vertex and a set of "final" vertices, such that paths from the initial vertex to final vertices represent the suffixes of the string.

In terms of automata theory, a suffix automaton is the minimal partial deterministic finite automaton that recognizes the set of suffixes of a given string [math]\displaystyle{ S=s_1 s_2 \dots s_n }[/math]. The state graph of a suffix automaton is called a directed acyclic word graph (DAWG), a term that is also sometimes used for any deterministic acyclic finite state automaton.

Suffix automata were introduced in 1983 by a group of scientists from the University of Denver and the University of Colorado Boulder. They suggested a linear time online algorithm for its construction and showed that the suffix automaton of a string [math]\displaystyle{ S }[/math] having length at least two characters has at most [math]\displaystyle{ 2|S| - 1 }[/math] states and at most [math]\displaystyle{ 3|S| - 4 }[/math] transitions. Further works have shown a close connection between suffix automata and suffix trees, and have outlined several generalizations of suffix automata, such as compacted suffix automaton obtained by compression of nodes with a single outgoing arc.

Suffix automata provide efficient solutions to problems such as substring search and computation of the largest common substring of two and more strings.

## Contents

* 1 History
* 2 Definitions
* 3 Automaton structure
* 3.1 Automaton states
* 3.2 Connection with suffix trees
* 3.3 Size
* 4 Construction
* 4.1 State updates
* 4.2 Transitions and suffix links updates
* 4.3 Construction algorithm
* 4.4 Complexity
* 5 Generalizations
* 5.1 Compacted suffix automaton
* 5.2 Suffix automaton of several strings
* 5.3 Sliding window
* 6 Applications
* 7 References
* 7.1 Bibliography
* 8 External links

## History

Anselm Blumer with a drawing of generalized CDAWG for strings ababc and abcab

The concept of suffix automaton was introduced in 1983[1] by a group of scientists from University of Denver and University of Colorado Boulder consisting of Anselm Blumer, Janet Blumer, Andrzej Ehrenfeucht, David Haussler and Ross McConnell, although similar concepts had earlier been studied alongside suffix trees in the works of Peter Weiner,[2] Vaughan Pratt[3] and Anatol Slissenko.[4] In their initial work, Blumer et al. showed a suffix automaton built for the string [math]\displaystyle{ S }[/math] of length greater than [math]\displaystyle{ 1 }[/math] has at most [math]\displaystyle{ 2|S|-1 }[/math] states and at most [math]\displaystyle{ 3|S|-4 }[/math] transitions, and suggested a linear algorithm for automaton construction.[5]

In 1983, Mu-Tian Chen and Joel Seiferas independently showed that Weiner's 1973 suffix-tree construction algorithm[2] while building a suffix tree of the string [math]\displaystyle{ S }[/math] constructs a suffix automaton of the reversed string [math]\displaystyle{ S^R }[/math] as an auxiliary structure.[6] In 1987, Blumer et al. applied the compressing technique used in suffix trees to a suffix automaton and invented the compacted suffix automaton, which is also called the compacted directed acyclic word graph (CDAWG).[7] In 1997, Maxime Crochemore and Renaud Vérin developed a linear algorithm for direct CDAWG construction.[1] In 2001, Shunsuke Inenaga et al. developed an algorithm for construction of CDAWG for a set of words given by a trie.[8]

## Definitions

Usually when speaking about suffix automata and related concepts, some notions from formal language theory and automata theory are used, in particular:[9]

* "Alphabet" is a finite set [math]\displaystyle{ \Sigma }[/math] that is used to construct words. Its elements are called "characters";
* "Word" is a finite sequence of characters [math]\displaystyle{ \omega = \omega_1 \omega_2 \dots \omega_n }[/math]. "Length" of the word [math]\displaystyle{ \omega }[/math] is denoted as [math]\displaystyle{ |\omega|=n }[/math];
* "Formal language" is a set of words over given alphabet;
* "Language of all words" is denoted as [math]\displaystyle{ \Sigma^* }[/math](where the "*" character stands for Kleene star), "empty word" (the word of zero length) is denoted by the character [math]\displaystyle{ \varepsilon }[/math];
* "Concatenation of words" [math]\displaystyle{ \alpha = \alpha_1 \alpha_2 \dots \alpha_n }[/math] and [math]\displaystyle{ \beta = \beta_1 \beta_2 \dots \beta_m }[/math] is denoted as [math]\displaystyle{ \alpha \cdot \beta }[/math] or [math]\displaystyle{ \alpha\beta }[/math] and corresponds to the word obtained by writing [math]\displaystyle{ \beta }[/math] to the right of [math]\displaystyle{ \alpha }[/math], that is, [math]\displaystyle{ \alpha \beta = \alpha_1 \alpha_2 \dots \alpha_n \beta_1 \beta_2 \dots \beta_m }[/math];
* "Concatenation of languages" [math]\displaystyle{ A }[/math] and [math]\displaystyle{ B }[/math] is denoted as [math]\displaystyle{ A \cdot B }[/math] or [math]\displaystyle{ AB }[/math] and corresponds to the set of pairwise concatenations [math]\displaystyle{ AB = \\{\alpha \beta : \alpha \in A, \beta \in B\\} }[/math];
* If the word [math]\displaystyle{ \omega\in\Sigma^* }[/math] may be represented as [math]\displaystyle{ \omega = \alpha\gamma\beta }[/math], where [math]\displaystyle{ \alpha,\beta,\gamma \in \Sigma^* }[/math], then words [math]\displaystyle{ \alpha }[/math], [math]\displaystyle{ \beta }[/math] and [math]\displaystyle{ \gamma }[/math] are called "prefix", "suffix" and "subword" (substring) of the word [math]\displaystyle{ \omega }[/math] correspondingly;
* If [math]\displaystyle{ T = T_1 \dots T_n }[/math] and [math]\displaystyle{ T_l T_{l+1} \dots T_r = S }[/math] (with [math]\displaystyle{ 1 \leq l \leq r \leq n }[/math]) then [math]\displaystyle{ S }[/math] is said to "occur" in [math]\displaystyle{ T }[/math] as a subword. Here [math]\displaystyle{ l }[/math] and [math]\displaystyle{ r }[/math] are called left and right positions of occurrence of [math]\displaystyle{ S }[/math] in [math]\displaystyle{ T }[/math] correspondingly.

## Automaton structure

Formally, deterministic finite automaton is determined by 5-tuple [math]\displaystyle{ \mathcal A = (\Sigma, Q, q_0, F, \delta) }[/math], where:[10]

* [math]\displaystyle{ \Sigma }[/math] is an "alphabet" that is used to construct words,
* [math]\displaystyle{ Q }[/math] is a set of automaton "states",
* [math]\displaystyle{ q_0 \in Q }[/math] is an "initial" state of automaton,
* [math]\displaystyle{ F \subset Q }[/math] is a set of "final" states of automaton,
* [math]\displaystyle{ \delta : Q \times \Sigma \mapsto Q }[/math] is a partial "transition" function of automaton, such that [math]\displaystyle{ \delta(q, \sigma) }[/math] for [math]\displaystyle{ q \in Q }[/math] and [math]\displaystyle{ \sigma \in \Sigma }[/math] is either undefined or defines a transition from [math]\displaystyle{ q }[/math] over character [math]\displaystyle{ \sigma }[/math].

Most commonly, deterministic finite automaton is represented as a directed graph ("diagram") such that:[10]

* Set of graph vertices corresponds to the state of states [math]\displaystyle{ Q }[/math],
* Graph has a specific marked vertex corresponding to initial state [math]\displaystyle{ q_0 }[/math],
* Graph has several marked vertices corresponding to the set of final states [math]\displaystyle{ F }[/math],
* Set of graph arcs corresponds to the set of transitions [math]\displaystyle{ \delta }[/math],
* Specifically, every transition [math]\displaystyle{ \delta(q_1, \sigma) = q_2 }[/math] is represented by an arc from [math]\displaystyle{ q_1 }[/math] to [math]\displaystyle{ q_2 }[/math] marked with the character [math]\displaystyle{ \sigma }[/math]. This transition also may be denoted as [math]\displaystyle{ q_1 \begin{smallmatrix}{\sigma}\\\\[-5pt]{\longrightarrow}\end{smallmatrix} q_2 }[/math].

In terms of its diagram, the automaton recognizes the word [math]\displaystyle{ \omega=\omega_1 \omega_2 \dots \omega_m }[/math] only if there is a path from the initial vertex [math]\displaystyle{ q_0 }[/math] to some final vertex [math]\displaystyle{ q \in F }[/math] such that concatenation of characters on this path forms [math]\displaystyle{ \omega }[/math]. The set of words recognized by an automaton forms a language that is set to be recognized by the automaton. In these terms, the language recognized by a suffix automaton of [math]\displaystyle{ S }[/math] is the language of its (possibly empty) suffixes.[9]

### Automaton states

Main page: DFA minimization

"Right context" of the word [math]\displaystyle{ \omega }[/math] with respect to language [math]\displaystyle{ L }[/math] is a set [math]\displaystyle{ [\omega]_R=\\{\alpha : \omega\alpha \in L\\} }[/math] that is a set of words [math]\displaystyle{ \alpha }[/math] such that their concatenation with [math]\displaystyle{ \omega }[/math] forms a word from [math]\displaystyle{ L }[/math]. Right contexts induce a natural equivalence relation [math]\displaystyle{ [\alpha]_R = [\beta]_R }[/math] on the set of all words. If language [math]\displaystyle{ L }[/math] is recognized by some deterministic finite automaton, there exists unique up to isomorphism automaton that recognizes the same language and has the minimum possible number of states. Such an automaton is called a minimal automaton for the given language [math]\displaystyle{ L }[/math]. Myhill–Nerode theorem allows it to define it explicitly in terms of right contexts:[11][12]

Theorem -- Minimal automaton recognizing language [math]\displaystyle{ L }[/math] over the alphabet [math]\displaystyle{ \Sigma }[/math] may be explicitly defined in the following way:

* Alphabet [math]\displaystyle{ \Sigma }[/math] stays the same,
* States [math]\displaystyle{ Q }[/math] correspond to right contexts [math]\displaystyle{ [\omega]_R }[/math] of all possible words [math]\displaystyle{ \omega \in \Sigma^* }[/math],
* Initial state [math]\displaystyle{ q_0 }[/math] corresponds to the right context of the empty word [math]\displaystyle{ [\varepsilon]_R }[/math],
* Final states [math]\displaystyle{ F }[/math] correspond to right contexts [math]\displaystyle{ [\omega]_R }[/math] of words from [math]\displaystyle{ \omega \in L }[/math],
* Transitions [math]\displaystyle{ \delta }[/math] are given by [math]\displaystyle{ [\omega]_R \begin{smallmatrix}{\sigma}\\\\[-5pt]{\longrightarrow}\end{smallmatrix} [\omega\sigma]_R }[/math], where [math]\displaystyle{ \omega \in \Sigma^* }[/math] and [math]\displaystyle{ \sigma \in \Sigma }[/math].

In these terms, a "suffix automaton" is the minimal deterministic finite automaton recognizing the language of suffixes of the word [math]\displaystyle{ S=s_1s_2\dots s_n }[/math]. The right context of the word [math]\displaystyle{ \omega }[/math] with respect to this language consists of words [math]\displaystyle{ \alpha }[/math], such that [math]\displaystyle{ \omega \alpha }[/math] is a suffix of [math]\displaystyle{ S }[/math]. It allows to formulate the following lemma defining a bijection between the right context of the word and the set of right positions of its occurrences in [math]\displaystyle{ S }[/math]:[13][14]

Theorem -- Let [math]\displaystyle{ endpos(\omega)=\\{r: \omega=s_l \dots s_r \\} }[/math] be the set of right positions of occurrences of [math]\displaystyle{ \omega }[/math] in [math]\displaystyle{ S }[/math].

There is a following bijection between [math]\displaystyle{ endpos(\omega) }[/math] and [math]\displaystyle{ [\omega]_R }[/math]:

* If [math]\displaystyle{ x \in endpos(\omega) }[/math], then [math]\displaystyle{ s_{x+1}s_{x+2}\dots s_n \in [\omega]_R }[/math];
* If [math]\displaystyle{ \alpha \in [\omega]_R }[/math], then [math]\displaystyle{ n-\vert\alpha\vert \in endpos(\omega) }[/math].

For example, for the word [math]\displaystyle{ S=abacaba }[/math] and its subword [math]\displaystyle{ \omega = ab }[/math], it holds [math]\displaystyle{ endpos(ab)=\\{2,6\\} }[/math] and [math]\displaystyle{ [ab]_R = \\{a,acaba\\} }[/math]. Informally, [math]\displaystyle{ [ab]_R }[/math] is formed by words that follow occurrences of [math]\displaystyle{ ab }[/math] to the end of [math]\displaystyle{ S }[/math] and [math]\displaystyle{ endpos(ab) }[/math] is formed by right positions of those occurrences. In this example, the element [math]\displaystyle{ x=2 \in endpos(ab) }[/math] corresponds with the word [math]\displaystyle{ s_3 s_4 s_5 s_6 s_7 = acaba \in [ab]_R }[/math] while the word [math]\displaystyle{ a \in [ab]_R }[/math] corresponds with the element [math]\displaystyle{ 7-|a|=6 \in endpos(ab) }[/math].

It implies several structure properties of suffix automaton states. Let [math]\displaystyle{ |\alpha| \leq |\beta| }[/math], then:[14]

* If [math]\displaystyle{ [\alpha]_R }[/math] and [math]\displaystyle{ [\beta]_R }[/math] have at least one common element [math]\displaystyle{ x }[/math], then [math]\displaystyle{ endpos(\alpha) }[/math] and [math]\displaystyle{ endpos(\beta) }[/math] have a common element as well. It implies [math]\displaystyle{ \alpha }[/math] is a suffix of [math]\displaystyle{ \beta }[/math] and therefore [math]\displaystyle{ endpos(\beta) \subset endpos(\alpha) }[/math] and [math]\displaystyle{ [\beta]_R \subset [\alpha]_R }[/math]. In aforementioned example, [math]\displaystyle{ a \in [ab]_R \cap [cab]_R }[/math], so [math]\displaystyle{ ab }[/math] is a suffix of [math]\displaystyle{ cab }[/math] and thus [math]\displaystyle{ [cab]_R=\\{a\\} \subset \\{a,acaba\\} = [ab]_R }[/math] and [math]\displaystyle{ endpos(cab) = \\{6\\} \subset \\{2,6\\} = endpos(ab) }[/math];
* If [math]\displaystyle{ [\alpha]_R=[\beta]_R }[/math], then [math]\displaystyle{ endpos(\alpha)=endpos(\beta) }[/math], thus [math]\displaystyle{ \alpha }[/math] occurs in [math]\displaystyle{ S }[/math] only as a suffix of [math]\displaystyle{ \beta }[/math]. For example, for [math]\displaystyle{ \alpha=b }[/math] and [math]\displaystyle{ \beta = ab }[/math] it holds that [math]\displaystyle{ [b]_R = [ab]_R = \\{a,acaba\\} }[/math] and [math]\displaystyle{ endpos(b)=endpos(ab)=\\{2,6\\} }[/math];
* If [math]\displaystyle{ [\alpha]_R=[\beta]_R }[/math] and [math]\displaystyle{ \gamma }[/math] is a suffix of [math]\displaystyle{ \beta }[/math] such that [math]\displaystyle{ |\alpha| \leq |\gamma| \leq |\beta| }[/math], then [math]\displaystyle{ [\alpha]_R = [\gamma]_R = [\beta]_R }[/math]. In the example above [math]\displaystyle{ [c]_R = [bac]_R = \\{aba\\} }[/math] and it holds for "intermediate" suffix [math]\displaystyle{ \gamma = ac }[/math] that [math]\displaystyle{ [ac]_R = \\{aba\\} }[/math].

Any state [math]\displaystyle{ q = [\alpha]_R }[/math] of the suffix automaton recognizes some continuous chain of nested suffixes of the longest word recognized by this state.[14]

"Left extension" [math]\displaystyle{ \overset{\scriptstyle{\leftarrow}}{\gamma} }[/math] of the string [math]\displaystyle{ \gamma }[/math] is the longest string [math]\displaystyle{ \omega }[/math] that has the same right context as [math]\displaystyle{ \gamma }[/math]. Length [math]\displaystyle{ |\overset{\scriptstyle{\leftarrow}}{\gamma}| }[/math] of the longest string recognized by [math]\displaystyle{ q=[\gamma]_R }[/math] is denoted by [math]\displaystyle{ len(q) }[/math]. It holds:[15]

Theorem -- Left extension of [math]\displaystyle{ \gamma }[/math] may be represented as [math]\displaystyle{ \overleftarrow{\gamma} = \beta \gamma }[/math], where [math]\displaystyle{ \beta }[/math] is the longest word such that any occurrence of [math]\displaystyle{ \gamma }[/math] in [math]\displaystyle{ S }[/math] is preceded by [math]\displaystyle{ \beta }[/math].

"Suffix link" [math]\displaystyle{ link(q) }[/math] of the state [math]\displaystyle{ q=[\alpha]_R }[/math] is the pointer to the state [math]\displaystyle{ p }[/math] that contains the largest suffix of [math]\displaystyle{ \alpha }[/math] that is not recognized by [math]\displaystyle{ q }[/math].

In this terms it can be said [math]\displaystyle{ q=[\alpha]_R }[/math] recognizes exactly all suffixes of [math]\displaystyle{ \overset{\scriptstyle{\leftarrow}}{\alpha} }[/math] that is longer than [math]\displaystyle{ len(link(q)) }[/math] and not longer than [math]\displaystyle{ len(q) }[/math]. It also holds:[15]

Theorem -- Suffix links form a tree [math]\displaystyle{ \mathcal T(V, E) }[/math] that may be defined explicitly in the following way:

1. Vertices [math]\displaystyle{ V }[/math] of the tree correspond to left extensions [math]\displaystyle{ \overleftarrow{\omega} }[/math] of all [math]\displaystyle{ S }[/math] substrings,
2. Edges [math]\displaystyle{ E }[/math] of the tree connect pairs of vertices [math]\displaystyle{ (\overleftarrow{\omega},\overleftarrow{\alpha\omega}) }[/math], such that [math]\displaystyle{ \alpha \in \Sigma }[/math] and [math]\displaystyle{ \overleftarrow{\omega} \neq \overleftarrow{\alpha\omega} }[/math].

### Connection with suffix trees

Relationship of the suffix trie, suffix tree, DAWG and CDAWG

Main page: Suffix tree

A "prefix tree" (or "trie") is a rooted directed tree in which arcs are marked by characters in such a way no vertex [math]\displaystyle{ v }[/math] of such tree has two out-going arcs marked with the same character. Some vertices in trie are marked as final. Trie is said to recognize a set of words defined by paths from its root to final vertices. In this way prefix trees are a special kind of deterministic finite automata if you perceive its root as an initial vertex.[16] The "suffix trie" of the word [math]\displaystyle{ S }[/math] is a prefix tree recognizing a set of its suffixes. "A suffix tree" is a tree obtained from a suffix trie via the compaction procedure, during which consequent edges are merged if the degree of the vertex between them is equal to two.[15]

By its definition, a suffix automaton can be obtained via minimization of the suffix trie. It may be shown that a compacted suffix automaton is obtained by both minimization of the suffix tree (if one assumes each string on the edge of the suffix tree is a solid character from the alphabet) and compaction of the suffix automaton.[17] Besides this connection between the suffix tree and the suffix automaton of the same string there is as well a connection between the suffix automaton of the string [math]\displaystyle{ S=s_1 s_2 \dots s_n }[/math] and the suffix tree of the reversed string [math]\displaystyle{ S^R = s_n s_{n-1} \dots s_1 }[/math].[18]

Similarly to right contexts one may introduce "left contexts" [math]\displaystyle{ [\omega]_L = \\{\beta \in \Sigma^* : \beta \omega \in L\\} }[/math], "right extensions" [math]\displaystyle{ \overset{\scriptstyle{\rightarrow}}{\omega~} }[/math] corresponding to the longest string having same left context as [math]\displaystyle{ \omega }[/math] and the equivalence relation [math]\displaystyle{ [\alpha]_L = [\beta]_L }[/math]. If one considers right extensions with respect to the language [math]\displaystyle{ L }[/math] of "prefixes" of the string [math]\displaystyle{ S }[/math] it may be obtained:[15]

Theorem -- Suffix tree of the string [math]\displaystyle{ S }[/math] may be defined explicitly in the following way:

* Vertices [math]\displaystyle{ V }[/math] of the tree correspond to right extensions [math]\displaystyle{ \overrightarrow{\omega} }[/math] of all [math]\displaystyle{ S }[/math] substrings,
* Edges [math]\displaystyle{ E }[/math] correspond to triplets [math]\displaystyle{ (\overrightarrow{\omega},x\alpha, \overrightarrow{\omega x}) }[/math] such that [math]\displaystyle{ x \in \Sigma }[/math] and [math]\displaystyle{ \overrightarrow{\omega x}=\overrightarrow{\omega} x \alpha }[/math].

Here triplet [math]\displaystyle{ (v_1, \omega, v_2) \in E }[/math] means there is an edge from [math]\displaystyle{ v_1 }[/math] to [math]\displaystyle{ v_2 }[/math] with the string [math]\displaystyle{ \omega }[/math] written on it

, which implies the suffix link tree of the string [math]\displaystyle{ S }[/math] and the suffix tree of the string [math]\displaystyle{ S^R }[/math] are isomorphic:[18]

Suffix structures of words "abbcbc" and "cbcbba"

* Suffix automaton of the word "abbcbc"

* Suffix trie, suffix tree and CDAWG of the word "abbcbc"

* Suffix tree of the word "cbcbba"
(Suffix link tree of the word "abbcbc")

Similarly to the case of left extensions, the following lemma holds for right extensions:[15]

Theorem -- Right extension of the string [math]\displaystyle{ \gamma }[/math] may be represented as [math]\displaystyle{ \overrightarrow{\gamma} = \gamma\alpha }[/math], where [math]\displaystyle{ \alpha }[/math] is the longest word such that every occurrence of [math]\displaystyle{ \gamma }[/math] in [math]\displaystyle{ S }[/math] is succeeded by [math]\displaystyle{ \beta }[/math].

### Size

A suffix automaton of the string [math]\displaystyle{ S }[/math] of length [math]\displaystyle{ n\gt 1 }[/math] has at most [math]\displaystyle{ 2n-1 }[/math] states and at most [math]\displaystyle{ 3n-4 }[/math] transitions. These bounds are reached on strings [math]\displaystyle{ abb\dots bb=ab^{n-1} }[/math] and [math]\displaystyle{ abb\dots bc=ab^{n-2}c }[/math] correspondingly.[13] This may be formulated in a stricter way as [math]\displaystyle{ |\delta| \leq |Q| + n - 2 }[/math] where [math]\displaystyle{ |\delta| }[/math] and [math]\displaystyle{ |Q| }[/math] are the numbers of transitions and states in automaton correspondingly.[14]

Maximal suffix automata

* Suffix automaton of [math]\displaystyle{ ab^{n-1} }[/math]

* Suffix automaton of [math]\displaystyle{ ab^{n-2}c }[/math]

## Construction

Initially the automaton only consists of a single state corresponding to the empty word, then characters of the string are added one by one and the automaton is rebuilt on each step incrementally.[19]

### State updates

After a new character is appended to the string, some equivalence classes are altered. Let [math]\displaystyle{ [\alpha]_{R_\omega} }[/math] be the right context of [math]\displaystyle{ \alpha }[/math] with respect to the language of [math]\displaystyle{ \omega }[/math] suffixes. Then the transition from [math]\displaystyle{ [\alpha]_{R_\omega} }[/math] to [math]\displaystyle{ [\alpha]_{R_{\omega x}} }[/math] after [math]\displaystyle{ x }[/math] is appended to [math]\displaystyle{ \omega }[/math] is defined by lemma:[14]

Theorem -- Let [math]\displaystyle{ \alpha, \omega \in \Sigma^* }[/math] be some words over [math]\displaystyle{ \Sigma }[/math] and [math]\displaystyle{ x \in \Sigma }[/math] be some character from this alphabet. Then there is a following correspondence between [math]\displaystyle{ [\alpha]_{R_\omega} }[/math] and [math]\displaystyle{ [\alpha]_{R_{\omega x} } }[/math]:

* [math]\displaystyle{ [\alpha]_{R_{\omega x} } = [\alpha]_{R_\omega}x \cup \\{\varepsilon\\} }[/math] if [math]\displaystyle{ \alpha }[/math] is a suffix of [math]\displaystyle{ \omega x }[/math];
* [math]\displaystyle{ [\alpha]_{R_{\omega x} } = [\alpha]_{R_\omega}x }[/math] otherwise.

After adding [math]\displaystyle{ x }[/math] to the current word [math]\displaystyle{ \omega }[/math] the right context of [math]\displaystyle{ \alpha }[/math] may change significantly only if [math]\displaystyle{ \alpha }[/math] is a suffix of [math]\displaystyle{ \omega x }[/math]. It implies equivalence relation [math]\displaystyle{ \equiv_{R_{\omega x} } }[/math] is a refinement of [math]\displaystyle{ \equiv_{R_\omega} }[/math]. In other words, if [math]\displaystyle{ [\alpha]_{R_{\omega x} } = [\beta]_{R_{\omega x} } }[/math], then [math]\displaystyle{ [\alpha]_{R_{\omega} } = [\beta]_{R_{\omega} } }[/math]. After the addition of a new character at most two equivalence classes of [math]\displaystyle{ \equiv_{R_\omega} }[/math] will be split and each of them may split in at most two new classes. First, equivalence class corresponding to empty right context is always split into two equivalence classes, one of them corresponding to [math]\displaystyle{ \omega x }[/math] itself and having [math]\displaystyle{ \\{\varepsilon\\} }[/math] as a right context. This new equivalence class contains exactly [math]\displaystyle{ \omega x }[/math] and all its suffixes that did not occur in [math]\displaystyle{ \omega }[/math], as the right context of such words was empty before and contains only empty word now.[14]

Given the correspondence between states of the suffix automaton and vertices of the suffix tree, it is possible to find out the second state that may possibly split after a new character is appended. The transition from [math]\displaystyle{ \omega }[/math] to [math]\displaystyle{ \omega x }[/math] corresponds to the transition from [math]\displaystyle{ \omega^R }[/math] to [math]\displaystyle{ x \omega^R }[/math] in the reversed string. In terms of suffix trees it corresponds to the insertion of the new longest suffix [math]\displaystyle{ x\omega^R }[/math] into the suffix tree of [math]\displaystyle{ \omega^R }[/math]. At most two new vertices may be formed after this insertion: one of them corresponding to [math]\displaystyle{ x \omega^R }[/math], while the other one corresponds to its direct ancestor if there was a branching. Returning to suffix automata, it means the first new state recognizes [math]\displaystyle{ \omega x }[/math] and the second one (if there is a second new state) is its suffix link. It may be stated as a lemma:[14]

Theorem -- Let [math]\displaystyle{ \omega \in \Sigma^* }[/math], [math]\displaystyle{ x \in \Sigma }[/math] be some word and character over [math]\displaystyle{ \Sigma }[/math]. Also let [math]\displaystyle{ \alpha }[/math] be the longest suffix of [math]\displaystyle{ \omega x }[/math], which occurs in [math]\displaystyle{ \omega }[/math], and let [math]\displaystyle{ \beta=\overset{\scriptstyle{\leftarrow} }{\alpha} }[/math]. Then for any substrings [math]\displaystyle{ u,v }[/math] of [math]\displaystyle{ \omega }[/math] it holds:

* If [math]\displaystyle{ [u]_{R_\omega} = [v]_{R_\omega} }[/math] and [math]\displaystyle{ [u]_{R_\omega} \neq [\alpha]_{R_\omega} }[/math], then [math]\displaystyle{ [u]_{R_{\omega x} } = [v]_{R_{\omega x} } }[/math];
* If [math]\displaystyle{ [u]_{R_\omega} = [\alpha]_{R_\omega} }[/math] and [math]\displaystyle{ \vert u\vert \leq \vert \alpha\vert }[/math], then [math]\displaystyle{ [u]_{R_{\omega x} } = [\alpha]_{R_{\omega x} } }[/math];
* If [math]\displaystyle{ [u]_{R_\omega} = [\alpha]_{R_\omega} }[/math] and [math]\displaystyle{ \vert u\vert \gt \vert \alpha\vert }[/math], then [math]\displaystyle{ [u]_{R_{\omega x} } = [\beta]_{R_{\omega x} } }[/math].

It implies that if [math]\displaystyle{ \alpha=\beta }[/math] (for example, when [math]\displaystyle{ x }[/math] didn't occur in [math]\displaystyle{ \omega }[/math] at all and [math]\displaystyle{ \alpha=\beta=\varepsilon }[/math]), then only the equivalence class corresponding to the empty right context is split.[14]

Besides suffix links it is also needed to define final states of the automaton. It follows from structure properties that all suffixes of a word [math]\displaystyle{ \alpha }[/math] recognized by [math]\displaystyle{ q=[\alpha]_R }[/math] are recognized by some vertex on suffix path [math]\displaystyle{ (q, link(q), link^2(q), \dots) }[/math] of [math]\displaystyle{ q }[/math]. Namely, suffixes with length greater than [math]\displaystyle{ len(link(q)) }[/math] lie in [math]\displaystyle{ q }[/math], suffixes with length greater than [math]\displaystyle{ len(link(link(q)) }[/math] but not greater than [math]\displaystyle{ len(link(q)) }[/math] lie in [math]\displaystyle{ link(q) }[/math] and so on. Thus if the state recognizing [math]\displaystyle{ \omega }[/math] is denoted by [math]\displaystyle{ last }[/math], then all final states (that is, recognizing suffixes of [math]\displaystyle{ \omega }[/math]) form up the sequence [math]\displaystyle{ (last, link(last), link^2(last), \dots) }[/math].[19]

### Transitions and suffix links updates

After the character [math]\displaystyle{ x }[/math] is appended to [math]\displaystyle{ \omega }[/math] possible new states of suffix automaton are [math]\displaystyle{ [\omega x]_{R_{\omega x} } }[/math] and [math]\displaystyle{ [\alpha]_{R_{\omega x} } }[/math]. Suffix link from [math]\displaystyle{ [\omega x]_{R_{\omega x} } }[/math] goes to [math]\displaystyle{ [\alpha]_{R_{\omega x} } }[/math] and from [math]\displaystyle{ [\alpha]_{R_{\omega x} } }[/math] it goes to [math]\displaystyle{ link([\alpha]_{R_{\omega} }) }[/math]. Words from [math]\displaystyle{ [\omega x]_{R_{\omega x} } }[/math] occur in [math]\displaystyle{ \omega x }[/math] only as its suffixes therefore there should be no transitions at all from [math]\displaystyle{ [\omega x]_{R_{\omega x}} }[/math] while transitions to it should go from suffixes of [math]\displaystyle{ \omega }[/math] having length at least [math]\displaystyle{ \alpha }[/math] and be marked with the character [math]\displaystyle{ x }[/math]. State [math]\displaystyle{ [\alpha]_{R_{\omega x}} }[/math] is formed by subset of [math]\displaystyle{ [\alpha]_{R_\omega} }[/math], thus transitions from [math]\displaystyle{ [\alpha]_{R_{\omega x}} }[/math] should be same as from [math]\displaystyle{ [\alpha]_{R_\omega} }[/math]. Meanwhile, transitions leading to [math]\displaystyle{ [\alpha]_{R_{\omega x}} }[/math] should go from suffixes of [math]\displaystyle{ \omega }[/math] having length less than [math]\displaystyle{ |\alpha| }[/math] and at least [math]\displaystyle{ len(link([\alpha]_{R_{\omega} })) }[/math], as such transitions have led to [math]\displaystyle{ [\alpha]_{R_\omega} }[/math] before and corresponded to seceded part of this state. States corresponding to these suffixes may be determined via traversal of suffix link path for [math]\displaystyle{ [\omega]_{R_\omega} }[/math].[19]

Construction of the suffix automaton for the word abbcbc

∅ → a |  |

|

After first character is appended, only one state is created in suffix automaton. | Similarly, only one leaf is added to the suffix tree.
a → ab |  |

|

New transitions are drawn from all previous final states as b didn't appear before. | For the same reason another leaf is added to the root of the suffix tree.
ab → abb |  |

|

The state 2 recognizes words ab and b, but only b is the new suffix, therefore this word is separated into state 4. | In the suffix tree it corresponds to the split of the edge leading to the vertex 2.
abb → abbc |  |

|

Character c occurs for the first time, so transitions are drawn from all previous final states. | Suffix tree of reverse string has another leaf added to the root.
abbc → abbcb |  |

|

State 4 consists of the only word b, which is suffix, thus the state is not split. | Correspondingly, new leaf is hanged on the vertex 4 in the suffix tree.
abbcb → abbcbc |  |

|

The state 5 recognizes words abbc, bbc, bc and c, but only last two are suffixes of new word, so they're separated into new state 8. | Correspondingly, edge leading to the vertex 5 is split and vertex 8 is put in the middle of the edge.

### Construction algorithm

Theoretical results above lead to the following algorithm that takes character [math]\displaystyle{ x }[/math] and rebuilds the suffix automaton of [math]\displaystyle{ \omega }[/math] into the suffix automaton of [math]\displaystyle{ \omega x }[/math]:[19]

1. The state corresponding to the word [math]\displaystyle{ \omega }[/math] is kept as [math]\displaystyle{ last }[/math];
2. After [math]\displaystyle{ x }[/math] is appended, previous value of [math]\displaystyle{ last }[/math] is stored in the variable [math]\displaystyle{ p }[/math] and [math]\displaystyle{ last }[/math] itself is reassigned to the new state corresponding to [math]\displaystyle{ \omega x }[/math];
3. States corresponding to suffixes of [math]\displaystyle{ \omega }[/math] are updated with transitions to [math]\displaystyle{ last }[/math]. To do this one should go through [math]\displaystyle{ p, link(p), link^2(p),\dots }[/math], until there is a state that already has a transition by [math]\displaystyle{ x }[/math];
4. Once the aforementioned loop is over, there are 3 cases:
1. If none of states on the suffix path had a transition by [math]\displaystyle{ x }[/math], then [math]\displaystyle{ x }[/math] never occurred in [math]\displaystyle{ \omega }[/math] before and the suffix link from [math]\displaystyle{ last }[/math] should lead to [math]\displaystyle{ q_0 }[/math];
2. If the transition by [math]\displaystyle{ x }[/math] is found and leads from the state [math]\displaystyle{ p }[/math] to the state [math]\displaystyle{ q }[/math], such that [math]\displaystyle{ len(p)+1=len(q) }[/math], then [math]\displaystyle{ q }[/math] does not have to be split and it is a suffix link of [math]\displaystyle{ last }[/math];
3. If the transition is found but [math]\displaystyle{ len(q) \gt len(p)+1 }[/math], then words from [math]\displaystyle{ q }[/math] having length at most [math]\displaystyle{ len(p)+1 }[/math] should be segregated into new "clone" state [math]\displaystyle{ cl }[/math];
5. If the previous step was concluded with the creation of [math]\displaystyle{ cl }[/math], transitions from it and its suffix link should copy those of [math]\displaystyle{ q }[/math], at the same time [math]\displaystyle{ cl }[/math] is assigned to be common suffix link of both [math]\displaystyle{ q }[/math] and [math]\displaystyle{ last }[/math];
6. Transitions that have led to [math]\displaystyle{ q }[/math] before but corresponded to words of the length at most [math]\displaystyle{ len(p)+1 }[/math] are redirected to [math]\displaystyle{ cl }[/math]. To do this, one continues going through the suffix path of [math]\displaystyle{ p }[/math] until the state is found such that transition by [math]\displaystyle{ x }[/math] from it doesn't lead to [math]\displaystyle{ q }[/math].

The whole procedure is described by the following pseudo-code:[19]

function add_letter(x):
define p = last
assign last = new_state()
assign len(last) = len(p) + 1
while δ(p, x) is undefined:
assign δ(p, x) = last, p = link(p)
define q = δ(p, x)
if q = last:
assign link(last) = q0
else if len(q) = len(p) + 1:
assign link(last) = q
else:
define cl = new_state()
assign len(cl) = len(p) + 1
assign δ(cl) = δ(q), link(cl) = link(q)
assign link(last) = link(q) = cl
while δ(p, x) = q:
assign δ(p, x) = cl, p = link(p)

Here [math]\displaystyle{ q_0 }[/math] is the initial state of the automaton and [math]\displaystyle{ new\\_state() }[/math] is a function creating new state for it. It is assumed [math]\displaystyle{ last }[/math], [math]\displaystyle{ len }[/math], [math]\displaystyle{ link }[/math] and [math]\displaystyle{ \delta }[/math] are stored as global variables.[19]

### Complexity

Complexity of the algorithm may vary depending on the underlying structure used to store transitions of the automaton. It may be implemented in [math]\displaystyle{ O(n \log |\Sigma|) }[/math] with [math]\displaystyle{ O(n) }[/math] memory overhead or in [math]\displaystyle{ O(n) }[/math] with [math]\displaystyle{ O(n |\Sigma|) }[/math] memory overhead if one assumes that memory allocation is done in [math]\displaystyle{ O(1) }[/math]. To obtain such complexity, one has to use the methods of amortized analysis. The value of [math]\displaystyle{ len(p) }[/math] strictly reduces with each iteration of the cycle while it may only increase by as much as one after the first iteration of the cycle on the next add_letter call. Overall value of [math]\displaystyle{ len(p) }[/math] never exceeds [math]\displaystyle{ n }[/math] and it is only increased by one between iterations of appending new letters that suggest total complexity is at most linear as well. The linearity of the second cycle is shown in a similar way.[19]

## Generalizations

The suffix automaton is closely related to other suffix structures and substring indices. Given a suffix automaton of a specific string one may construct its suffix tree via compacting and recursive traversal in linear time.[20] Similar transforms are possible in both directions to switch between the suffix automaton of [math]\displaystyle{ S }[/math] and the suffix tree of reversed string [math]\displaystyle{ S^R }[/math].[18] Other than this several generalizations were developed to construct an automaton for the set of strings given by trie,[8] compacted suffix automation (CDAWG),[7] to maintain the structure of the automaton on the sliding window,[21] and to construct it in a bidirectional way, supporting the insertion of a characters to both the beginning and the end of the string.[22]

### Compacted suffix automaton

As was already mentioned above, a compacted suffix automaton is obtained via both compaction of a regular suffix automaton (by removing states which are non-final and have exactly one out-going arc) and the minimization of a suffix tree. Similarly to the regular suffix automaton, states of compacted suffix automaton may be defined in explicit manner. A two-way extension [math]\displaystyle{ \overset{\scriptstyle{\longleftrightarrow}}{\gamma} }[/math] of a word [math]\displaystyle{ \gamma }[/math] is the longest word [math]\displaystyle{ \omega = \beta \gamma \alpha }[/math], such that every occurrence of [math]\displaystyle{ \gamma }[/math] in [math]\displaystyle{ S }[/math] is preceded by [math]\displaystyle{ \beta }[/math] and succeeded by [math]\displaystyle{ \alpha }[/math]. In terms of left and right extensions it means that two-way extension is the left extension of the right extension or, which is equivalent, the right extension of the left extension, that is [math]\displaystyle{ \overset{\scriptstyle\longleftrightarrow}{\gamma} = \overset{\scriptstyle\leftarrow}{\overset{\rightarrow}{\gamma}} = \overset{\rightarrow}{\overset{\scriptstyle\leftarrow}{\gamma}} }[/math]. In terms of two-way extensions compacted automaton is defined as follows:[15]

Theorem -- Compacted suffix automaton of the word [math]\displaystyle{ S }[/math] is defined by a pair [math]\displaystyle{ (V, E) }[/math], where:

* [math]\displaystyle{ V = \\{\overleftrightarrow \omega : \omega \in \Sigma^*\\} }[/math] is a set of automaton states;
* [math]\displaystyle{ E = \\{(\overleftrightarrow \omega, x \alpha, \overleftrightarrow {\omega x}) : x \in \Sigma, \alpha \in \Sigma^*, \overleftrightarrow{\omega x} = \overleftrightarrow{\omega} x\alpha\\} }[/math] is a set of automaton transitions.

Two-way extensions induce an equivalence relation [math]\displaystyle{ \overset{\scriptstyle\longleftrightarrow}{\alpha} = \overset{\scriptstyle\longleftrightarrow}{\beta} }[/math] which defines the set of words recognized by the same state of compacted automaton. This equivalence relation is a transitive closure of the relation defined by [math]\displaystyle{ (\overset{\scriptstyle{\rightarrow}}{\alpha\,}=\overset{\scriptstyle{\rightarrow}}{\beta\,}) \vee (\overset{\scriptstyle{\leftarrow}}{\alpha} = \overset{\scriptstyle{\leftarrow}}{\beta}) }[/math], which highlights the fact that a compacted automaton may be obtained by both gluing suffix tree vertices equivalent via [math]\displaystyle{ \overset{\scriptstyle{\leftarrow}}{\alpha} = \overset{\scriptstyle{\leftarrow}}{\beta} }[/math] relation (minimization of the suffix tree) and gluing suffix automaton states equivalent via [math]\displaystyle{ \overset{\scriptstyle{\rightarrow}}{\alpha\,}=\overset{\scriptstyle{\rightarrow}}{\beta\,} }[/math] relation (compaction of suffix automaton).[23] If words [math]\displaystyle{ \alpha }[/math] and [math]\displaystyle{ \beta }[/math] have same right extensions, and words [math]\displaystyle{ \beta }[/math] and [math]\displaystyle{ \gamma }[/math] have same left extensions, then cumulatively all strings [math]\displaystyle{ \alpha }[/math], [math]\displaystyle{ \beta }[/math] and [math]\displaystyle{ \gamma }[/math] have same two-way extensions. At the same time it may happen that neither left nor right extensions of [math]\displaystyle{ \alpha }[/math] and [math]\displaystyle{ \gamma }[/math] coincide. As an example one may take [math]\displaystyle{ S=\beta=ab }[/math], [math]\displaystyle{ \alpha=a }[/math] and [math]\displaystyle{ \gamma=b }[/math], for which left and right extensions are as follows: [math]\displaystyle{ \overset{\scriptstyle{\rightarrow}}{\alpha\,}=\overset{\scriptstyle{\rightarrow}}{\beta\,}=ab=\overset{\scriptstyle{\leftarrow}}{\beta} = \overset{\scriptstyle{\leftarrow}}{\gamma} }[/math], but [math]\displaystyle{ \overset{\scriptstyle{\rightarrow}}{\gamma\,}=b }[/math] and [math]\displaystyle{ \overset{\scriptstyle{\leftarrow}}{\alpha}=a }[/math]. That being said, while equivalence relations of one-way extensions were formed by some continuous chain of nested prefixes or suffixes, bidirectional extensions equivalence relations are more complex and the only thing one may conclude for sure is that strings with the same two-way extension are substrings of the longest string having the same two-way extension, but it may even happen that they don't have any non-empty substring in common. The total number of equivalence classes for this relation does not exceed [math]\displaystyle{ n+1 }[/math] which implies that compacted suffix automaton of the string having length [math]\displaystyle{ n }[/math] has at most [math]\displaystyle{ n+1 }[/math] states. The amount of transitions in such automaton is at most [math]\displaystyle{ 2n-2 }[/math].[15]

### Suffix automaton of several strings

Consider a set of words [math]\displaystyle{ T=\\{S_1, S_2, \dots, S_k\\} }[/math]. It is possible to construct a generalization of suffix automaton that would recognize the language formed up by suffixes of all words from the set. Constraints for the number of states and transitions in such automaton would stay the same as for a single-word automaton if you put [math]\displaystyle{ n = |S_1| + |S_2| + \dots + |S_k| }[/math].[23] The algorithm is similar to the construction of single-word automaton except instead of [math]\displaystyle{ last }[/math] state, function add_letter would work with the state corresponding to the word [math]\displaystyle{ \omega_i }[/math] assuming the transition from the set of words [math]\displaystyle{ \\{\omega_1, \dots, \omega_i, \dots, \omega_k\\} }[/math] to the set [math]\displaystyle{ \\{\omega_1, \dots, \omega_i x, \dots, \omega_k\\} }[/math].[24][25]

This idea is further generalized to the case when [math]\displaystyle{ T }[/math] is not given explicitly but instead is given by a prefix tree with [math]\displaystyle{ Q }[/math] vertices. Mohri et al. showed such an automaton would have at most [math]\displaystyle{ 2Q-2 }[/math] and may be constructed in linear time from its size. At the same time, the number of transitions in such automaton may reach [math]\displaystyle{ O(Q|\Sigma|) }[/math], for example for the set of words [math]\displaystyle{ T=\\{\sigma_1, a\sigma_1, a^2\sigma_1, \dots, a^n \sigma_1, a^n \sigma_2, \dots, a^n \sigma_k \\} }[/math] over the alphabet [math]\displaystyle{ \Sigma=\\{a,\sigma_1,\dots,\sigma_k\\} }[/math] the total length of words is equal to [math]\displaystyle{ O(n^2+nk) }[/math], the number of vertices in corresponding suffix trie is equal to [math]\displaystyle{ O(n+k) }[/math] and corresponding suffix automaton is formed of [math]\displaystyle{ O(n+k) }[/math] states and [math]\displaystyle{ O(nk) }[/math] transitions. Algorithm suggested by Mohri mainly repeats the generic algorithm for building automaton of several strings but instead of growing words one by one, it traverses the trie in a breadth-first search order and append new characters as it meet them in the traversal, which guarantees amortized linear complexity.[26]

### Sliding window

Some compression algorithms, such as LZ77 and RLE may benefit from storing suffix automaton or similar structure not for the whole string but for only last [math]\displaystyle{ k }[/math] its characters while the string is updated. This is because compressing data is usually expressively large and using [math]\displaystyle{ O(n) }[/math] memory is undesirable. In 1985, Janet Blumer developed an algorithm to maintain a suffix automaton on a sliding window of size [math]\displaystyle{ k }[/math] in [math]\displaystyle{ O(nk) }[/math] worst-case and [math]\displaystyle{ O(n \log k) }[/math] on average, assuming characters are distributed independently and uniformly. She also showed [math]\displaystyle{ O(nk) }[/math] complexity cannot be improved: if one considers words construed as a concatenation of several [math]\displaystyle{ (ab)^m c (ab)^m d }[/math] words, where [math]\displaystyle{ k=6m+2 }[/math], then the number of states for the window of size [math]\displaystyle{ k }[/math] would frequently change with jumps of order [math]\displaystyle{ m }[/math], which renders even theoretical improvement of [math]\displaystyle{ O(nk) }[/math] for regular suffix automata impossible.[27]

The same should be true for the suffix tree because its vertices correspond to states of the suffix automaton of the reversed string but this problem may be resolved by not explicitly storing every vertex corresponding to the suffix of the whole string, thus only storing vertices with at least two out-going edges. A variation of McCreight's suffix tree construction algorithm for this task was suggested in 1989 by Edward Fiala and Daniel Greene;[28] several years later a similar result was obtained with the variation of Ukkonen's algorithm by Jesper Larsson.[29][30] The existence of such an algorithm, for compacted suffix automaton that absorbs some properties of both suffix trees and suffix automata, was an open question for a long time until it was discovered by Martin Senft and Tomasz Dvorak in 2008, that it is impossible if the alphabet's size is at least two.[31]

One way to overcome this obstacle is to allow window width to vary a bit while staying [math]\displaystyle{ O(k) }[/math]. It may be achieved by an approximate algorithm suggested by Inenaga et al. in 2004. The window for which suffix automaton is built in this algorithm is not guaranteed to be of length [math]\displaystyle{ k }[/math] but it is guaranteed to be at least [math]\displaystyle{ k }[/math] and at most [math]\displaystyle{ 2k+1 }[/math] while providing linear overall complexity of the algorithm.[32]

## Applications

Suffix automaton of the string [math]\displaystyle{ S }[/math] may be used to solve such problems as:[33][34]

* Counting the number of distinct substrings of [math]\displaystyle{ S }[/math] in [math]\displaystyle{ O(|S|) }[/math] on-line,
* Finding the longest substring of [math]\displaystyle{ S }[/math] occurring at least twice in [math]\displaystyle{ O(|S|) }[/math],
* Finding the longest common substring of [math]\displaystyle{ S }[/math] and [math]\displaystyle{ T }[/math] in [math]\displaystyle{ O(|T|) }[/math],
* Counting the number of occurrences of [math]\displaystyle{ T }[/math] in [math]\displaystyle{ S }[/math] in [math]\displaystyle{ O(|T|) }[/math],
* Finding all occurrences of [math]\displaystyle{ T }[/math] in [math]\displaystyle{ S }[/math] in [math]\displaystyle{ O(|T|+k) }[/math], where [math]\displaystyle{ k }[/math] is the number of occurrences.

It is assumed here that [math]\displaystyle{ T }[/math] is given on the input after suffix automaton of [math]\displaystyle{ S }[/math] is constructed.[33]

Suffix automata are also used in data compression,[35] music retrieval[36][37] and matching on genome sequences.[38]

## References

1. ↑ 1.0 1.1 Crochemore, Vérin (1997), p. 192
2. ↑ 2.0 2.1 Weiner (1973)
3. ↑ Pratt (1973)
4. ↑ Slisenko (1983)
5. ↑ Blumer et al. (1984), p. 109
6. ↑ Chen, Seiferas (1985), p. 97
7. ↑ 7.0 7.1 Blumer et al. (1987), p. 578
8. ↑ 8.0 8.1 Inenaga et al. (2001), p. 1
9. ↑ 9.0 9.1 Crochemore, Hancart (1997), pp. 3—6
10. ↑ 10.0 10.1 Серебряков и др. (2006), pp. 50—54
11. ↑ Рубцов (2019), pp. 89—94
12. ↑ Hopcroft, Ullman (1979), pp. 65—68
13. ↑ 13.0 13.1 Blumer et al. (1984), pp. 111—114
14. ↑ 14.0 14.1 14.2 14.3 14.4 14.5 14.6 14.7 Crochemore, Hancart (1997), pp. 27—31
15. ↑ 15.0 15.1 15.2 15.3 15.4 15.5 15.6 Inenaga et al. (2005), pp. 159—162
16. ↑ Rubinchik, Shur (2018), pp. 1—2
17. ↑ Inenaga et al. (2005), pp. 156—158
18. ↑ 18.0 18.1 18.2 Fujishige et al. (2016), pp. 1—3
19. ↑ 19.0 19.1 19.2 19.3 19.4 19.5 19.6 Crochemore, Hancart (1997), pp. 31—36
20. ↑ Паращенко (2007), pp. 19—22
21. ↑ Blumer (1987), p. 451
22. ↑ Inenaga (2003), p. 1
23. ↑ 23.0 23.1 Blumer et al. (1987), pp. 585—588
24. ↑ Blumer et al. (1987), pp. 588—589
25. ↑ Blumer et al. (1987), p. 593
26. ↑ Mohri et al. (2009), pp. 3558—3560
27. ↑ Blumer (1987), pp. 461—465
28. ↑ Fiala, Greene (1989), p. 490
29. ↑ Larsson (1996)
30. ↑ Brodnik, Jekovec (2018), p. 1
31. ↑ Senft, Dvořák (2008), p. 109
32. ↑ Inenaga et al. (2004)
33. ↑ 33.0 33.1 Crochemore, Hancart (1997), pp. 36—39
34. ↑ Crochemore, Hancart (1997), pp. 39—41
35. ↑ Yamamoto et al. (2014), p. 675
36. ↑ Crochemore et al. (2003), p. 211
37. ↑ Mohri et al. (2009), p. 3553
38. ↑ Faro (2016), p. 145

### Bibliography

* , Wikidata Q90309073
* , Wikidata Q90311855
* , Wikidata Q90327976
* , Wikidata Q90431196
* , Wikidata Q90329833
* , Wikidata Q90413384
* , Wikidata Q90413885
* , Wikidata Q90414195
* , Wikidata Q90432456
* , Wikidata Q90412338
* , Wikidata Q90425560
* , Wikidata Q90410044
* , Wikidata Q90418603
* , Wikidata Q90335534
* , Wikidata Q57518591
* , Wikidata Q90341606
* , Wikidata Q90345535
* , Wikidata Q90427112
* , Wikidata Q90410808
* , Wikidata Q90436837
* , Wikidata Q90300966
* , Wikidata Q90435728
* , Wikidata Q90726647
* , Wikidata Q90426624
* , Wikidata Q90305414
* , Wikidata Q29541479
* , Wikidata Q90348192

## External links

* Suffix automaton article on E-Maxx Algorithms in English

* v
* t
* e

Strings

String metric|

* Approximate string matching
* Bitap algorithm
* Damerau–Levenshtein distance
* Edit distance
* Gestalt Pattern Matching
* Hamming distance
* Jaro–Winkler distance
* Lee distance
* Levenshtein automaton
* Levenshtein distance
* Wagner–Fischer algorithm

String-searching algorithm|

* Apostolico–Giancarlo algorithm
* Boyer–Moore string-search algorithm
* Boyer–Moore–Horspool algorithm
* Knuth–Morris–Pratt algorithm
* Rabin–Karp algorithm

Multiple string searching|

* Aho–Corasick
* Commentz-Walter algorithm

Regular expression|

* Comparison of regular expression engines
* Regular tree grammar
* Thompson's construction
* Nondeterministic finite automaton

Sequence alignment|

* Hirschberg's algorithm
* Needleman–Wunsch algorithm
* Smith–Waterman algorithm

Data structures|

* DAFSA
* Suffix array
* Suffix automaton
* Suffix tree
* Generalized suffix tree
* Rope
* Ternary search tree
* Trie

Other|

* Parsing
* Pattern matching
* Compressed pattern matching
* Longest common subsequence
* Longest common substring
* Sequential pattern mining
* Sorting

0.00

(0 votes)

Original source: https://en.wikipedia.org/wiki/Suffix automaton. Read more

|

Retrieved from "https://handwiki.org/wiki/index.php?title=Suffix_automaton&oldid=3360477"
*[v]: View this template
*[t]: Discuss this template
*[e]: Edit this template