![Page 1: Incremental Construction of Minimal Acyclic Deterministic ... · Incremental and semi-incremental algorithms for acyclic automata •Incrementalalgorithmfor(lexicographically)sorteddata(Daciuk,](https://reader035.vdocuments.mx/reader035/viewer/2022062317/5fb93a8a8c84bc17a243e985/html5/thumbnails/1.jpg)
Incremental Construction of Minimal Finite
State Automata
Jan Daciuk
Gdansk University of Technology
e-mail: [email protected]
![Page 2: Incremental Construction of Minimal Acyclic Deterministic ... · Incremental and semi-incremental algorithms for acyclic automata •Incrementalalgorithmfor(lexicographically)sorteddata(Daciuk,](https://reader035.vdocuments.mx/reader035/viewer/2022062317/5fb93a8a8c84bc17a243e985/html5/thumbnails/2.jpg)
Overview
• Incrementality and semi-incrementality
• Trie construction, minimization, synchronization
• Incremental algorithm for sorted data
• Unsorted data and confluence states
• Incremental algorithm for unsorted data
• Performance
![Page 3: Incremental Construction of Minimal Acyclic Deterministic ... · Incremental and semi-incremental algorithms for acyclic automata •Incrementalalgorithmfor(lexicographically)sorteddata(Daciuk,](https://reader035.vdocuments.mx/reader035/viewer/2022062317/5fb93a8a8c84bc17a243e985/html5/thumbnails/3.jpg)
Incrementality and automata
• Final automata
� ideal implementation of dictionaries
� very efficient once constructed
� traditional construction needs much memory
• Incremental and semi-incremental construction
requires less memory
• Moore’s law
![Page 4: Incremental Construction of Minimal Acyclic Deterministic ... · Incremental and semi-incremental algorithms for acyclic automata •Incrementalalgorithmfor(lexicographically)sorteddata(Daciuk,](https://reader035.vdocuments.mx/reader035/viewer/2022062317/5fb93a8a8c84bc17a243e985/html5/thumbnails/4.jpg)
Traditional construction
• Construct a trie
a i m
a e
n
t
r
a i
sz
i
on s
i
e
n t
si
en t
st
e z
o n s
e z
o n s
t
• Minimize it
a i m
a e
ri
z
o
n a
i
s
i
e
nt
st
e
z
sno
![Page 5: Incremental Construction of Minimal Acyclic Deterministic ... · Incremental and semi-incremental algorithms for acyclic automata •Incrementalalgorithmfor(lexicographically)sorteddata(Daciuk,](https://reader035.vdocuments.mx/reader035/viewer/2022062317/5fb93a8a8c84bc17a243e985/html5/thumbnails/5.jpg)
Incremental vs. semi-incremental construction
algorithms
start
add word
minimize
start
add word
last?
minimize
last?
stop
stop
reduce
![Page 6: Incremental Construction of Minimal Acyclic Deterministic ... · Incremental and semi-incremental algorithms for acyclic automata •Incrementalalgorithmfor(lexicographically)sorteddata(Daciuk,](https://reader035.vdocuments.mx/reader035/viewer/2022062317/5fb93a8a8c84bc17a243e985/html5/thumbnails/6.jpg)
Incremental and semi-incremental algorithms
for acyclic automata
• Incremental algorithm for (lexicographically) sorted data (Daciuk,
Mihov, Ciura, Deorowicz)
• Incremental algorithm for unsorted data (Aoe, Morimoto, Hase,
Sgarbas, Fakotakis, Kokkinakis, Daciuk, Watson, Revuz. . . )
• Semi-incremental algorithm for data lexicographically sorted on
reversed strings (Revuz)
• Semi-incremental algorithm for data sorted on decreasing length
of strings (Watson)
![Page 7: Incremental Construction of Minimal Acyclic Deterministic ... · Incremental and semi-incremental algorithms for acyclic automata •Incrementalalgorithmfor(lexicographically)sorteddata(Daciuk,](https://reader035.vdocuments.mx/reader035/viewer/2022062317/5fb93a8a8c84bc17a243e985/html5/thumbnails/7.jpg)
Construction of the trie
a i m i e z
![Page 8: Incremental Construction of Minimal Acyclic Deterministic ... · Incremental and semi-incremental algorithms for acyclic automata •Incrementalalgorithmfor(lexicographically)sorteddata(Daciuk,](https://reader035.vdocuments.mx/reader035/viewer/2022062317/5fb93a8a8c84bc17a243e985/html5/thumbnails/8.jpg)
Construction of the trie
a i me
ri
e z
i e z
![Page 9: Incremental Construction of Minimal Acyclic Deterministic ... · Incremental and semi-incremental algorithms for acyclic automata •Incrementalalgorithmfor(lexicographically)sorteddata(Daciuk,](https://reader035.vdocuments.mx/reader035/viewer/2022062317/5fb93a8a8c84bc17a243e985/html5/thumbnails/9.jpg)
Construction of the trie
a i me
ri
e z
i e z
![Page 10: Incremental Construction of Minimal Acyclic Deterministic ... · Incremental and semi-incremental algorithms for acyclic automata •Incrementalalgorithmfor(lexicographically)sorteddata(Daciuk,](https://reader035.vdocuments.mx/reader035/viewer/2022062317/5fb93a8a8c84bc17a243e985/html5/thumbnails/10.jpg)
Construction of the trie
a i me
r
a
i
en t
ie z
i e z
![Page 11: Incremental Construction of Minimal Acyclic Deterministic ... · Incremental and semi-incremental algorithms for acyclic automata •Incrementalalgorithmfor(lexicographically)sorteddata(Daciuk,](https://reader035.vdocuments.mx/reader035/viewer/2022062317/5fb93a8a8c84bc17a243e985/html5/thumbnails/11.jpg)
What is actually minimization?
• M = (Q,Σ, δ, q0, F ), |M | = |Q|
• M is minimal iff ∀M ′:L(M ′)=L(M) |M | < |M ′|
• −→L (q) = {w : δ∗(q, w) ∈ F}, L(M) =−→L (q0)
• p ≡ q iff−→L (p) =
−→L (q).
• M is minimal iff ∀p,q∈Q p ≡ q ⇔ p = q
• −→L (q) =⋃a:δ(q,a) 6=⊥ a
−→L (δ(q, a)) ∪ ∅ q 6∈ F
ε q ∈ F
![Page 12: Incremental Construction of Minimal Acyclic Deterministic ... · Incremental and semi-incremental algorithms for acyclic automata •Incrementalalgorithmfor(lexicographically)sorteddata(Daciuk,](https://reader035.vdocuments.mx/reader035/viewer/2022062317/5fb93a8a8c84bc17a243e985/html5/thumbnails/12.jpg)
What is minimization of a trie?
a i m
a
i
e
n t
st
e
n
t
r
a
i
en t
st
ie z
o n ss
z
i e z
o n son s
![Page 13: Incremental Construction of Minimal Acyclic Deterministic ... · Incremental and semi-incremental algorithms for acyclic automata •Incrementalalgorithmfor(lexicographically)sorteddata(Daciuk,](https://reader035.vdocuments.mx/reader035/viewer/2022062317/5fb93a8a8c84bc17a243e985/html5/thumbnails/13.jpg)
What is minimization of a trie?
a i m
a e
n
t
r
a i
sz
i
on s
i
e
n t
si
en t
st
e z
o n s
e z
o n s
t
![Page 14: Incremental Construction of Minimal Acyclic Deterministic ... · Incremental and semi-incremental algorithms for acyclic automata •Incrementalalgorithmfor(lexicographically)sorteddata(Daciuk,](https://reader035.vdocuments.mx/reader035/viewer/2022062317/5fb93a8a8c84bc17a243e985/html5/thumbnails/14.jpg)
What is minimization of a trie?
a i m
a
i
e
n t
st
e
n
t
r
a
i
en t
st
ie z
o n ss
z
i e z
o n son s
![Page 15: Incremental Construction of Minimal Acyclic Deterministic ... · Incremental and semi-incremental algorithms for acyclic automata •Incrementalalgorithmfor(lexicographically)sorteddata(Daciuk,](https://reader035.vdocuments.mx/reader035/viewer/2022062317/5fb93a8a8c84bc17a243e985/html5/thumbnails/15.jpg)
What is minimization of a trie?
a i m
a
i
e
n t
st
e
n
t
r
a
i
en t
st
ie z
o n ss
z
i e z
o n son s
![Page 16: Incremental Construction of Minimal Acyclic Deterministic ... · Incremental and semi-incremental algorithms for acyclic automata •Incrementalalgorithmfor(lexicographically)sorteddata(Daciuk,](https://reader035.vdocuments.mx/reader035/viewer/2022062317/5fb93a8a8c84bc17a243e985/html5/thumbnails/16.jpg)
What is minimization of a trie?
a i m
a
i
e
n
st
e
n
t
r
a
i
en t
st
ie z
o n ss
z
i e z
o n son s
t
![Page 17: Incremental Construction of Minimal Acyclic Deterministic ... · Incremental and semi-incremental algorithms for acyclic automata •Incrementalalgorithmfor(lexicographically)sorteddata(Daciuk,](https://reader035.vdocuments.mx/reader035/viewer/2022062317/5fb93a8a8c84bc17a243e985/html5/thumbnails/17.jpg)
What is minimization of a trie?
a i m
a
i
est
e
n
t
r
a
i
en t
st
ie z
o n ss
z
i e z
o n son s
tn
![Page 18: Incremental Construction of Minimal Acyclic Deterministic ... · Incremental and semi-incremental algorithms for acyclic automata •Incrementalalgorithmfor(lexicographically)sorteddata(Daciuk,](https://reader035.vdocuments.mx/reader035/viewer/2022062317/5fb93a8a8c84bc17a243e985/html5/thumbnails/18.jpg)
What is minimization of a trie?
a i m
a
i
est
e
n
t
r
a
i
en t
st
ie z
o n ss
z
i e z
o n son s
tn
![Page 19: Incremental Construction of Minimal Acyclic Deterministic ... · Incremental and semi-incremental algorithms for acyclic automata •Incrementalalgorithmfor(lexicographically)sorteddata(Daciuk,](https://reader035.vdocuments.mx/reader035/viewer/2022062317/5fb93a8a8c84bc17a243e985/html5/thumbnails/19.jpg)
What is minimization of a trie?
a i m
a
i
e
e
n
t
r
a
i
en t
st
ie z
o n ss
z
i e z
o n son s
tn
st
![Page 20: Incremental Construction of Minimal Acyclic Deterministic ... · Incremental and semi-incremental algorithms for acyclic automata •Incrementalalgorithmfor(lexicographically)sorteddata(Daciuk,](https://reader035.vdocuments.mx/reader035/viewer/2022062317/5fb93a8a8c84bc17a243e985/html5/thumbnails/20.jpg)
What is minimization of a trie?
a i m
a
i
e
n
t
r
a
i
en t
st
ie z
o n ss
z
i e z
o n son s
tn
es
t
![Page 21: Incremental Construction of Minimal Acyclic Deterministic ... · Incremental and semi-incremental algorithms for acyclic automata •Incrementalalgorithmfor(lexicographically)sorteddata(Daciuk,](https://reader035.vdocuments.mx/reader035/viewer/2022062317/5fb93a8a8c84bc17a243e985/html5/thumbnails/21.jpg)
What is minimization of a trie?
a i m
a e
n
t
r
a
i
en t
st
ie z
o n ss
z
i e z
o n son s
tn
es
i
t
![Page 22: Incremental Construction of Minimal Acyclic Deterministic ... · Incremental and semi-incremental algorithms for acyclic automata •Incrementalalgorithmfor(lexicographically)sorteddata(Daciuk,](https://reader035.vdocuments.mx/reader035/viewer/2022062317/5fb93a8a8c84bc17a243e985/html5/thumbnails/22.jpg)
What is minimization of a trie?
a i m
a e
n
t
r
a
i
en t
st
ie z
o n ss
z
i e z
o n son s
tn
es
t
i
![Page 23: Incremental Construction of Minimal Acyclic Deterministic ... · Incremental and semi-incremental algorithms for acyclic automata •Incrementalalgorithmfor(lexicographically)sorteddata(Daciuk,](https://reader035.vdocuments.mx/reader035/viewer/2022062317/5fb93a8a8c84bc17a243e985/html5/thumbnails/23.jpg)
What is minimization of a trie?
a i m
a e
nr
a
i
en t
st
ie z
o n ss
z
i e z
o n son s
tn
es
t
it
![Page 24: Incremental Construction of Minimal Acyclic Deterministic ... · Incremental and semi-incremental algorithms for acyclic automata •Incrementalalgorithmfor(lexicographically)sorteddata(Daciuk,](https://reader035.vdocuments.mx/reader035/viewer/2022062317/5fb93a8a8c84bc17a243e985/html5/thumbnails/24.jpg)
What is minimization of a trie?
a i m
a e
r
a
i
en t
st
ie z
o n ss
z
i e z
o n son s
tn
es
t
in
![Page 25: Incremental Construction of Minimal Acyclic Deterministic ... · Incremental and semi-incremental algorithms for acyclic automata •Incrementalalgorithmfor(lexicographically)sorteddata(Daciuk,](https://reader035.vdocuments.mx/reader035/viewer/2022062317/5fb93a8a8c84bc17a243e985/html5/thumbnails/25.jpg)
What is minimization of a trie?
a i m
a e
r
a
i
en
st
ie z
o n ss
z
i e z
o n son s
tn
es
t
in
t
![Page 26: Incremental Construction of Minimal Acyclic Deterministic ... · Incremental and semi-incremental algorithms for acyclic automata •Incrementalalgorithmfor(lexicographically)sorteddata(Daciuk,](https://reader035.vdocuments.mx/reader035/viewer/2022062317/5fb93a8a8c84bc17a243e985/html5/thumbnails/26.jpg)
What is minimization of a trie?
a i m
a e
r
a
i
es
t
ie z
o n ss
z
i e z
o n son s
n
es
t
in
tn
![Page 27: Incremental Construction of Minimal Acyclic Deterministic ... · Incremental and semi-incremental algorithms for acyclic automata •Incrementalalgorithmfor(lexicographically)sorteddata(Daciuk,](https://reader035.vdocuments.mx/reader035/viewer/2022062317/5fb93a8a8c84bc17a243e985/html5/thumbnails/27.jpg)
What is minimization of a trie?
a i m
a e
r
a
i
st
ie z
o n ss
z
i e z
o n son s
n
es
t
in
t
e
![Page 28: Incremental Construction of Minimal Acyclic Deterministic ... · Incremental and semi-incremental algorithms for acyclic automata •Incrementalalgorithmfor(lexicographically)sorteddata(Daciuk,](https://reader035.vdocuments.mx/reader035/viewer/2022062317/5fb93a8a8c84bc17a243e985/html5/thumbnails/28.jpg)
What is minimization of a trie?
a i m
a e
r
a
i t
ie z
o n ss
z
i e z
o n son s
n
es
t
in
t
e
s
![Page 29: Incremental Construction of Minimal Acyclic Deterministic ... · Incremental and semi-incremental algorithms for acyclic automata •Incrementalalgorithmfor(lexicographically)sorteddata(Daciuk,](https://reader035.vdocuments.mx/reader035/viewer/2022062317/5fb93a8a8c84bc17a243e985/html5/thumbnails/29.jpg)
What is minimization of a trie?
a i m
a e
r
a
i
ie z
o n ss
z
i e z
o n son s
n
es
t
in
t st
e
![Page 30: Incremental Construction of Minimal Acyclic Deterministic ... · Incremental and semi-incremental algorithms for acyclic automata •Incrementalalgorithmfor(lexicographically)sorteddata(Daciuk,](https://reader035.vdocuments.mx/reader035/viewer/2022062317/5fb93a8a8c84bc17a243e985/html5/thumbnails/30.jpg)
What is minimization of a trie?
a i m
a e
r
a ie z
o n ss
z
i e z
o n son s
n
es
t
in
t
i
![Page 31: Incremental Construction of Minimal Acyclic Deterministic ... · Incremental and semi-incremental algorithms for acyclic automata •Incrementalalgorithmfor(lexicographically)sorteddata(Daciuk,](https://reader035.vdocuments.mx/reader035/viewer/2022062317/5fb93a8a8c84bc17a243e985/html5/thumbnails/31.jpg)
What is minimization of a trie?
a i m
a e
ri
e z
o n ss
z
i e z
o n son s
n
es
t
in
t
a
![Page 32: Incremental Construction of Minimal Acyclic Deterministic ... · Incremental and semi-incremental algorithms for acyclic automata •Incrementalalgorithmfor(lexicographically)sorteddata(Daciuk,](https://reader035.vdocuments.mx/reader035/viewer/2022062317/5fb93a8a8c84bc17a243e985/html5/thumbnails/32.jpg)
The register
How does one check equivalence of two states?
• Use the recursive definition of−→L (q)
• Visit states using postorder, so that children have unique right
languages
• Keep pointers to states with unique−→L (q) in a sparse table
• Use hash function on finality and transitions
Result: Operations on the register are O(1)
![Page 33: Incremental Construction of Minimal Acyclic Deterministic ... · Incremental and semi-incremental algorithms for acyclic automata •Incrementalalgorithmfor(lexicographically)sorteddata(Daciuk,](https://reader035.vdocuments.mx/reader035/viewer/2022062317/5fb93a8a8c84bc17a243e985/html5/thumbnails/33.jpg)
Synchronization
• Add a word to the language of the automaton and minimize
the whole automaton again
� does not pose any restrictions on input data
� the same states have to processed over and over again – slow
• Add a word to the language of the automaton and minimize
the part that will not change in the future
� requires data to be sorted in some way
� faster due to procesing of states only when once
![Page 34: Incremental Construction of Minimal Acyclic Deterministic ... · Incremental and semi-incremental algorithms for acyclic automata •Incrementalalgorithmfor(lexicographically)sorteddata(Daciuk,](https://reader035.vdocuments.mx/reader035/viewer/2022062317/5fb93a8a8c84bc17a243e985/html5/thumbnails/34.jpg)
Synchronization – sorted data
o n ss
z
i e z
o n son s
a i me
r
a
i
e
n t
st
n
t
en t
s
ie z
a
i t
![Page 35: Incremental Construction of Minimal Acyclic Deterministic ... · Incremental and semi-incremental algorithms for acyclic automata •Incrementalalgorithmfor(lexicographically)sorteddata(Daciuk,](https://reader035.vdocuments.mx/reader035/viewer/2022062317/5fb93a8a8c84bc17a243e985/html5/thumbnails/35.jpg)
Synchronization – sorted data
o n ss
z
i e z
o n son s
a i me
r
a
i
e
n t
st
n
t
ie z
ts
a
i
en t
![Page 36: Incremental Construction of Minimal Acyclic Deterministic ... · Incremental and semi-incremental algorithms for acyclic automata •Incrementalalgorithmfor(lexicographically)sorteddata(Daciuk,](https://reader035.vdocuments.mx/reader035/viewer/2022062317/5fb93a8a8c84bc17a243e985/html5/thumbnails/36.jpg)
Incremental construction from sorted data1: function sorted construction;2: w′ ← ε;3: while input not empty do4: s← q0; i← 1; w ← next word;5: while i ≤ |w| and δ(s, wi)! = ⊥ do6: s← δ(s, wi); i← i + 1;7: end while;8: if i ≤ |w′| then repl or reg(δ(s, wi), w′i+1...|w′|); end if;
9: while i ≤ |w| do10: δ(s, wi)← new state; s← δ(s, wi); i← i + 1;11: end while;12: F ← F ∪ {s}; w′ ← w13: end while;14: repl or reg(q0, w′);15: end function;16: function repl or reg(q, v);17: if v 6= ε then18: δ(q, v1)← repl or reg(δ(q, v1), v2...|v|);19: end if;20: if ∃r∈R r ≡ q then21: delete q; return r;22: else23: R← R ∪ {q}; return q;24: end if;25: end function;
![Page 37: Incremental Construction of Minimal Acyclic Deterministic ... · Incremental and semi-incremental algorithms for acyclic automata •Incrementalalgorithmfor(lexicographically)sorteddata(Daciuk,](https://reader035.vdocuments.mx/reader035/viewer/2022062317/5fb93a8a8c84bc17a243e985/html5/thumbnails/37.jpg)
Incremental construction from sorted data1: function sorted construction;2: w′ ← ε;3: while input not empty do4: s← q0; i← 1; w ← next word;5: while i ≤ |w| and δ(s, wi)! = ⊥ do6: s← δ(s, wi); i← i + 1;7: end while;8: if i ≤ |w′| then repl or reg(δ(s, wi), w′i+1...|w′|); end if;
9: while i ≤ |w| do10: δ(s, wi)← new state; s← δ(s, wi); i← i + 1;11: end while;12: F ← F ∪ {s}; w′ ← w13: end while;14: repl or reg(q0, w′);15: end function;16: function repl or reg(q, v);17: if v 6= ε then18: δ(q, v1)← repl or reg(δ(q, v1), v2...|v|);19: end if;20: if ∃r∈R r ≡ q then21: delete q; return r;22: else23: R← R ∪ {q}; return q;24: end if;25: end function;
![Page 38: Incremental Construction of Minimal Acyclic Deterministic ... · Incremental and semi-incremental algorithms for acyclic automata •Incrementalalgorithmfor(lexicographically)sorteddata(Daciuk,](https://reader035.vdocuments.mx/reader035/viewer/2022062317/5fb93a8a8c84bc17a243e985/html5/thumbnails/38.jpg)
Incremental construction from sorted data1: function sorted construction;2: w′ ← ε;3: while input not empty do4: s← q0; i← 1; w ← next word;5: while i ≤ |w| and δ(s, wi)! = ⊥ do6: s← δ(s, wi); i← i + 1;7: end while;8: if i ≤ |w′| then repl or reg(δ(s, wi), w′i+1...|w′|); end if;
9: while i ≤ |w| do10: δ(s, wi)← new state; s← δ(s, wi); i← i + 1;11: end while;12: F ← F ∪ {s}; w′ ← w13: end while;14: repl or reg(q0, w′);15: end function;16: function repl or reg(q, v);17: if v 6= ε then18: δ(q, v1)← repl or reg(δ(q, v1), v2...|v|);19: end if;20: if ∃r∈R r ≡ q then21: delete q; return r;22: else23: R← R ∪ {q}; return q;24: end if;25: end function;
![Page 39: Incremental Construction of Minimal Acyclic Deterministic ... · Incremental and semi-incremental algorithms for acyclic automata •Incrementalalgorithmfor(lexicographically)sorteddata(Daciuk,](https://reader035.vdocuments.mx/reader035/viewer/2022062317/5fb93a8a8c84bc17a243e985/html5/thumbnails/39.jpg)
Incremental construction from sorted data1: function sorted construction;2: w′ ← ε;3: while input not empty do4: s← q0; i← 1; w ← next word;5: while i ≤ |w| and δ(s, wi)! = ⊥ do6: s← δ(s, wi); i← i + 1;7: end while;8: if i ≤ |w′| then repl or reg(δ(s, wi), w′i+1...|w′|); end if;
9: while i ≤ |w| do10: δ(s, wi)← new state; s← δ(s, wi); i← i + 1;11: end while;12: F ← F ∪ {s}; w′ ← w13: end while;14: repl or reg(q0, w′);15: end function;16: function repl or reg(q, v);17: if v 6= ε then18: δ(q, v1)← repl or reg(δ(q, v1), v2...|v|);19: end if;20: if ∃r∈R r ≡ q then21: delete q; return r;22: else23: R← R ∪ {q}; return q;24: end if;25: end function;
![Page 40: Incremental Construction of Minimal Acyclic Deterministic ... · Incremental and semi-incremental algorithms for acyclic automata •Incrementalalgorithmfor(lexicographically)sorteddata(Daciuk,](https://reader035.vdocuments.mx/reader035/viewer/2022062317/5fb93a8a8c84bc17a243e985/html5/thumbnails/40.jpg)
Incremental construction from sorted data1: function sorted construction;2: w′ ← ε;3: while input not empty do4: s← q0; i← 1; w ← next word;5: while i ≤ |w| and δ(s, wi)! = ⊥ do6: s← δ(s, wi); i← i + 1;7: end while;8: if i ≤ |w′| then repl or reg(δ(s, wi), w′i+1...|w′|); end if;
9: while i ≤ |w| do10: δ(s, wi)← new state; s← δ(s, wi); i← i + 1;11: end while;12: F ← F ∪ {s}; w′ ← w13: end while;14: repl or reg(q0, w′);15: end function;16: function repl or reg(q, v);17: if v 6= ε then18: δ(q, v1)←repl or reg(δ(q, v1), v2...|v|);19: end if;20: if ∃r∈R r ≡ q then21: delete q; return r;22: else23: R← R ∪ {q}; return q;24: end if;25: end function;
![Page 41: Incremental Construction of Minimal Acyclic Deterministic ... · Incremental and semi-incremental algorithms for acyclic automata •Incrementalalgorithmfor(lexicographically)sorteddata(Daciuk,](https://reader035.vdocuments.mx/reader035/viewer/2022062317/5fb93a8a8c84bc17a243e985/html5/thumbnails/41.jpg)
Incremental construction from sorted data1: function sorted construction;2: w′ ← ε;3: while input not empty do4: s← q0; i← 1; w ← next word;5: while i ≤ |w| and δ(s, wi)! = ⊥ do6: s← δ(s, wi); i← i + 1;7: end while;8: if i ≤ |w′| then repl or reg(δ(s, wi), w′i+1...|w′|); end if;
9: while i ≤ |w| do10: δ(s, wi)← new state; s← δ(s, wi); i← i + 1;11: end while;12: F ← F ∪ {s}; w′ ← w13: end while;14: repl or reg(q0, w′);15: end function;16: function repl or reg(q, v);17: if v 6= ε then18: δ(q, v1)← repl or reg(δ(q, v1), v2...|v|);19: end if;20: if ∃r∈R r ≡ q then21: delete q; return r;22: else23: R← R ∪ {q}; return q;24: end if;25: end function;
![Page 42: Incremental Construction of Minimal Acyclic Deterministic ... · Incremental and semi-incremental algorithms for acyclic automata •Incrementalalgorithmfor(lexicographically)sorteddata(Daciuk,](https://reader035.vdocuments.mx/reader035/viewer/2022062317/5fb93a8a8c84bc17a243e985/html5/thumbnails/42.jpg)
Incremental construction from sorted data1: function sorted construction;2: w′ ← ε;3: while input not empty do4: s← q0; i← 1; w ← next word;5: while i ≤ |w| and δ(s, wi)! = ⊥ do6: s← δ(s, wi); i← i + 1;7: end while;8: if i ≤ |w′| then repl or reg(δ(s, wi), w′i+1...|w′|); end if;
9: while i ≤ |w| do10: δ(s, wi)← new state; s← δ(s, wi); i← i + 1;11: end while;12: F ← F ∪ {s}; w′ ← w13: end while;14: repl or reg(q0, w′);15: end function;16: function repl or reg(q, v);17: if v 6= ε then18: δ(q, v1)← repl or reg(δ(q, v1), v2...|v|);19: end if;20: if ∃r∈R r ≡ q then21: delete q; return r;22: else23: R← R ∪ {q}; return q;24: end if;25: end function;
![Page 43: Incremental Construction of Minimal Acyclic Deterministic ... · Incremental and semi-incremental algorithms for acyclic automata •Incrementalalgorithmfor(lexicographically)sorteddata(Daciuk,](https://reader035.vdocuments.mx/reader035/viewer/2022062317/5fb93a8a8c84bc17a243e985/html5/thumbnails/43.jpg)
Incremental construction from sorted data –
examples
1: function sorted construction;2: w′ ← ε;3: while input not empty do4: s← q0; i← 1; w ← next word;5: while i ≤ |w| and δ(s, wi)! = ⊥ do6: s← δ(s, wi); i← i + 1;7: end while;8: if i ≤ |w′| then
repl or reg(δ(s, wi), w′i+1...|w′|);end if;
9: while i ≤ |w| do10: δ(s, wi)← new state;
s← δ(s, wi); i← i + 1;11: end while;12: F ← F ∪ {s}; w′ ← w13: end while;14: repl or reg(q0, w′);15: end function;16: function repl or reg(q, v);17: if v 6= ε then18: δ(q, v1)← repl or reg(δ(q, v1), v2...|v|);19: end if;20: if ∃r∈R r ≡ q then21: delete q; return r;22: else23: R← R ∪ {q}; return q;24: end if;25: end function;
a i m
a
i
e
n t
aimaient
![Page 44: Incremental Construction of Minimal Acyclic Deterministic ... · Incremental and semi-incremental algorithms for acyclic automata •Incrementalalgorithmfor(lexicographically)sorteddata(Daciuk,](https://reader035.vdocuments.mx/reader035/viewer/2022062317/5fb93a8a8c84bc17a243e985/html5/thumbnails/44.jpg)
Incremental construction from sorted data –
examples
1: function sorted construction;2: w′ ← ε;3: while input not empty do4: s← q0; i← 1; w ← next word;5: while i ≤ |w| and δ(s, wi)! = ⊥ do6: s← δ(s, wi); i← i + 1;7: end while;8: if i ≤ |w′| then
repl or reg(δ(s, wi), w′i+1...|w′|);end if;
9: while i ≤ |w| do10: δ(s, wi)← new state;
s← δ(s, wi); i← i + 1;11: end while;12: F ← F ∪ {s}; w′ ← w13: end while;14: repl or reg(q0, w′);15: end function;16: function repl or reg(q, v);17: if v 6= ε then18: δ(q, v1)← repl or reg(δ(q, v1), v2...|v|);19: end if;20: if ∃r∈R r ≡ q then21: delete q; return r;22: else23: R← R ∪ {q}; return q;24: end if;25: end function;
a i m
a
i
n t
e
aimais
![Page 45: Incremental Construction of Minimal Acyclic Deterministic ... · Incremental and semi-incremental algorithms for acyclic automata •Incrementalalgorithmfor(lexicographically)sorteddata(Daciuk,](https://reader035.vdocuments.mx/reader035/viewer/2022062317/5fb93a8a8c84bc17a243e985/html5/thumbnails/45.jpg)
Incremental construction from sorted data –
examples
1: function sorted construction;2: w′ ← ε;3: while input not empty do4: s← q0; i← 1; w ← next word;5: while i ≤ |w| and δ(s, wi)! = ⊥ do6: s← δ(s, wi); i← i + 1;7: end while;8: if i ≤ |w′| then
repl or reg(δ(s, wi), w′i+1...|w′|);end if;
9: while i ≤ |w| do10: δ(s, wi)← new state;
s← δ(s, wi); i← i + 1;11: end while;12: F ← F ∪ {s}; w′ ← w13: end while;14: repl or reg(q0, w′);15: end function;16: function repl or reg(q, v);17: if v 6= ε then18: δ(q, v1)← repl or reg(δ(q, v1), v2...|v|);19: end if;20: if ∃r∈R r ≡ q then21: delete q; return r;22: else23: R← R ∪ {q}; return q;24: end if;25: end function;
a i m
a
i
n t
e
aimais
![Page 46: Incremental Construction of Minimal Acyclic Deterministic ... · Incremental and semi-incremental algorithms for acyclic automata •Incrementalalgorithmfor(lexicographically)sorteddata(Daciuk,](https://reader035.vdocuments.mx/reader035/viewer/2022062317/5fb93a8a8c84bc17a243e985/html5/thumbnails/46.jpg)
Incremental construction from sorted data –
examples
1: function sorted construction;2: w′ ← ε;3: while input not empty do4: s← q0; i← 1; w ← next word;5: while i ≤ |w| and δ(s, wi)! = ⊥ do6: s← δ(s, wi); i← i + 1;7: end while;8: if i ≤ |w′| then
repl or reg(δ(s, wi), w′i+1...|w′|);end if;
9: while i ≤ |w| do10: δ(s, wi)← new state;
s← δ(s, wi); i← i + 1;11: end while;12: F ← F ∪ {s}; w′ ← w13: end while;14: repl or reg(q0, w′);15: end function;16: function repl or reg(q, v);17: if v 6= ε then18: δ(q, v1)← repl or reg(δ(q, v1), v2...|v|);19: end if;20: if ∃r∈R r ≡ q then21: delete q; return r;22: else23: R← R ∪ {q}; return q;24: end if;25: end function;
a i m
a
i
n
e
t
aimais
![Page 47: Incremental Construction of Minimal Acyclic Deterministic ... · Incremental and semi-incremental algorithms for acyclic automata •Incrementalalgorithmfor(lexicographically)sorteddata(Daciuk,](https://reader035.vdocuments.mx/reader035/viewer/2022062317/5fb93a8a8c84bc17a243e985/html5/thumbnails/47.jpg)
Incremental construction from sorted data –
examples
1: function sorted construction;2: w′ ← ε;3: while input not empty do4: s← q0; i← 1; w ← next word;5: while i ≤ |w| and δ(s, wi)! = ⊥ do6: s← δ(s, wi); i← i + 1;7: end while;8: if i ≤ |w′| then
repl or reg(δ(s, wi), w′i+1...|w′|);end if;
9: while i ≤ |w| do10: δ(s, wi)← new state;
s← δ(s, wi); i← i + 1;11: end while;12: F ← F ∪ {s}; w′ ← w13: end while;14: repl or reg(q0, w′);15: end function;16: function repl or reg(q, v);17: if v 6= ε then18: δ(q, v1)← repl or reg(δ(q, v1), v2...|v|);19: end if;20: if ∃r∈R r ≡ q then21: delete q; return r;22: else23: R← R ∪ {q}; return q;24: end if;25: end function;
a i m
a
i
n
e
t
aimais
![Page 48: Incremental Construction of Minimal Acyclic Deterministic ... · Incremental and semi-incremental algorithms for acyclic automata •Incrementalalgorithmfor(lexicographically)sorteddata(Daciuk,](https://reader035.vdocuments.mx/reader035/viewer/2022062317/5fb93a8a8c84bc17a243e985/html5/thumbnails/48.jpg)
Incremental construction from sorted data –
examples
1: function sorted construction;2: w′ ← ε;3: while input not empty do4: s← q0; i← 1; w ← next word;5: while i ≤ |w| and δ(s, wi)! = ⊥ do6: s← δ(s, wi); i← i + 1;7: end while;8: if i ≤ |w′| then
repl or reg(δ(s, wi), w′i+1...|w′|);end if;
9: while i ≤ |w| do10: δ(s, wi)← new state;
s← δ(s, wi); i← i + 1;11: end while;12: F ← F ∪ {s}; w′ ← w13: end while;14: repl or reg(q0, w′);15: end function;16: function repl or reg(q, v);17: if v 6= ε then18: δ(q, v1)← repl or reg(δ(q, v1), v2...|v|);19: end if;20: if ∃r∈R r ≡ q then21: delete q; return r;22: else23: R← R ∪ {q}; return q;24: end if;25: end function;
a i m
a
i
e
tn
aimais
![Page 49: Incremental Construction of Minimal Acyclic Deterministic ... · Incremental and semi-incremental algorithms for acyclic automata •Incrementalalgorithmfor(lexicographically)sorteddata(Daciuk,](https://reader035.vdocuments.mx/reader035/viewer/2022062317/5fb93a8a8c84bc17a243e985/html5/thumbnails/49.jpg)
Incremental construction from sorted data –
examples
1: function sorted construction;2: w′ ← ε;3: while input not empty do4: s← q0; i← 1; w ← next word;5: while i ≤ |w| and δ(s, wi)! = ⊥ do6: s← δ(s, wi); i← i + 1;7: end while;8: if i ≤ |w′| then
repl or reg(δ(s, wi), w′i+1...|w′|);end if;
9: while i ≤ |w| do10: δ(s, wi)← new state;
s← δ(s, wi); i← i + 1;11: end while;12: F ← F ∪ {s}; w′ ← w13: end while;14: repl or reg(q0, w′);15: end function;16: function repl or reg(q, v);17: if v 6= ε then18: δ(q, v1)← repl or reg(δ(q, v1), v2...|v|);19: end if;20: if ∃r∈R r ≡ q then21: delete q; return r;22: else23: R← R ∪ {q}; return q;24: end if;25: end function;
t
a i m
a
i
se
n
aimais
![Page 50: Incremental Construction of Minimal Acyclic Deterministic ... · Incremental and semi-incremental algorithms for acyclic automata •Incrementalalgorithmfor(lexicographically)sorteddata(Daciuk,](https://reader035.vdocuments.mx/reader035/viewer/2022062317/5fb93a8a8c84bc17a243e985/html5/thumbnails/50.jpg)
Incremental construction from sorted data –
examples
1: function sorted construction;2: w′ ← ε;3: while input not empty do4: s← q0; i← 1; w ← next word;5: while i ≤ |w| and δ(s, wi)! = ⊥ do6: s← δ(s, wi); i← i + 1;7: end while;8: if i ≤ |w′| then
repl or reg(δ(s, wi), w′i+1...|w′|);end if;
9: while i ≤ |w| do10: δ(s, wi)← new state;
s← δ(s, wi); i← i + 1;11: end while;12: F ← F ∪ {s}; w′ ← w13: end while;14: repl or reg(q0, w′);15: end function;16: function repl or reg(q, v);17: if v 6= ε then18: δ(q, v1)← repl or reg(δ(q, v1), v2...|v|);19: end if;20: if ∃r∈R r ≡ q then21: delete q; return r;22: else23: R← R ∪ {q}; return q;24: end if;25: end function;
a i m
a
i
e
n
s
t
aimait
![Page 51: Incremental Construction of Minimal Acyclic Deterministic ... · Incremental and semi-incremental algorithms for acyclic automata •Incrementalalgorithmfor(lexicographically)sorteddata(Daciuk,](https://reader035.vdocuments.mx/reader035/viewer/2022062317/5fb93a8a8c84bc17a243e985/html5/thumbnails/51.jpg)
Incremental construction from sorted data –
examples
1: function sorted construction;2: w′ ← ε;3: while input not empty do4: s← q0; i← 1; w ← next word;5: while i ≤ |w| and δ(s, wi)! = ⊥ do6: s← δ(s, wi); i← i + 1;7: end while;8: if i ≤ |w′| then
repl or reg(δ(s, wi), w′i+1...|w′|);end if;
9: while i ≤ |w| do10: δ(s, wi)← new state;
s← δ(s, wi); i← i + 1;11: end while;12: F ← F ∪ {s}; w′ ← w13: end while;14: repl or reg(q0, w′);15: end function;16: function repl or reg(q, v);17: if v 6= ε then18: δ(q, v1)← repl or reg(δ(q, v1), v2...|v|);19: end if;20: if ∃r∈R r ≡ q then21: delete q; return r;22: else23: R← R ∪ {q}; return q;24: end if;25: end function;
tn
a i m
a
i
es
aimait
![Page 52: Incremental Construction of Minimal Acyclic Deterministic ... · Incremental and semi-incremental algorithms for acyclic automata •Incrementalalgorithmfor(lexicographically)sorteddata(Daciuk,](https://reader035.vdocuments.mx/reader035/viewer/2022062317/5fb93a8a8c84bc17a243e985/html5/thumbnails/52.jpg)
Incremental construction from sorted data –
examples
1: function sorted construction;2: w′ ← ε;3: while input not empty do4: s← q0; i← 1; w ← next word;5: while i ≤ |w| and δ(s, wi)! = ⊥ do6: s← δ(s, wi); i← i + 1;7: end while;8: if i ≤ |w′| then
repl or reg(δ(s, wi), w′i+1...|w′|);end if;
9: while i ≤ |w| do10: δ(s, wi)← new state;
s← δ(s, wi); i← i + 1;11: end while;12: F ← F ∪ {s}; w′ ← w13: end while;14: repl or reg(q0, w′);15: end function;16: function repl or reg(q, v);17: if v 6= ε then18: δ(q, v1)← repl or reg(δ(q, v1), v2...|v|);19: end if;20: if ∃r∈R r ≡ q then21: delete q; return r;22: else23: R← R ∪ {q}; return q;24: end if;25: end function;
i
tn
a m
a
i
t
es
aimait
![Page 53: Incremental Construction of Minimal Acyclic Deterministic ... · Incremental and semi-incremental algorithms for acyclic automata •Incrementalalgorithmfor(lexicographically)sorteddata(Daciuk,](https://reader035.vdocuments.mx/reader035/viewer/2022062317/5fb93a8a8c84bc17a243e985/html5/thumbnails/53.jpg)
Incremental construction from sorted data –
examples
1: function sorted construction;2: w′ ← ε;3: while input not empty do4: s← q0; i← 1; w ← next word;5: while i ≤ |w| and δ(s, wi)! = ⊥ do6: s← δ(s, wi); i← i + 1;7: end while;8: if i ≤ |w′| then
repl or reg(δ(s, wi), w′i+1...|w′|);end if;
9: while i ≤ |w| do10: δ(s, wi)← new state;
s← δ(s, wi); i← i + 1;11: end while;12: F ← F ∪ {s}; w′ ← w13: end while;14: repl or reg(q0, w′);15: end function;16: function repl or reg(q, v);17: if v 6= ε then18: δ(q, v1)← repl or reg(δ(q, v1), v2...|v|);19: end if;20: if ∃r∈R r ≡ q then21: delete q; return r;22: else23: R← R ∪ {q}; return q;24: end if;25: end function;
i
tn
a m
a
i
est
aime
![Page 54: Incremental Construction of Minimal Acyclic Deterministic ... · Incremental and semi-incremental algorithms for acyclic automata •Incrementalalgorithmfor(lexicographically)sorteddata(Daciuk,](https://reader035.vdocuments.mx/reader035/viewer/2022062317/5fb93a8a8c84bc17a243e985/html5/thumbnails/54.jpg)
Incremental construction from sorted data –
examples
1: function sorted construction;2: w′ ← ε;3: while input not empty do4: s← q0; i← 1; w ← next word;5: while i ≤ |w| and δ(s, wi)! = ⊥ do6: s← δ(s, wi); i← i + 1;7: end while;8: if i ≤ |w′| then
repl or reg(δ(s, wi), w′i+1...|w′|);end if;
9: while i ≤ |w| do10: δ(s, wi)← new state;
s← δ(s, wi); i← i + 1;11: end while;12: F ← F ∪ {s}; w′ ← w13: end while;14: repl or reg(q0, w′);15: end function;16: function repl or reg(q, v);17: if v 6= ε then18: δ(q, v1)← repl or reg(δ(q, v1), v2...|v|);19: end if;20: if ∃r∈R r ≡ q then21: delete q; return r;22: else23: R← R ∪ {q}; return q;24: end if;25: end function;
tn
i
est
a
a i m
aime
![Page 55: Incremental Construction of Minimal Acyclic Deterministic ... · Incremental and semi-incremental algorithms for acyclic automata •Incrementalalgorithmfor(lexicographically)sorteddata(Daciuk,](https://reader035.vdocuments.mx/reader035/viewer/2022062317/5fb93a8a8c84bc17a243e985/html5/thumbnails/55.jpg)
Incremental construction from sorted data –
examples
1: function sorted construction;2: w′ ← ε;3: while input not empty do4: s← q0; i← 1; w ← next word;5: while i ≤ |w| and δ(s, wi)! = ⊥ do6: s← δ(s, wi); i← i + 1;7: end while;8: if i ≤ |w′| then
repl or reg(δ(s, wi), w′i+1...|w′|);end if;
9: while i ≤ |w| do10: δ(s, wi)← new state;
s← δ(s, wi); i← i + 1;11: end while;12: F ← F ∪ {s}; w′ ← w13: end while;14: repl or reg(q0, w′);15: end function;16: function repl or reg(q, v);17: if v 6= ε then18: δ(q, v1)← repl or reg(δ(q, v1), v2...|v|);19: end if;20: if ∃r∈R r ≡ q then21: delete q; return r;22: else23: R← R ∪ {q}; return q;24: end if;25: end function;
tn
i
a
a i m
est
aime
![Page 56: Incremental Construction of Minimal Acyclic Deterministic ... · Incremental and semi-incremental algorithms for acyclic automata •Incrementalalgorithmfor(lexicographically)sorteddata(Daciuk,](https://reader035.vdocuments.mx/reader035/viewer/2022062317/5fb93a8a8c84bc17a243e985/html5/thumbnails/56.jpg)
Incremental construction from sorted data –
examples
1: function sorted construction;2: w′ ← ε;3: while input not empty do4: s← q0; i← 1; w ← next word;5: while i ≤ |w| and δ(s, wi)! = ⊥ do6: s← δ(s, wi); i← i + 1;7: end while;8: if i ≤ |w′| then
repl or reg(δ(s, wi), w′i+1...|w′|);end if;
9: while i ≤ |w| do10: δ(s, wi)← new state;
s← δ(s, wi); i← i + 1;11: end while;12: F ← F ∪ {s}; w′ ← w13: end while;14: repl or reg(q0, w′);15: end function;16: function repl or reg(q, v);17: if v 6= ε then18: δ(q, v1)← repl or reg(δ(q, v1), v2...|v|);19: end if;20: if ∃r∈R r ≡ q then21: delete q; return r;22: else23: R← R ∪ {q}; return q;24: end if;25: end function;
tn
a
a i m
est
i
aime
![Page 57: Incremental Construction of Minimal Acyclic Deterministic ... · Incremental and semi-incremental algorithms for acyclic automata •Incrementalalgorithmfor(lexicographically)sorteddata(Daciuk,](https://reader035.vdocuments.mx/reader035/viewer/2022062317/5fb93a8a8c84bc17a243e985/html5/thumbnails/57.jpg)
Incremental construction from sorted data –
examples
1: function sorted construction;2: w′ ← ε;3: while input not empty do4: s← q0; i← 1; w ← next word;5: while i ≤ |w| and δ(s, wi)! = ⊥ do6: s← δ(s, wi); i← i + 1;7: end while;8: if i ≤ |w′| then
repl or reg(δ(s, wi), w′i+1...|w′|);end if;
9: while i ≤ |w| do10: δ(s, wi)← new state;
s← δ(s, wi); i← i + 1;11: end while;12: F ← F ∪ {s}; w′ ← w13: end while;14: repl or reg(q0, w′);15: end function;16: function repl or reg(q, v);17: if v 6= ε then18: δ(q, v1)← repl or reg(δ(q, v1), v2...|v|);19: end if;20: if ∃r∈R r ≡ q then21: delete q; return r;22: else23: R← R ∪ {q}; return q;24: end if;25: end function;
tn
est
i
a
a i me
aime
![Page 58: Incremental Construction of Minimal Acyclic Deterministic ... · Incremental and semi-incremental algorithms for acyclic automata •Incrementalalgorithmfor(lexicographically)sorteddata(Daciuk,](https://reader035.vdocuments.mx/reader035/viewer/2022062317/5fb93a8a8c84bc17a243e985/html5/thumbnails/58.jpg)
Incremental construction from sorted data –
examples
1: function sorted construction;2: w′ ← ε;3: while input not empty do4: s← q0; i← 1; w ← next word;5: while i ≤ |w| and δ(s, wi)! = ⊥ do6: s← δ(s, wi); i← i + 1;7: end while;8: if i ≤ |w′| then
repl or reg(δ(s, wi), w′i+1...|w′|);end if;
9: while i ≤ |w| do10: δ(s, wi)← new state;
s← δ(s, wi); i← i + 1;11: end while;12: F ← F ∪ {s}; w′ ← w13: end while;14: repl or reg(q0, w′);15: end function;16: function repl or reg(q, v);17: if v 6= ε then18: δ(q, v1)← repl or reg(δ(q, v1), v2...|v|);19: end if;20: if ∃r∈R r ≡ q then21: delete q; return r;22: else23: R← R ∪ {q}; return q;24: end if;25: end function;
tn
est
i
a
a i me
aiment
![Page 59: Incremental Construction of Minimal Acyclic Deterministic ... · Incremental and semi-incremental algorithms for acyclic automata •Incrementalalgorithmfor(lexicographically)sorteddata(Daciuk,](https://reader035.vdocuments.mx/reader035/viewer/2022062317/5fb93a8a8c84bc17a243e985/html5/thumbnails/59.jpg)
Incremental construction from sorted data –
examples
1: function sorted construction;2: w′ ← ε;3: while input not empty do4: s← q0; i← 1; w ← next word;5: while i ≤ |w| and δ(s, wi)! = ⊥ do6: s← δ(s, wi); i← i + 1;7: end while;8: if i ≤ |w′| then
repl or reg(δ(s, wi), w′i+1...|w′|);end if;
9: while i ≤ |w| do10: δ(s, wi)← new state;
s← δ(s, wi); i← i + 1;11: end while;12: F ← F ∪ {s}; w′ ← w13: end while;14: repl or reg(q0, w′);15: end function;16: function repl or reg(q, v);17: if v 6= ε then18: δ(q, v1)← repl or reg(δ(q, v1), v2...|v|);19: end if;20: if ∃r∈R r ≡ q then21: delete q; return r;22: else23: R← R ∪ {q}; return q;24: end if;25: end function;
tn
est
i
a
a i me
n
t
aiment
![Page 60: Incremental Construction of Minimal Acyclic Deterministic ... · Incremental and semi-incremental algorithms for acyclic automata •Incrementalalgorithmfor(lexicographically)sorteddata(Daciuk,](https://reader035.vdocuments.mx/reader035/viewer/2022062317/5fb93a8a8c84bc17a243e985/html5/thumbnails/60.jpg)
Unsorted data – hidden dangers
a i m
a e
ri
e
o n
z
o
n a
z
s
i
s
i
es
n
t
t
![Page 61: Incremental Construction of Minimal Acyclic Deterministic ... · Incremental and semi-incremental algorithms for acyclic automata •Incrementalalgorithmfor(lexicographically)sorteddata(Daciuk,](https://reader035.vdocuments.mx/reader035/viewer/2022062317/5fb93a8a8c84bc17a243e985/html5/thumbnails/61.jpg)
Unsorted data – hidden dangers
a
ri
e
o n
z
o
n
z
s
i
s
es
n
t
t
a i me
ai
![Page 62: Incremental Construction of Minimal Acyclic Deterministic ... · Incremental and semi-incremental algorithms for acyclic automata •Incrementalalgorithmfor(lexicographically)sorteddata(Daciuk,](https://reader035.vdocuments.mx/reader035/viewer/2022062317/5fb93a8a8c84bc17a243e985/html5/thumbnails/62.jpg)
Unsorted data – hidden dangers
ri
e
o n
z
o
n
z
s
i
s
es
n
t
t
a i me
i
a
a
![Page 63: Incremental Construction of Minimal Acyclic Deterministic ... · Incremental and semi-incremental algorithms for acyclic automata •Incrementalalgorithmfor(lexicographically)sorteddata(Daciuk,](https://reader035.vdocuments.mx/reader035/viewer/2022062317/5fb93a8a8c84bc17a243e985/html5/thumbnails/63.jpg)
Unsorted data – hidden dangers
a i m
a e
n
t
r
a i
sz
i
on s
i
e
n t
si
en t
st
e z
o n s
e z
o n s
t
![Page 64: Incremental Construction of Minimal Acyclic Deterministic ... · Incremental and semi-incremental algorithms for acyclic automata •Incrementalalgorithmfor(lexicographically)sorteddata(Daciuk,](https://reader035.vdocuments.mx/reader035/viewer/2022062317/5fb93a8a8c84bc17a243e985/html5/thumbnails/64.jpg)
Unsorted data – hidden dangers
a i m
a e
ri
z
o
n a
i
s
i
e
nt
st
e
z
sno
![Page 65: Incremental Construction of Minimal Acyclic Deterministic ... · Incremental and semi-incremental algorithms for acyclic automata •Incrementalalgorithmfor(lexicographically)sorteddata(Daciuk,](https://reader035.vdocuments.mx/reader035/viewer/2022062317/5fb93a8a8c84bc17a243e985/html5/thumbnails/65.jpg)
Unsorted data – hidden dangers
ri
e
o n
z
o
n
z
s
i
s
es
n
t
t
a i me
i
a
a
![Page 66: Incremental Construction of Minimal Acyclic Deterministic ... · Incremental and semi-incremental algorithms for acyclic automata •Incrementalalgorithmfor(lexicographically)sorteddata(Daciuk,](https://reader035.vdocuments.mx/reader035/viewer/2022062317/5fb93a8a8c84bc17a243e985/html5/thumbnails/66.jpg)
Unsorted data – hidden dangers
a
ri
e
o n
z
o
n
z
s
i
s
es
n
t
t
a i me
ai
i
![Page 67: Incremental Construction of Minimal Acyclic Deterministic ... · Incremental and semi-incremental algorithms for acyclic automata •Incrementalalgorithmfor(lexicographically)sorteddata(Daciuk,](https://reader035.vdocuments.mx/reader035/viewer/2022062317/5fb93a8a8c84bc17a243e985/html5/thumbnails/67.jpg)
Unsorted data – hidden dangers
a
ri
e
o n
z
o
n
z
s
i
s
es
n
t
t
a i me
ai
i
![Page 68: Incremental Construction of Minimal Acyclic Deterministic ... · Incremental and semi-incremental algorithms for acyclic automata •Incrementalalgorithmfor(lexicographically)sorteddata(Daciuk,](https://reader035.vdocuments.mx/reader035/viewer/2022062317/5fb93a8a8c84bc17a243e985/html5/thumbnails/68.jpg)
Unsorted data – hidden dangers
a
ri
e
o n
z
o
n
z
s
i
s
es
n
t
t
a i me
a
st
ii
![Page 69: Incremental Construction of Minimal Acyclic Deterministic ... · Incremental and semi-incremental algorithms for acyclic automata •Incrementalalgorithmfor(lexicographically)sorteddata(Daciuk,](https://reader035.vdocuments.mx/reader035/viewer/2022062317/5fb93a8a8c84bc17a243e985/html5/thumbnails/69.jpg)
Incremental construction from unsorted data1: function unsorted construction;2: while input not empty do3: s← q0; i← 0; w ← next word; push(s, P );4: while i ≤ |w| and δ(s, wi) 6= ⊥ and fanin(δ(s, wi)) ≤ 1 do5: s← δ(s, wi); push(s, P ); i← i + 1;6: end while;7: R← R \ {s}; u← i;8: while i ≤ |w| and δ(s, wi) 6= ⊥ do9: δ(s, wi)← clone(δ(s, wi)); s← δ(s, wi); push(s, P ); i← i + 1;
10: end while;11: while i ≤ |w| do12: s← new state; s← δ(s, wi); push(s, P ); i← i + 1;13: end while;14: F ← F ∪ {s}; pop(P );15: while P not empty do16: if ∃r∈R r ≡ s then17: if i = u and i > 0 then R← R \ {top(P )}; u← u− 1; end if;18: delete s; δ(top(P ), wi)← r;19: else20: R← R ∪ {s}; if i = u then break; end if;21: end if;22: i← i− 1; s← pop(P );23: end while;24: reset P ;25: end while;26: end function;
![Page 70: Incremental Construction of Minimal Acyclic Deterministic ... · Incremental and semi-incremental algorithms for acyclic automata •Incrementalalgorithmfor(lexicographically)sorteddata(Daciuk,](https://reader035.vdocuments.mx/reader035/viewer/2022062317/5fb93a8a8c84bc17a243e985/html5/thumbnails/70.jpg)
Incremental construction from unsorted data1: function unsorted construction;2: while input not empty do3: s← q0; i← 0; w ← next word; push(s, P );4: while i ≤ |w| and δ(s, wi) 6= ⊥ and fanin(δ(s, wi)) ≤ 1 do5: s← δ(s, wi); push(s, P ); i← i + 1;6: end while;7: R← R \ {s}; u← i;8: while i ≤ |w| and δ(s, wi) 6= ⊥ do9: δ(s, wi)← clone(δ(s, wi)); s← δ(s, wi); push(s, P ); i← i + 1;
10: end while;11: while i ≤ |w| do12: s← new state; s← δ(s, wi); push(s, P ); i← i + 1;13: end while;14: F ← F ∪ {s}; pop(P );15: while P not empty do16: if ∃r∈R r ≡ s then17: if i = u and i > 0 then R← R \ {top(P )}; u← u− 1; end if;18: delete s; δ(top(P ), wi)← r;19: else20: R← R ∪ {s}; if i = u then break; end if;21: end if;22: i← i− 1; s← pop(P );23: end while;24: reset P ;25: end while;26: end function;
![Page 71: Incremental Construction of Minimal Acyclic Deterministic ... · Incremental and semi-incremental algorithms for acyclic automata •Incrementalalgorithmfor(lexicographically)sorteddata(Daciuk,](https://reader035.vdocuments.mx/reader035/viewer/2022062317/5fb93a8a8c84bc17a243e985/html5/thumbnails/71.jpg)
Incremental construction from unsorted data1: function unsorted construction;2: while input not empty do3: s← q0; i← 0; w ← next word; push(s, P );4: while i ≤ |w| and δ(s, wi) 6= ⊥ and fanin(δ(s, wi)) ≤ 1 do5: s← δ(s, wi); push(s, P ); i← i + 1;6: end while;7: R← R \ {s}; u← i;8: while i ≤ |w| and δ(s, wi) 6= ⊥ do9: δ(s, wi)← clone(δ(s, wi)); s← δ(s, wi); push(s, P ); i← i + 1;
10: end while;11: while i ≤ |w| do12: s← new state; s← δ(s, wi); push(s, P ); i← i + 1;13: end while;14: F ← F ∪ {s}; pop(P );15: while P not empty do16: if ∃r∈R r ≡ s then17: if i = u and i > 0 then R← R \ {top(P )}; u← u− 1; end if;18: delete s; δ(top(P ), wi)← r;19: else20: R← R ∪ {s}; if i = u then break; end if;21: end if;22: i← i− 1; s← pop(P );23: end while;24: reset P ;25: end while;26: end function;
![Page 72: Incremental Construction of Minimal Acyclic Deterministic ... · Incremental and semi-incremental algorithms for acyclic automata •Incrementalalgorithmfor(lexicographically)sorteddata(Daciuk,](https://reader035.vdocuments.mx/reader035/viewer/2022062317/5fb93a8a8c84bc17a243e985/html5/thumbnails/72.jpg)
Incremental construction from unsorted data1: function unsorted construction;2: while input not empty do3: s← q0; i← 0; w ← next word; push(s, P );4: while i ≤ |w| and δ(s, wi) 6= ⊥ and fanin(δ(s, wi)) ≤ 1 do5: s← δ(s, wi); push(s, P ); i← i + 1;6: end while;7: R← R \ {s}; u← i;8: while i ≤ |w| and δ(s, wi) 6= ⊥ do9: δ(s, wi)← clone(δ(s, wi)); s← δ(s, wi); push(s, P ); i← i + 1;
10: end while;11: while i ≤ |w| do12: s← new state; s← δ(s, wi); push(s, P ); i← i + 1;13: end while;14: F ← F ∪ {s}; pop(P );15: while P not empty do16: if ∃r∈R r ≡ s then17: if i = u and i > 0 then R← R \ {top(P )}; u← u− 1; end if;18: delete s; δ(top(P ), wi)← r;19: else20: R← R ∪ {s}; if i = u then break; end if;21: end if;22: i← i− 1; s← pop(P );23: end while;24: reset P ;25: end while;26: end function;
![Page 73: Incremental Construction of Minimal Acyclic Deterministic ... · Incremental and semi-incremental algorithms for acyclic automata •Incrementalalgorithmfor(lexicographically)sorteddata(Daciuk,](https://reader035.vdocuments.mx/reader035/viewer/2022062317/5fb93a8a8c84bc17a243e985/html5/thumbnails/73.jpg)
Incremental construction from unsorted data1: function unsorted construction;2: while input not empty do3: s← q0; i← 0; w ← next word; push(s, P );4: while i ≤ |w| and δ(s, wi) 6= ⊥ and fanin(δ(s, wi)) ≤ 1 do5: s← δ(s, wi); push(s, P ); i← i + 1;6: end while;7: R← R \ {s}; u← i;8: while i ≤ |w| and δ(s, wi) 6= ⊥ do9: δ(s, wi)← clone(δ(s, wi)); s← δ(s, wi); push(s, P ); i← i + 1;
10: end while;11: while i ≤ |w| do12: s← new state; s← δ(s, wi); push(s, P ); i← i + 1;13: end while;14: F ← F ∪ {s}; pop(P );15: while P not empty do16: if ∃r∈R r ≡ s then17: if i = u and i > 0 then R← R \ {top(P )}; u← u− 1; end if;18: delete s; δ(top(P ), wi)← r;19: else20: R← R ∪ {s}; if i = u then break; end if;21: end if;22: i← i− 1; s← pop(P );23: end while;24: reset P ;25: end while;26: end function;
![Page 74: Incremental Construction of Minimal Acyclic Deterministic ... · Incremental and semi-incremental algorithms for acyclic automata •Incrementalalgorithmfor(lexicographically)sorteddata(Daciuk,](https://reader035.vdocuments.mx/reader035/viewer/2022062317/5fb93a8a8c84bc17a243e985/html5/thumbnails/74.jpg)
Incremental construction from unsorted data1: function unsorted construction;2: while input not empty do3: s← q0; i← 0; w ← next word; push(s, P );4: while i ≤ |w| and δ(s, wi) 6= ⊥ and fanin(δ(s, wi)) ≤ 1 do5: s← δ(s, wi); push(s, P ); i← i + 1;6: end while;7: R← R \ {s}; u← i;8: while i ≤ |w| and δ(s, wi) 6= ⊥ do9: δ(s, wi)← clone(δ(s, wi)); s← δ(s, wi); push(s, P ); i← i + 1;
10: end while;11: while i ≤ |w| do12: s← new state; s← δ(s, wi); push(s, P ); i← i + 1;13: end while;14: F ← F ∪ {s}; pop(P );15: while P not empty do16: if ∃r∈R r ≡ s then17: if i = u and i > 0 then R← R \ {top(P )}; u← u− 1; end if;18: delete s; δ(top(P ), wi)← r;19: else20: R← R ∪ {s}; if i = u then break; end if;21: end if;22: i← i− 1; s← pop(P );23: end while;24: reset P ;25: end while;26: end function;
![Page 75: Incremental Construction of Minimal Acyclic Deterministic ... · Incremental and semi-incremental algorithms for acyclic automata •Incrementalalgorithmfor(lexicographically)sorteddata(Daciuk,](https://reader035.vdocuments.mx/reader035/viewer/2022062317/5fb93a8a8c84bc17a243e985/html5/thumbnails/75.jpg)
Incremental construction from unsorted data1: function unsorted construction;2: while input not empty do3: s← q0; i← 0; w ← next word; push(s, P );4: while i ≤ |w| and δ(s, wi) 6= ⊥ and fanin(δ(s, wi)) ≤ 1 do5: s← δ(s, wi); push(s, P ); i← i + 1;6: end while;7: R← R \ {s}; u← i;8: while i ≤ |w| and δ(s, wi) 6= ⊥ do9: δ(s, wi)← clone(δ(s, wi)); s← δ(s, wi); push(s, P ); i← i + 1;
10: end while;11: while i ≤ |w| do12: s← new state; s← δ(s, wi); push(s, P ); i← i + 1;13: end while;14: F ← F ∪ {s}; pop(P );15: while P not empty do16: if ∃r∈R r ≡ s then17: if i = u and i > 0 then R← R \ {top(P )}; u← u− 1; end if;18: delete s; δ(top(P ), wi)← r;19: else20: R← R ∪ {s}; if i = u then break; end if;21: end if;22: i← i− 1; s← pop(P );23: end while;24: reset P ;25: end while;26: end function;
![Page 76: Incremental Construction of Minimal Acyclic Deterministic ... · Incremental and semi-incremental algorithms for acyclic automata •Incrementalalgorithmfor(lexicographically)sorteddata(Daciuk,](https://reader035.vdocuments.mx/reader035/viewer/2022062317/5fb93a8a8c84bc17a243e985/html5/thumbnails/76.jpg)
Incremental construction from unsorted data1: function unsorted construction;2: while input not empty do3: s← q0; i← 0; w ← next word; push(s, P );4: while i ≤ |w| and δ(s, wi) 6= ⊥ and fanin(δ(s, wi)) ≤ 1 do5: s← δ(s, wi); push(s, P ); i← i + 1;6: end while;7: R← R \ {s}; u← i;8: while i ≤ |w| and δ(s, wi) 6= ⊥ do9: δ(s, wi)← clone(δ(s, wi)); s← δ(s, wi); push(s, P ); i← i + 1;
10: end while;11: while i ≤ |w| do12: s← new state; s← δ(s, wi); push(s, P ); i← i + 1;13: end while;14: F ← F ∪ {s}; pop(P );15: while P not empty do16: if ∃r∈R r ≡ s then17: if i = u and i > 0 then R← R \ {top(P )}; u← u− 1; end if;18: delete s; δ(top(P ), wi)← r;19: else20: R← R ∪ {s}; if i = u then break; end if;21: end if;22: i← i− 1; s← pop(P );23: end while;24: reset P ;25: end while;26: end function;
![Page 77: Incremental Construction of Minimal Acyclic Deterministic ... · Incremental and semi-incremental algorithms for acyclic automata •Incrementalalgorithmfor(lexicographically)sorteddata(Daciuk,](https://reader035.vdocuments.mx/reader035/viewer/2022062317/5fb93a8a8c84bc17a243e985/html5/thumbnails/77.jpg)
Incr. constr. from unsorted data – examples
1: function unsorted construction;2: while input not empty do3: s← q0; i← 0; w ← next word; push(s, P );4: while i ≤ |w| and δ(s, wi) 6= ⊥
and fanin(δ(s, wi)) ≤ 1 do5: s← δ(s, wi); push(s, P ); i← i + 1;6: end while;7: R← R \ {s}; u← i;8: while i ≤ |w| and δ(s, wi) 6= ⊥ do9: δ(s, wi)← clone(δ(s, wi)); s← δ(s, wi);
push(s, P ); i← i + 1;10: end while;11: while i ≤ |w| do12: s← new state; s← δ(s, wi);
push(s, P ); i← i + 1;13: end while;14: F ← F ∪ {s}; pop(P );15: while P not empty do16: if ∃r∈R r ≡ s then17: if i = u and i > 0 then
R← R \ {top(P )}; u← u− 1;end if;
18: delete s; δ(top(P ), wi)← r;19: else20: R← R ∪ {s};
if i = u then break; end if;21: end if;22: i← i− 1; s← pop(P );23: end while;24: reset P ;25: end while;26: end function;
p e u t
peut
![Page 78: Incremental Construction of Minimal Acyclic Deterministic ... · Incremental and semi-incremental algorithms for acyclic automata •Incrementalalgorithmfor(lexicographically)sorteddata(Daciuk,](https://reader035.vdocuments.mx/reader035/viewer/2022062317/5fb93a8a8c84bc17a243e985/html5/thumbnails/78.jpg)
Incr. constr. from unsorted data – examples
1: function unsorted construction;2: while input not empty do3: s← q0; i← 0; w ← next word; push(s, P );4: while i ≤ |w| and δ(s, wi) 6= ⊥
and fanin(δ(s, wi)) ≤ 1 do5: s← δ(s, wi); push(s, P ); i← i + 1;6: end while;7: R← R \ {s}; u← i;8: while i ≤ |w| and δ(s, wi) 6= ⊥ do9: δ(s, wi)← clone(δ(s, wi)); s← δ(s, wi);
push(s, P ); i← i + 1;10: end while;11: while i ≤ |w| do12: s← new state; s← δ(s, wi);
push(s, P ); i← i + 1;13: end while;14: F ← F ∪ {s}; pop(P );15: while P not empty do16: if ∃r∈R r ≡ s then17: if i = u and i > 0 then
R← R \ {top(P )}; u← u− 1;end if;
18: delete s; δ(top(P ), wi)← r;19: else20: R← R ∪ {s};
if i = u then break; end if;21: end if;22: i← i− 1; s← pop(P );23: end while;24: reset P ;25: end while;26: end function;
p e u t
ve u t
veut
![Page 79: Incremental Construction of Minimal Acyclic Deterministic ... · Incremental and semi-incremental algorithms for acyclic automata •Incrementalalgorithmfor(lexicographically)sorteddata(Daciuk,](https://reader035.vdocuments.mx/reader035/viewer/2022062317/5fb93a8a8c84bc17a243e985/html5/thumbnails/79.jpg)
Incr. constr. from unsorted data – examples
1: function unsorted construction;2: while input not empty do3: s← q0; i← 0; w ← next word; push(s, P );4: while i ≤ |w| and δ(s, wi) 6= ⊥
and fanin(δ(s, wi)) ≤ 1 do5: s← δ(s, wi); push(s, P ); i← i + 1;6: end while;7: R← R \ {s}; u← i;8: while i ≤ |w| and δ(s, wi) 6= ⊥ do9: δ(s, wi)← clone(δ(s, wi)); s← δ(s, wi);
push(s, P ); i← i + 1;10: end while;11: while i ≤ |w| do12: s← new state; s← δ(s, wi);
push(s, P ); i← i + 1;13: end while;14: F ← F ∪ {s}; pop(P );15: while P not empty do16: if ∃r∈R r ≡ s then17: if i = u and i > 0 then
R← R \ {top(P )}; u← u− 1;end if;
18: delete s; δ(top(P ), wi)← r;19: else20: R← R ∪ {s};
if i = u then break; end if;21: end if;22: i← i− 1; s← pop(P );23: end while;24: reset P ;25: end while;26: end function;
p e u t
ve u
t
veut
![Page 80: Incremental Construction of Minimal Acyclic Deterministic ... · Incremental and semi-incremental algorithms for acyclic automata •Incrementalalgorithmfor(lexicographically)sorteddata(Daciuk,](https://reader035.vdocuments.mx/reader035/viewer/2022062317/5fb93a8a8c84bc17a243e985/html5/thumbnails/80.jpg)
Incr. constr. from unsorted data – examples
1: function unsorted construction;2: while input not empty do3: s← q0; i← 0; w ← next word; push(s, P );4: while i ≤ |w| and δ(s, wi) 6= ⊥
and fanin(δ(s, wi)) ≤ 1 do5: s← δ(s, wi); push(s, P ); i← i + 1;6: end while;7: R← R \ {s}; u← i;8: while i ≤ |w| and δ(s, wi) 6= ⊥ do9: δ(s, wi)← clone(δ(s, wi)); s← δ(s, wi);
push(s, P ); i← i + 1;10: end while;11: while i ≤ |w| do12: s← new state; s← δ(s, wi);
push(s, P ); i← i + 1;13: end while;14: F ← F ∪ {s}; pop(P );15: while P not empty do16: if ∃r∈R r ≡ s then17: if i = u and i > 0 then
R← R \ {top(P )}; u← u− 1;end if;
18: delete s; δ(top(P ), wi)← r;19: else20: R← R ∪ {s};
if i = u then break; end if;21: end if;22: i← i− 1; s← pop(P );23: end while;24: reset P ;25: end while;26: end function;
p e u t
ve
u
veut
![Page 81: Incremental Construction of Minimal Acyclic Deterministic ... · Incremental and semi-incremental algorithms for acyclic automata •Incrementalalgorithmfor(lexicographically)sorteddata(Daciuk,](https://reader035.vdocuments.mx/reader035/viewer/2022062317/5fb93a8a8c84bc17a243e985/html5/thumbnails/81.jpg)
Incr. constr. from unsorted data – examples
1: function unsorted construction;2: while input not empty do3: s← q0; i← 0; w ← next word; push(s, P );4: while i ≤ |w| and δ(s, wi) 6= ⊥
and fanin(δ(s, wi)) ≤ 1 do5: s← δ(s, wi); push(s, P ); i← i + 1;6: end while;7: R← R \ {s}; u← i;8: while i ≤ |w| and δ(s, wi) 6= ⊥ do9: δ(s, wi)← clone(δ(s, wi)); s← δ(s, wi);
push(s, P ); i← i + 1;10: end while;11: while i ≤ |w| do12: s← new state; s← δ(s, wi);
push(s, P ); i← i + 1;13: end while;14: F ← F ∪ {s}; pop(P );15: while P not empty do16: if ∃r∈R r ≡ s then17: if i = u and i > 0 then
R← R \ {top(P )}; u← u− 1;end if;
18: delete s; δ(top(P ), wi)← r;19: else20: R← R ∪ {s};
if i = u then break; end if;21: end if;22: i← i− 1; s← pop(P );23: end while;24: reset P ;25: end while;26: end function;
p e u t
v e
veut
![Page 82: Incremental Construction of Minimal Acyclic Deterministic ... · Incremental and semi-incremental algorithms for acyclic automata •Incrementalalgorithmfor(lexicographically)sorteddata(Daciuk,](https://reader035.vdocuments.mx/reader035/viewer/2022062317/5fb93a8a8c84bc17a243e985/html5/thumbnails/82.jpg)
Incr. constr. from unsorted data – examples
1: function unsorted construction;2: while input not empty do3: s← q0; i← 0; w ← next word; push(s, P );4: while i ≤ |w| and δ(s, wi) 6= ⊥
and fanin(δ(s, wi)) ≤ 1 do5: s← δ(s, wi); push(s, P ); i← i + 1;6: end while;7: R← R \ {s}; u← i;8: while i ≤ |w| and δ(s, wi) 6= ⊥ do9: δ(s, wi)← clone(δ(s, wi)); s← δ(s, wi);
push(s, P ); i← i + 1;10: end while;11: while i ≤ |w| do12: s← new state; s← δ(s, wi);
push(s, P ); i← i + 1;13: end while;14: F ← F ∪ {s}; pop(P );15: while P not empty do16: if ∃r∈R r ≡ s then17: if i = u and i > 0 then
R← R \ {top(P )}; u← u− 1;end if;
18: delete s; δ(top(P ), wi)← r;19: else20: R← R ∪ {s};
if i = u then break; end if;21: end if;22: i← i− 1; s← pop(P );23: end while;24: reset P ;25: end while;26: end function;
e u tp
v
veut
![Page 83: Incremental Construction of Minimal Acyclic Deterministic ... · Incremental and semi-incremental algorithms for acyclic automata •Incrementalalgorithmfor(lexicographically)sorteddata(Daciuk,](https://reader035.vdocuments.mx/reader035/viewer/2022062317/5fb93a8a8c84bc17a243e985/html5/thumbnails/83.jpg)
Incr. constr. from unsorted data – examples
1: function unsorted construction;2: while input not empty do3: s← q0; i← 0; w ← next word; push(s, P );4: while i ≤ |w| and δ(s, wi) 6= ⊥
and fanin(δ(s, wi)) ≤ 1 do5: s← δ(s, wi); push(s, P ); i← i + 1;6: end while;7: R← R \ {s}; u← i;8: while i ≤ |w| and δ(s, wi) 6= ⊥ do9: δ(s, wi)← clone(δ(s, wi)); s← δ(s, wi);
push(s, P ); i← i + 1;10: end while;11: while i ≤ |w| do12: s← new state; s← δ(s, wi);
push(s, P ); i← i + 1;13: end while;14: F ← F ∪ {s}; pop(P );15: while P not empty do16: if ∃r∈R r ≡ s then17: if i = u and i > 0 then
R← R \ {top(P )}; u← u− 1;end if;
18: delete s; δ(top(P ), wi)← r;19: else20: R← R ∪ {s};
if i = u then break; end if;21: end if;22: i← i− 1; s← pop(P );23: end while;24: reset P ;25: end while;26: end function;
e u tp
v e
veux
![Page 84: Incremental Construction of Minimal Acyclic Deterministic ... · Incremental and semi-incremental algorithms for acyclic automata •Incrementalalgorithmfor(lexicographically)sorteddata(Daciuk,](https://reader035.vdocuments.mx/reader035/viewer/2022062317/5fb93a8a8c84bc17a243e985/html5/thumbnails/84.jpg)
Incr. constr. from unsorted data – examples
1: function unsorted construction;2: while input not empty do3: s← q0; i← 0; w ← next word; push(s, P );4: while i ≤ |w| and δ(s, wi) 6= ⊥
and fanin(δ(s, wi)) ≤ 1 do5: s← δ(s, wi); push(s, P ); i← i + 1;6: end while;7: R← R \ {s}; u← i;8: while i ≤ |w| and δ(s, wi) 6= ⊥ do9: δ(s, wi)← clone(δ(s, wi)); s← δ(s, wi);
push(s, P ); i← i + 1;10: end while;11: while i ≤ |w| do12: s← new state; s← δ(s, wi);
push(s, P ); i← i + 1;13: end while;14: F ← F ∪ {s}; pop(P );15: while P not empty do16: if ∃r∈R r ≡ s then17: if i = u and i > 0 then
R← R \ {top(P )}; u← u− 1;end if;
18: delete s; δ(top(P ), wi)← r;19: else20: R← R ∪ {s};
if i = u then break; end if;21: end if;22: i← i− 1; s← pop(P );23: end while;24: reset P ;25: end while;26: end function;
e u tp
v e u
veux
![Page 85: Incremental Construction of Minimal Acyclic Deterministic ... · Incremental and semi-incremental algorithms for acyclic automata •Incrementalalgorithmfor(lexicographically)sorteddata(Daciuk,](https://reader035.vdocuments.mx/reader035/viewer/2022062317/5fb93a8a8c84bc17a243e985/html5/thumbnails/85.jpg)
Incr. constr. from unsorted data – examples
1: function unsorted construction;2: while input not empty do3: s← q0; i← 0; w ← next word; push(s, P );4: while i ≤ |w| and δ(s, wi) 6= ⊥
and fanin(δ(s, wi)) ≤ 1 do5: s← δ(s, wi); push(s, P ); i← i + 1;6: end while;7: R← R \ {s}; u← i;8: while i ≤ |w| and δ(s, wi) 6= ⊥ do9: δ(s, wi)← clone(δ(s, wi)); s← δ(s, wi);
push(s, P ); i← i + 1;10: end while;11: while i ≤ |w| do12: s← new state; s← δ(s, wi);
push(s, P ); i← i + 1;13: end while;14: F ← F ∪ {s}; pop(P );15: while P not empty do16: if ∃r∈R r ≡ s then17: if i = u and i > 0 then
R← R \ {top(P )}; u← u− 1;end if;
18: delete s; δ(top(P ), wi)← r;19: else20: R← R ∪ {s};
if i = u then break; end if;21: end if;22: i← i− 1; s← pop(P );23: end while;24: reset P ;25: end while;26: end function;
e u tp
v e ut
veux
![Page 86: Incremental Construction of Minimal Acyclic Deterministic ... · Incremental and semi-incremental algorithms for acyclic automata •Incrementalalgorithmfor(lexicographically)sorteddata(Daciuk,](https://reader035.vdocuments.mx/reader035/viewer/2022062317/5fb93a8a8c84bc17a243e985/html5/thumbnails/86.jpg)
Incr. constr. from unsorted data – examples
1: function unsorted construction;2: while input not empty do3: s← q0; i← 0; w ← next word; push(s, P );4: while i ≤ |w| and δ(s, wi) 6= ⊥
and fanin(δ(s, wi)) ≤ 1 do5: s← δ(s, wi); push(s, P ); i← i + 1;6: end while;7: R← R \ {s}; u← i;8: while i ≤ |w| and δ(s, wi) 6= ⊥ do9: δ(s, wi)← clone(δ(s, wi)); s← δ(s, wi);
push(s, P ); i← i + 1;10: end while;11: while i ≤ |w| do12: s← new state; s← δ(s, wi);
push(s, P ); i← i + 1;13: end while;14: F ← F ∪ {s}; pop(P );15: while P not empty do16: if ∃r∈R r ≡ s then17: if i = u and i > 0 then
R← R \ {top(P )}; u← u− 1;end if;
18: delete s; δ(top(P ), wi)← r;19: else20: R← R ∪ {s};
if i = u then break; end if;21: end if;22: i← i− 1; s← pop(P );23: end while;24: reset P ;25: end while;26: end function;
e u tp
v et
xu
veux
![Page 87: Incremental Construction of Minimal Acyclic Deterministic ... · Incremental and semi-incremental algorithms for acyclic automata •Incrementalalgorithmfor(lexicographically)sorteddata(Daciuk,](https://reader035.vdocuments.mx/reader035/viewer/2022062317/5fb93a8a8c84bc17a243e985/html5/thumbnails/87.jpg)
Incr. constr. from unsorted data – examples
1: function unsorted construction;2: while input not empty do3: s← q0; i← 0; w ← next word; push(s, P );4: while i ≤ |w| and δ(s, wi) 6= ⊥
and fanin(δ(s, wi)) ≤ 1 do5: s← δ(s, wi); push(s, P ); i← i + 1;6: end while;7: R← R \ {s}; u← i;8: while i ≤ |w| and δ(s, wi) 6= ⊥ do9: δ(s, wi)← clone(δ(s, wi)); s← δ(s, wi);
push(s, P ); i← i + 1;10: end while;11: while i ≤ |w| do12: s← new state; s← δ(s, wi);
push(s, P ); i← i + 1;13: end while;14: F ← F ∪ {s}; pop(P );15: while P not empty do16: if ∃r∈R r ≡ s then17: if i = u and i > 0 then
R← R \ {top(P )}; u← u− 1;end if;
18: delete s; δ(top(P ), wi)← r;19: else20: R← R ∪ {s};
if i = u then break; end if;21: end if;22: i← i− 1; s← pop(P );23: end while;24: reset P ;25: end while;26: end function;
e u tp
v et
ux
veux
![Page 88: Incremental Construction of Minimal Acyclic Deterministic ... · Incremental and semi-incremental algorithms for acyclic automata •Incrementalalgorithmfor(lexicographically)sorteddata(Daciuk,](https://reader035.vdocuments.mx/reader035/viewer/2022062317/5fb93a8a8c84bc17a243e985/html5/thumbnails/88.jpg)
Incr. constr. from unsorted data – examples
1: function unsorted construction;2: while input not empty do3: s← q0; i← 0; w ← next word; push(s, P );4: while i ≤ |w| and δ(s, wi) 6= ⊥
and fanin(δ(s, wi)) ≤ 1 do5: s← δ(s, wi); push(s, P ); i← i + 1;6: end while;7: R← R \ {s}; u← i;8: while i ≤ |w| and δ(s, wi) 6= ⊥ do9: δ(s, wi)← clone(δ(s, wi)); s← δ(s, wi);
push(s, P ); i← i + 1;10: end while;11: while i ≤ |w| do12: s← new state; s← δ(s, wi);
push(s, P ); i← i + 1;13: end while;14: F ← F ∪ {s}; pop(P );15: while P not empty do16: if ∃r∈R r ≡ s then17: if i = u and i > 0 then
R← R \ {top(P )}; u← u− 1;end if;
18: delete s; δ(top(P ), wi)← r;19: else20: R← R ∪ {s};
if i = u then break; end if;21: end if;22: i← i− 1; s← pop(P );23: end while;24: reset P ;25: end while;26: end function;
e u tp
v et
ux
peux
![Page 89: Incremental Construction of Minimal Acyclic Deterministic ... · Incremental and semi-incremental algorithms for acyclic automata •Incrementalalgorithmfor(lexicographically)sorteddata(Daciuk,](https://reader035.vdocuments.mx/reader035/viewer/2022062317/5fb93a8a8c84bc17a243e985/html5/thumbnails/89.jpg)
Incr. constr. from unsorted data – examples
1: function unsorted construction;2: while input not empty do3: s← q0; i← 0; w ← next word; push(s, P );4: while i ≤ |w| and δ(s, wi) 6= ⊥
and fanin(δ(s, wi)) ≤ 1 do5: s← δ(s, wi); push(s, P ); i← i + 1;6: end while;7: R← R \ {s}; u← i;8: while i ≤ |w| and δ(s, wi) 6= ⊥ do9: δ(s, wi)← clone(δ(s, wi)); s← δ(s, wi);
push(s, P ); i← i + 1;10: end while;11: while i ≤ |w| do12: s← new state; s← δ(s, wi);
push(s, P ); i← i + 1;13: end while;14: F ← F ∪ {s}; pop(P );15: while P not empty do16: if ∃r∈R r ≡ s then17: if i = u and i > 0 then
R← R \ {top(P )}; u← u− 1;end if;
18: delete s; δ(top(P ), wi)← r;19: else20: R← R ∪ {s};
if i = u then break; end if;21: end if;22: i← i− 1; s← pop(P );23: end while;24: reset P ;25: end while;26: end function;
e u tp
v e ux
xt
peux
![Page 90: Incremental Construction of Minimal Acyclic Deterministic ... · Incremental and semi-incremental algorithms for acyclic automata •Incrementalalgorithmfor(lexicographically)sorteddata(Daciuk,](https://reader035.vdocuments.mx/reader035/viewer/2022062317/5fb93a8a8c84bc17a243e985/html5/thumbnails/90.jpg)
Incr. constr. from unsorted data – examples
1: function unsorted construction;2: while input not empty do3: s← q0; i← 0; w ← next word; push(s, P );4: while i ≤ |w| and δ(s, wi) 6= ⊥
and fanin(δ(s, wi)) ≤ 1 do5: s← δ(s, wi); push(s, P ); i← i + 1;6: end while;7: R← R \ {s}; u← i;8: while i ≤ |w| and δ(s, wi) 6= ⊥ do9: δ(s, wi)← clone(δ(s, wi)); s← δ(s, wi);
push(s, P ); i← i + 1;10: end while;11: while i ≤ |w| do12: s← new state; s← δ(s, wi);
push(s, P ); i← i + 1;13: end while;14: F ← F ∪ {s}; pop(P );15: while P not empty do16: if ∃r∈R r ≡ s then17: if i = u and i > 0 then
R← R \ {top(P )}; u← u− 1;end if;
18: delete s; δ(top(P ), wi)← r;19: else20: R← R ∪ {s};
if i = u then break; end if;21: end if;22: i← i− 1; s← pop(P );23: end while;24: reset P ;25: end while;26: end function;
e up
v e ux
t
t
x
veux
![Page 91: Incremental Construction of Minimal Acyclic Deterministic ... · Incremental and semi-incremental algorithms for acyclic automata •Incrementalalgorithmfor(lexicographically)sorteddata(Daciuk,](https://reader035.vdocuments.mx/reader035/viewer/2022062317/5fb93a8a8c84bc17a243e985/html5/thumbnails/91.jpg)
Incr. constr. from unsorted data – examples
1: function unsorted construction;2: while input not empty do3: s← q0; i← 0; w ← next word; push(s, P );4: while i ≤ |w| and δ(s, wi) 6= ⊥
and fanin(δ(s, wi)) ≤ 1 do5: s← δ(s, wi); push(s, P ); i← i + 1;6: end while;7: R← R \ {s}; u← i;8: while i ≤ |w| and δ(s, wi) 6= ⊥ do9: δ(s, wi)← clone(δ(s, wi)); s← δ(s, wi);
push(s, P ); i← i + 1;10: end while;11: while i ≤ |w| do12: s← new state; s← δ(s, wi);
push(s, P ); i← i + 1;13: end while;14: F ← F ∪ {s}; pop(P );15: while P not empty do16: if ∃r∈R r ≡ s then17: if i = u and i > 0 then
R← R \ {top(P )}; u← u− 1;end if;
18: delete s; δ(top(P ), wi)← r;19: else20: R← R ∪ {s};
if i = u then break; end if;21: end if;22: i← i− 1; s← pop(P );23: end while;24: reset P ;25: end while;26: end function;
e up
v e
t
xu
veux
![Page 92: Incremental Construction of Minimal Acyclic Deterministic ... · Incremental and semi-incremental algorithms for acyclic automata •Incrementalalgorithmfor(lexicographically)sorteddata(Daciuk,](https://reader035.vdocuments.mx/reader035/viewer/2022062317/5fb93a8a8c84bc17a243e985/html5/thumbnails/92.jpg)
Incr. constr. from unsorted data – examples
1: function unsorted construction;2: while input not empty do3: s← q0; i← 0; w ← next word; push(s, P );4: while i ≤ |w| and δ(s, wi) 6= ⊥
and fanin(δ(s, wi)) ≤ 1 do5: s← δ(s, wi); push(s, P ); i← i + 1;6: end while;7: R← R \ {s}; u← i;8: while i ≤ |w| and δ(s, wi) 6= ⊥ do9: δ(s, wi)← clone(δ(s, wi)); s← δ(s, wi);
push(s, P ); i← i + 1;10: end while;11: while i ≤ |w| do12: s← new state; s← δ(s, wi);
push(s, P ); i← i + 1;13: end while;14: F ← F ∪ {s}; pop(P );15: while P not empty do16: if ∃r∈R r ≡ s then17: if i = u and i > 0 then
R← R \ {top(P )}; u← u− 1;end if;
18: delete s; δ(top(P ), wi)← r;19: else20: R← R ∪ {s};
if i = u then break; end if;21: end if;22: i← i− 1; s← pop(P );23: end while;24: reset P ;25: end while;26: end function;
e up
v
t
xe
veux
![Page 93: Incremental Construction of Minimal Acyclic Deterministic ... · Incremental and semi-incremental algorithms for acyclic automata •Incrementalalgorithmfor(lexicographically)sorteddata(Daciuk,](https://reader035.vdocuments.mx/reader035/viewer/2022062317/5fb93a8a8c84bc17a243e985/html5/thumbnails/93.jpg)
Incr. constr. from unsorted data – examples
1: function unsorted construction;2: while input not empty do3: s← q0; i← 0; w ← next word; push(s, P );4: while i ≤ |w| and δ(s, wi) 6= ⊥
and fanin(δ(s, wi)) ≤ 1 do5: s← δ(s, wi); push(s, P ); i← i + 1;6: end while;7: R← R \ {s}; u← i;8: while i ≤ |w| and δ(s, wi) 6= ⊥ do9: δ(s, wi)← clone(δ(s, wi)); s← δ(s, wi);
push(s, P ); i← i + 1;10: end while;11: while i ≤ |w| do12: s← new state; s← δ(s, wi);
push(s, P ); i← i + 1;13: end while;14: F ← F ∪ {s}; pop(P );15: while P not empty do16: if ∃r∈R r ≡ s then17: if i = u and i > 0 then
R← R \ {top(P )}; u← u− 1;end if;
18: delete s; δ(top(P ), wi)← r;19: else20: R← R ∪ {s};
if i = u then break; end if;21: end if;22: i← i− 1; s← pop(P );23: end while;24: reset P ;25: end while;26: end function;
e up t
xv
peux
![Page 94: Incremental Construction of Minimal Acyclic Deterministic ... · Incremental and semi-incremental algorithms for acyclic automata •Incrementalalgorithmfor(lexicographically)sorteddata(Daciuk,](https://reader035.vdocuments.mx/reader035/viewer/2022062317/5fb93a8a8c84bc17a243e985/html5/thumbnails/94.jpg)
Complexity and performance
• Both algorithms keep intermediate automata (almost) minimal
• Both run in time proportional to input data size
• The algorithm for sorted data is faster but less flexible
• Traditional algorithms are slower and use much more memory
• There are extensions of both algorithms to the case off adding
words to a cyclic automaton