§ Suffix Automata
- We take for granted knowledge of the Myhill nerode theorem to build the minimal automata of the set of suffixes of a string .
- Let the alphabet be , and let us build the suffix automata of .
- Define the language of suffixes of a string as .
- By Myhill Nerode, states of the minimal DFA correspond to strings that are indistinguishable under extensions by a membership oracle of .
- Suppose a state in the DFA corresponds to two strings ( for big and for small) such that . So we have that .
- Now, for all strings such that we also have .
- So the string must look like follows:
- This implies that is a suffix of !
- Strings in the same state correspond to suffixes of the largest string in the state.
- Next, we claim that a state consists of all suffixes upto some length. TODO.
- Therefore, it is helpful to imagine states as "funnels" or "triangles" or "narrowing trapeziums", which have at the top the longest string, and then shorter and shorter suffixes. The suffix link from
a->link points from the base of
a to the top of the trapezium
a->link such that
a->link can be "joined" into a larger trapezium.
§ Suffix Automata must be a DAG
- A cycle in the automata implies that we have an infinite number of strings in the language, since we can traverse along the cycle as many times as we want before we reach a final state.
- Thus, the suffix automata, which accepts a finite language must be a DAG.
- This implies that we can perform dynamic programming on the DAG.
§ Suffix automata: relinking
- Suppose we are inserting a character
c. We are at a state
p which points to a state
q on transitition
- Now since
p:c, we have that
len(q) > len(p). If
p:c is the longest string of
len(p) + 1 = len(q). Otherwise,
q has longest string a string which contains
p:c as a proper suffix, and thus
len(p) + 1 < len(q).
p:c, the suffix link at
q must point to a state which is a proper prefix of
- If I therefore create a state with longest string
p:c, this state
p:c has a longest string longer than
- Thus, it is proper to attach
q->link to the newly created state.