下面图使用NFA表示的状态转换图,
使用子集构造法,有如下过程,
ε-closure(0) = {0, 1, 2, 3, 4, 6, 7}
初始值,令为A
A = {0, 1, 2, 3, 4, 6, 7}
标记A
move(A, a) = {3, 8}
Dtran[A, a] = {1, 2, 3, 4, 6, 7, 8}
不重复,令为B
B = {1, 2, 3, 4, 6, 7, 8}
转换关系为A->a->B
move(A, b) = {5}
Dtran[A, b] = {1, 2, 4, 5, 6, 7}
不重复,令为C
C = {1, 2, 4, 5, 6, 7}
转换关系为A->b->C
标记B
move(B, a) = {3, 8}
由上可得
Dtran[B, a] = B
转换关系B->a->B
move(B, b) = {5, 9}
Dtran[B, b] = {1, 2, 4, 5, 6, 7, 9}
不重复,令为D
D = {1, 2, 4, 5, 6, 7, 9}
转换关系B->b->D
标记C
move(C, a) = {3, 8}
Dtran[C, a] = B
转换关系为C->a->B
move(C, b) = {5}
Dtran[C, b] = C
转换关系为C->b->C
标记D
move(D, a) = {3, 8}
Dtran[D, a] = B
转换关系为D->a->B
move(D, b) = {5}
Dtran[D, b] = C
转换关系D->b->C
最后得到下列状态转换表,
--------------------------------------------------------
NFA DFA a b
--------------------------------------------------------
{0, 1, 2, 3, 4, 6, 7} A B C
--------------------------------------------------------
{1, 2, 3, 4, 6, 7, 8} B B D
--------------------------------------------------------
{1, 2, 4, 5, 6, 7} C B C
--------------------------------------------------------
{1, 2, 4, 5, 6, 7, 9} D B C
--------------------------------------------------------
注意:
对于状态s,s属于ε-closure(s),因为路径可以不包含边,所以状态s可以从自身出发经过标号ε(不包含边)到达自身。
Dtran[S, c] = ε-closure(move(S, c))。