3. The vector of pointers ve to the cells W[ve[1], s −
1], . . . , W[ve[ j], s− 1] from which it is possible to
arrive to the cell W[e, s] regardless of the weight
increment, j ≤ E +2.
4. The vector of values v j of the edit distances cor-
responding to the elements of the vector ve. The
cardinality of this vector is also j.
The actual values of k, l, and j depend on the par-
ticular sequences. The matrix W is filled by means of
the algorithm, which implements the equation (2) to-
gether with the updating of the four vectors mentioned
above. The complete algorithm is given below:
Algorithm 1
Input:
• The sequences X and Y of lengths N and M, re-
spectively.
• The necessary length pl of the optimal/suboptimal
path to be reconstructed.
• The maximum length E of runs of deletions (note
that we use the mathematical expectation of E).
• The elementary distance d
e
associated with the
deletion of a symbol.
• The elementary edit distance d[x, y] associated
with the substitution of the symbol x with the sym-
bol y, ∀(x, y).
Output:
• The array W of edit distances with the vectors vp,
vu, vj, and ve associated with every cell.
comment Initialization
s
max
←− min{N, M} ;
e
max
←− max{min{N − s, s∗ E}}, s = 1, . . . , s
max
;
W[e, s].c ←− ∞ , e = 0, . . . , e
max
, s = 0, . . . , s
max
; the
vectors vp, vu, v j, and ve associated with every cell
W[e, s] are empty.
W[0, 0].c ←− 0 ;
comment Main loop
for s ←− 1 until s
max
do
begin
for e ←− 1 until min{N − s, s∗ E} do
begin
Let q be the minimum value of the expression
W[e− e
1
, s− 1].c+ e
1
∗ d
e
+ d[X[e+ s],Y[s]],
e
1
= max{0, e− min{N − s, (s− 1) ∗E}}, . . . ,
min{e, E}, (3)
Let n
q
be the number of values of e
1
for which the
expression (3) takes the value q. Then
W[e, s].c ←− q ; W[e, s].k ←− n
q
;
W[e, s].vp is filled with n
q
values of the expression
(e− e
1
) corresponding to the values e
1
for which
the expression (3) takes the value q. W[e, s].vj
is filled with all the values of the expression (3).
W[e, s].ve is filled with the values (e − e
1
) corre-
sponding to the values of W[e, s].v j.
end ;
comment Determining updated pointers vu.
if s = pl + 1 then
W[e, s].vu ←− W[e, s].vp,
e = 0, . . . , min{N − s, s∗ E} ;
else if s > pl + 1 then
For every element of W[e, s].vp, e =
0, . . . , min{N − s, s ∗ F}, the elements of
W[W[e, s].vp[i], s − 1].vu, i = 1, . . . ,W[e, s].k
are placed into W[e, s].vu, deleting the repeated
ones.
end.
From now on, by paths we mean fragments of
paths that start in the column pl of the matrix W.
There are three sets of paths to be reconstructed. The
first one consists of optimal paths that start at the
points e
p
i
= W[N − M, M].vu[i], i = 1, . . . ,W[e, s].l.
The second one consists of suboptimal paths, whose
weight-difference from the optimal ones is ≤
D ,
a threshold given in advance that depends on the
noise level, that start at e
p
i
= W[N − M, M].vu[i], i =
1, . . . ,W[e, s].l. The third set consists of suboptimal
paths, whose weight-difference from the optimal ones
is ≤
D , that start at other points in the column pl.
The coordinates of the vector W[N − M, M].vu at
the end of the execution of the Algorithm 1 repre-
sent the initial points of the search for the elements
of the first and second set mentioned above. As
for the third set, if | W[e
p
i
, pl].c − W[e, pl].c |≤
D ,
e = 0, . . . , min{N − M, sE}, e 6= e
p
i
, for at least one i,
then the point W[e, pl] is an initial point of the search
for the paths of the third set.
In order to determine the optimal and suboptimal
paths that start at every initial point
E of any set, a
special depth-first like search algorithm was devised.
In this algorithm, every branching point is processed
by enumerating systematically all the paths that start
in it. In this search, a special kind of stack is used.
A reconstructed path is rejected if at some point its
weight becomes greater than the optimal weight plus
D . The complete algorithm is given below:
Algorithm 2:
Input:
• The array W of edit distances, obtained by means
of the Algorithm 1.
• The values of pl,
E and D .
Output:
CLOCK CONTROL SEQUENCE RECONSTRUCTION IN THE GENERALIZED SHRINKING GENERATOR
261