<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v1.0 20120330//EN" "JATS-archivearticle1.dtd">
<article xmlns:xlink="http://www.w3.org/1999/xlink">
  <front>
    <journal-meta />
    <article-meta>
      <title-group>
        <article-title>An Extension of Linear-size Su Parameterized Strings x Tries for</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Katsuhito Nakashima</string-name>
          <email>nakashima@shino.ecei.tohoku.ac.jp</email>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Diptarama Hendrian</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Ryo Yoshinaka</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Ayumi Shinohara</string-name>
          <email>ayumisg@tohoku.ac.jp</email>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>Graduate School of Information Sciences, Tohoku University</institution>
          ,
          <country>Japan katsuhito</country>
        </aff>
      </contrib-group>
      <fpage>97</fpage>
      <lpage>108</lpage>
      <abstract>
        <p>In this paper, we propose a new indexing structure for parameterized strings which we call PLSTs, by generalizing linear-size su x tries for ordinary strings. Two parameterized strings are said to match if there is a bijection on the symbol set that makes the two coincide. PLSTs are applicable to the parameterized pattern matching problem, which is to decide whether the input parameterized text has a substring that matches the input parameterized pattern. The size of PLSTs is linear in the text size, with which our algorithm solves the parameterized pattern matching problem in linear time in the pattern size. PLSTs can be seen as a compacted version of parameterized su x tries and a combination of linear-size su x tries and parameterized su x trees. We experimentally show that PLSTs are more space e cient than parameterized su x trees for highly repetitive strings.</p>
      </abstract>
      <kwd-group>
        <kwd>indexing data structure linear-size su x trie parameterized pattern matching</kwd>
      </kwd-group>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>-</title>
      <p>
        The pattern matching problem is to check whether a pattern string occurs in a
text string or not. To e ciently solve the pattern matching problem, a numerous
number of text indexing structures have been proposed. Su x trees are the most
widely used data structures and provide many applications including several
variants of pattern matching problems [
        <xref ref-type="bibr" rid="ref10 ref5">5,10</xref>
        ]. They can be seen as a compacted
type of su x tries, where two branching nodes that have no other branching
nodes between them in a su x trie are directly connected in the su x tree. The
new edges have a reference to an interval of the text so that the original path
label of the su x trie can be recovered. Recently, Crochemore et al. [
        <xref ref-type="bibr" rid="ref4">4</xref>
        ] proposed
a new indexing structure, called a linear-size su x trie (LST), which is another
compacted variant of a su x trie. An LST replaces paths consisting only of
This research was partially supported by JSPS KAKENHI Grant Numbers
JP15H05706 and JP19K20208.
      </p>
      <p>
        Copyright 2020 for this paper by its authors. Use permitted under Creative
Commons License Attribution 4.0 International (CC BY 4.0).
non-branching nodes by edges like a su x tree, but the original path labels
are recovered by referring to other edge labels in the LST itself unlike su x
trees. LSTs use less memory space than su x trees for indexing the same highly
repetitive strings [
        <xref ref-type="bibr" rid="ref14">14</xref>
        ]. LSTs may be used as an alternative of su x trees for
various applications, like computing the longest common substrings, not limited
to the pattern matching problem.
      </p>
      <p>
        On the other hand, di erent types of pattern matching have been proposed
and intensively studied. The variant this paper is concerned with is the
parameterized pattern matching problem, introduced by Baker [
        <xref ref-type="bibr" rid="ref3">3</xref>
        ]. Considering two
disjoint sets of symbols and , we call a string over [ a parameterized
string (p-string). In the parameterized pattern matching problem, given p-strings
T and P , we must check whether substrings of T can be transformed into P by
applying a one-to-one function that renames symbols in . The parameterized
pattern matching is motivated by applying to the software maintenance [
        <xref ref-type="bibr" rid="ref2 ref3">2,3</xref>
        ], the
plagiarism detection [
        <xref ref-type="bibr" rid="ref8">8</xref>
        ], the analysis of gene structure [
        <xref ref-type="bibr" rid="ref13">13</xref>
        ], and so on. Similarly
to the basic string matching problem, several indexing structures that support
the parameterized pattern matching have been proposed, such as parameterized
su x trees [
        <xref ref-type="bibr" rid="ref3">3</xref>
        ], structural su x trees [
        <xref ref-type="bibr" rid="ref13">13</xref>
        ], parameterized su x arrays [
        <xref ref-type="bibr" rid="ref12 ref6">6,12</xref>
        ], and
parameterized position heaps [
        <xref ref-type="bibr" rid="ref7 ref9">7,9</xref>
        ].
      </p>
      <p>In this paper, we propose a new indexing structure for p-strings, which we
call PLST. A PLST is a tree structure that combines a linear-size su x trie
and a parameterized su x tree. We show that the size of a PLST is O(n) and
give an algorithm for the parameterized pattern matching problem for given a
pattern and a PLST, to nd the occurrences of a pattern in the text, that runs in
O(m) time, where n is the length of the text and m is the length of the pattern.
Furthermore, we experimentally show that PLSTs are more space e cient than
parameterized su x trees for highly repetitive strings such as Fibonacci strings.
2
2.1</p>
    </sec>
    <sec id="sec-2">
      <title>Preliminaries</title>
      <sec id="sec-2-1">
        <title>Basic de nitions and notation</title>
        <p>We denote the set of all non-negative integers by N . Let be an alphabet. For
a string w = xyz 2 , x, y, and z are called pre x, substring, and su x of
w, respectively. The length of w is denoted by jwj and the i-th symbol of w is
denoted by w[i] for 1 i jwj. The substring of w that begins at position i and
ends at position j is denoted by w[i : j] for 1 i j jwj. For convenience, we
abbreviate w[1 : i] to w[: i] and w[i : jwj] to w[i :] for 1 i jwj. The empty
string is denoted by ", that is j"j = 0. Moreover, let w[i : j] = " if i &gt; j. For a
string u and an extension uv, we write str(u; uv) = v.</p>
        <p>Throughout this paper, we x two alphabets and . We call elements of
constant symbols and those of parameter symbols. An element of is
called a constant string and that of ( [ ) is called a parameterized string, or
p-string for short. We assume that the size of and are constant.</p>
        <p>Given two p-strings w1 and w2 of length n, w1 and w2 are a parameterized
match (p-match), denoted by w1 w2, if there is a bijection f on such
that f (a) = a for any a 2
determine whether w1
de ned as follows.</p>
        <p>
          and f (w1[i]) = w2[i] for all 1 i n [
          <xref ref-type="bibr" rid="ref3">3</xref>
          ]. We can
w2 or not by using an encoding called prev-encoding
De nition 1 (Prev-encoding [
          <xref ref-type="bibr" rid="ref3">3</xref>
          ]). For a p-string w of length n over
the prev-encoding for w, denoted by prev(w), is de ned to be a string over
of length n such that for each 1 i n,
[ ,
[N
&gt;8w[i] if w[i] 2
prev(w)[i] = &lt;0 if w[i] 2
&gt;:i k if w[i] 2
        </p>
        <p>;
We call strings over
[ N pv-strings.</p>
        <p>and w[i] 6= w[j] for 1 j &lt; i;
and k = maxfj j w[j] = w[i] and 1
j &lt; ig:</p>
        <p>For any p-strings w1 and w2, w1 w2 if and only if prev(w1) = prev(w2).
For example, given = fa; bg and = fu; v; x; yg, s1 = uvvvauuvb and
s2 = xyyyaxxyb are p-matches by f such that f (u) = x and f (v) = y, where
prev(s1) = prev(s2) = 0011a514b.</p>
        <p>We de ne parameterized pattern matching as follows.</p>
      </sec>
      <sec id="sec-2-2">
        <title>De nition 2 (Parameterized pattern matching [3]). Given two p-strings,</title>
        <p>text T and pattern P , decide whether T has a substring that p-matches P .
$ 2
For example, considering a text T = auvaubuavbv and a pattern P = xayby
over = fa; bg and = fu; v; x; yg, T has two substrings T [3 : 7] = vaubu and
T [7 : 11] = uavbv that p-match P .</p>
        <p>Throughout this paper, we assume that a text T ends with a sentinel symbol
, which occurs nowhere else in T .
2.2</p>
      </sec>
      <sec id="sec-2-3">
        <title>Su x tries, su x trees, and linear-size su x tries</title>
        <p>This subsection brie y reviews tree structures for indexing all the substrings of
a constant string T 2 .</p>
        <p>The su x trie STrie(T ) is a tree with nodes corresponding to all the substrings
of T . Figure 1 (a) shows an example of a su x trie. Throughout this paper, we
identify a node with its corresponding string for explanatory convenience. Note
that each node does not explicitly remember its corresponding string. For each
nonempty substring ua of T where a 2 , we have an edge from u to ua labeled
with a. Then by reading the labels on the path from the root to a node u, one can
obtain the string u the node corresponds. Then the path label from the node
u to a descendant uv is str(u; uv) = v for u; v 2 . Since there are (jT j2)
substrings of T , the size of STrie(T ) is (jT j2).</p>
        <p>The su x tree STree(T ) is a tree obtained from STrie(T ) by removing all
non-branching internal nodes and replacing each path with no branching nodes
by a single edge whose label refers to a corresponding interval of the text T .
That is, the label on the edge (u; v) is a pair (i; j) such that T [i : j] = str(u; v).
$
a
a
b
a
$
a
$
a
b a $
b a $
a b $
a a
b $
a
a</p>
        <p>$
(a)
+ $
a
a
b
a
+ $
a
$
a
b a $
b a $
a b $
a a
b + $
a
a+</p>
        <p>$
(b)
Since there are at most O(jT j) branching nodes, the size of STree(T ) is (jT j).
An important auxiliary map on nodes is called su x links, denoted by SL, which
is de ned by SL(aw) = w for each node aw with a 2 and w 2 .</p>
        <p>
          The linear-size su x trie (LST) [
          <xref ref-type="bibr" rid="ref4">4</xref>
          ] LST(T ) of a string T is another
compact variant of a su x trie (see Figure 1 (b)). An LST suppresses (most)
nonbranching nodes and replaces paths with edges like a su x tree, but the labels
of those new edges do not refer to intervals of the input text. Each edge (u; v)
retains only the rst symbol str(u; v)[
          <xref ref-type="bibr" rid="ref1">1</xref>
          ] of the original path label str(u; v). To
recover the original label str(u; v), we refer to another edge or a path in the LST
itself following a su x link, using the fact that str(u; v) = str(SL(u); SL(v)).
The reference will be recursive, but eventually one can regain the original path
label by collecting those retained symbols. For this sake, LST(T ) keeps some
non-branching internal nodes from STrie(T ) and thus it may have more nodes
than STree(T ), but still the size is linear in jT j. The nodes of LST(T ) consist of
those of STree(T ) and non-branching node whose su x links point at a
branching node. We call the former Type 1 and the latter Type 2. Each edge (u; v) has
a 1-bit ag that tells whether jvj juj = 1. If it is the case, one knows the
complete label str(u; v) = str(u; v)[
          <xref ref-type="bibr" rid="ref1">1</xref>
          ]. Otherwise, one needs to follow the su x link
to regain the other symbols. An LST uses su x links to regain the original path
label in the su x trie. If we had only Type 1 nodes, for some edge (u; v), there
may be a branching node between SL(u) and SL(v), which makes it di cult to
regain the original path label. Having Type 2 nodes, there is no branching node
between SL(u) and SL(v) for every edge (u; v). Then it is enough to go straight
down from SL(u) to regain the original path label.
[
          <xref ref-type="bibr" rid="ref1 ref13 ref5">5,13,1</xref>
          ]
[9,[173,,153],2] [11[,71,31,36,]3] 11,13[,77,]13,4]
        </p>
        <p>
          [
          <xref ref-type="bibr" rid="ref11 ref13 ref8">11,13,8</xref>
          ]
When k = 1, we omit k. We then have hprev(w)[i : j]i = prev(w[i : j]) for any
p-string w 2 ( [ ) and i; j jwj.
        </p>
        <p>Usually su x links are de ned on nodes of su x trees, but it is convenient
to have \implicit su x links" on all nodes except the root of STrie(T ), i.e., all
the nonempty substrings of T , as well. For a nonempty pv-string u 2 ( [ N )+,
let sl(u) denote the re-encoding hu[2 :]i of the string obtained by deleting the
rst symbol. This operation on strings will de ne real su x links in
indexing structures for parameterized strings based on parameterized su x tries.
Di erently from constant strings, u 2 PrevSub(T ) does not necessarily imply
u[2 :] 2 PrevSub(T ). What we actually have is sl(u) = hu[2 :]i 2 PrevSub(T ).</p>
        <p>
          A parameterized su x tree (p-su x tree) [
          <xref ref-type="bibr" rid="ref3">3</xref>
          ] of T , denoted by PSTree(T ), is
a compacted variant of the parameterized su x trie. Figure 2 shows an example
of a p-su x tree. Like the su x tree for a constant string over , PSTree(T ) is
obtained from PSTrie(T ) by removing non-branching internal nodes and giving
each edge as a label a reference to some interval of the prev-encoded text prev(T ).
The reference is represented by a triple (i; j; k) of a text start position, end
position, and su x number, which refers to the pv-string hprev(T )[k :]i[i : j].
        </p>
      </sec>
    </sec>
    <sec id="sec-3">
      <title>PLSTs</title>
      <p>We now introduce our indexing tree structures for p-strings, which we call
PLSTs, based on LSTs and p-su x trees reviewed in Sections 2.2 and 2.3. There
are two di culties in extending LSTs to deal with p-strings. Figure 3(a) shows
the LST-like structure obtained from PSTrie(T ) in the same way as LST(T ) is
obtained from STrie(T ). We want to know str(u; v) for an edge (u; v) by \reduction
by su x links", but
1. it is not necessarily that str(u; v) = str(sl(u); sl(v)),
2. there can be a branching node u of PSTrie(T ) such that sl(u) is not branching.
An example edge (u; v) exhibiting the rst di culty consists of u = 00 and
v = 00b3$, where str(u; v) = b3$ but str(sl(u); sl(v)) = b0$. This is caused by
the fact that sl(u) = hu[2 :]i rather than sl(u) = u[2 :]. Then, the path label
str(sl(u); sl(v)) referenced by the su x link may not give exactly what we want.
We solve this problem by giving the node v a \re-encoding sign" with which
one can recover str(u; v) from str(sl(u); sl(v)). An example node for the second
case is 00ab. This is a branching node but hsl(00ab)i = 0ab does not appear
as a node. To handle this case, we simply refer to the corresponding interval
of the original text T by keeping the necessary subsequence, where, as we will
observe in experiments, the necessary subsequence tends to be rather small. Our
proposed structure PLST is shown in Figure 3(b). In what follows we explain
PLSTs.
3.1</p>
      <sec id="sec-3-1">
        <title>De nition and properties of PLSTs</title>
        <p>
          Let U = PrevSub(T ) be the set of nodes of PSTrie(T ). The set V of nodes of the
PLST PLST(T ) for T is a subset of U , which is partitioned as V = V1 [ V2 U .
Nodes in Vi are called Type i for i = 1; 2. The de nition of Type 1 and Type 2
nodes follows the one for original LSTs [
          <xref ref-type="bibr" rid="ref4">4</xref>
          ].
1. A node u 2 U is Type 1 if u is a leaf or a branching node in PSTrie(T ).
2. A node u 2 U is Type 2 if u 2= V1 and sl(u) 2 V1.
        </p>
        <p>Edges of PLST(T ) are trivially determined: we have (u; uv) 2 V V as an edge
if and only if v 6= " and there is no proper nonempty pre x v0 of v such that
uv0 2 V . We will show in Section 3.3 that jV j 2 O(jT j). We say that u 2 V is
good if sl(u) 2 V , and u 2 V is bad otherwise. Note that any u 2 V2 is good by
the de nition of V2, and that the root " is bad.</p>
        <p>
          To obtain str(u; v) for an edge (u; v), if jvj juj = 1, we simply read the edge
label v[
          <xref ref-type="bibr" rid="ref1">1</xref>
          ] like an LST. Otherwise, if both u and v are good, we basically use
the technique of \reduction by su x links". An important observation is that
the equation str(u; v) = str(sl(u); sl(v)), which was a key property to regain the
original label in LSTs, does not necessarily hold for PLSTs. Figure 4 shows an
example, where str(u; v) = cb40 6= cb00 = str(sl(u); sl(v)); the third symbol 4 in
str(u; v) is re-encoded to 0 in str(sl(u); sl(v)), because the rst symbol v[
          <xref ref-type="bibr" rid="ref1">1</xref>
          ] = 0 of
v, that is referenced by the symbol 4, is cut out in sl(v). Fortunately, the possible
di erence between str(u; v) and str(sl(u); sl(v)) is limited.
u a
l&lt;atexish1_b64="(nu)&gt;/
|l&lt;atexish1_b64="(nu)&gt;/u| = 2 c
v 3
l&lt;atexish1_b64="(nu)&gt;/
|l&lt;atexish1_b64="(nu)&gt;/v| = 6
        </p>
        <p>a
ure, we check whether str(u; v) matches
and the parent of v is u = 0a of length 2.
pattern p = a04b using fast links.</p>
        <p>For the node sl(v) = acb00, Re(sl(v)) = 0.
substring of the original text T , like p-su x trees. However, di erently from
psu</p>
        <p>x trees, not every part of the original text is referenced by an edge in our
case. We keep only the subsequence T 0 of T obtained by removing parts that are
not referred to. We label an edge (u; v) connected to a bad node with an integer
triple (i; j; k) such that str(u; v) = hT 0ik[i : j].</p>
        <p>In summary, PLST(T ) consists of three kinds of nodes: good Type 1, bad
Type 1, and Type 2 (all good). If u 2 V is a good node, u has its depth, su x
link and re-encoding sign, i.e., the triple (juj; SL(u); Re(u)), where SL(u) = sl(u).
Here we use the notation SL(u) to emphasize that the su
x link SL(u) is a
pointer to the node corresponding to the string sl(u) rather than the string
itself. Therefore, it requires only constant size of memory space. If u 2 V is
bad, u dose not have a su</p>
        <p>
          x link, i.e., u has the triple (juj; null; Re(u)). Each
edge (u; v) has either a label character or triple; if both u and v are good or
str(u; v) = 1, the edge label is str(u; v)[
          <xref ref-type="bibr" rid="ref1">1</xref>
          ]. Otherwise, the edge label is a triple
(i; j; k) such that str(u; v) = hT 0ik[i : j]. If some bad nodes appear in PLST(T ),
we need the subsequence T 0 of prev(T ) to recover the labels of edges connecting
the bad nodes. Otherwise, we do not need any text.
        </p>
        <p>and ai 2</p>
        <p>We remark that another idea to overcome the problem of the absence of sl(u)
in a PLST for a node u might be to add sli(u) to V for all i = 1; : : : ; juj so that V
is closed under sl, where sli(u) = sl(sli 1(u)) and sl0(u) = u. However, there exists
for each i, for which the number of those additional nodes will be
(jTnj2). Thus, the size of the index structures cannot be kept in linear.
3.2</p>
      </sec>
      <sec id="sec-3-2">
        <title>Parameterized pattern matching with PLSTs</title>
        <p>This subsection presents our algorithm for solving the parameterized pattern
matching problem as an application of PLSTs. The function P-Match of
Algorithm 1 takes a prev-encoded string p and a node in PLST(T ) and checks whether
there is v 2 PrevSub(T ) such that p = str(u; v). If it is the case, it returns the
least extension v0 of v such that v0 2 V . In other words, p is a pre x of str(u; v0),
where v0 should be v itself if v 2 V . Otherwise, it returns null.</p>
        <p>
          For an input pair (p; u), if p = ", then P-Match returns u, as it is required.
Otherwise, it rst tries to regain str(u; v) for the p[
          <xref ref-type="bibr" rid="ref1">1</xref>
          ]-child v of u, if u has such a
child. At rst, suppose jpj jvj juj = l. We would like to know whether p[1 : l] =
str(u; v). If l = 1, it means that we have already con rmed that p[1 : l] = str(u; v).
Then we just go down to v and recursively call P-Match(p[2 :]; v). If l 2 and
either u or v is bad, we refer to T 0 and check if p[1 : l] = str(u; v) as with matching
in a p-su x tree. If l 2 and both u and v are good, we cannot know from the
edge (u; v) itself what str(u; v) is except for its rst symbol str(u; v)[
          <xref ref-type="bibr" rid="ref1">1</xref>
          ] = p[
          <xref ref-type="bibr" rid="ref1">1</xref>
          ].
To recover whole str(u; v), we use the su x link of u. Since u is good, SL(u) is
de ned. If Re(v) = 0, we have str(u; v) = str(sl(u); sl(v)) by Lemma 1, and we
simply call P-Match(p[1 : l]; SL(u)). Otherwise, we have p[1 : l] = str(u; v) if
and only if p[Re(v)] = juj + Re(v) 1 and p0[1 : l] = str(sl(u); sl(v)), where
for i = 1; : : : ; jpj. Thus, the recursive call of P-Match(p0[1 : l]; SL(u)) returns
null i p[1 : l] 6= str(u; v). If P-Match(p0[1 : l]; SL(u)) returns a node, then p[1 :
l] = str(u; v) and thus we continue matching by calling P-Match(p[l + 1 :]; v).
        </p>
        <p>The above discussion is valid when jpj jvj juj. If Re(v) = 0 or Re(v) &gt; jpj,
then p is a pre x of str(u; v) i p is a pre x of str(sl(u); sl(v)). Otherwise, p is a
pre x of str(u; v) i p[Re(v)] = juj + Re(v) 1 and p0 is a pre x of str(sl(u); sl(v)).
Thus the recursion is justi ed. If P-Match(p0[1 : l]; SL(u)) returns a node, p is
a pre x of str(u; v) and we call P-Match("; v), which returns v.
Proposition 1. We can decide whether T has a substring that p-matches P
using Algorithm 1.</p>
        <p>
          The time complexity of Algorithm 1 is not linear as it is. Suppose that
P-Match(p; u) is called. It can be the case jvj juj jpj 2 and either
Re(v) = 0 or Re(v) &gt; l where v = child(u; p[
          <xref ref-type="bibr" rid="ref1">1</xref>
          ]). In this case, the algorithm
simply calls P-Match(p; SL(u)), where the rst argument has not changed from the
preceding call. Such recursion may be repeated, and amortized time complexity
is not linear. The same di culty and a solution have already been discussed
by Crochemore et al. [
          <xref ref-type="bibr" rid="ref4">4</xref>
          ] for LSTs. Following them, we introduce fast links as
follows, which allow us to skip recursions that always preserve the rst argument.
De nition 4 (Fast link). For each edge (u; v) 2 V V such that jvj juj &gt; 1
and both u, v are good, the fast link for (u; v) is de ned to be FL(u; v) = SLk(u)
where k 1 is the smallest integer satisfying either jvkj &lt; jvj k or 0 &lt; Re(vk),
where vk = child(SLk(u); a) for a = str(u; v)[
          <xref ref-type="bibr" rid="ref1">1</xref>
          ].
        </p>
        <p>Algorithm 1 will run in linear time by replacing SL(u) in Line 14 by FL(u; v).
If jvkj &lt; jvj k = jslk(v)j, the node vk occurs between slk(u) and slk(v). Then,
P-Match(p; SLk(u)) will call P-Match(p[1 : jvkj jSLk(u)j]; SLk+1(u)). When</p>
      </sec>
      <sec id="sec-3-3">
        <title>Algorithm 1: P-Match(p; u)</title>
        <p>
          0 &lt; Re(vk), we change the Re(vk)-th symbol of p, which must be a positive
integer, to 0. Therefore, the number of fast links we follow is bounded by 2jpj.
Figure 5 shows how to p-match str(u; v) and p = a04b using fast links. We know
that p[
          <xref ref-type="bibr" rid="ref1">1</xref>
          ] = str(u; v)[
          <xref ref-type="bibr" rid="ref1">1</xref>
          ] = a. After following the fast link (1), we check whether
p[Re(sl2(v))] = 4 and rewrite the value of p[Re(sl2(v))] to 0. After using (2), we
check whether p[
          <xref ref-type="bibr" rid="ref3">3</xref>
          ] = 0. In this way, we can know that p matches str(u; v).
Theorem 1. Given PLST(T ) and a pattern P of length m, we can decide whether
T has a substring that p-matches P in O(m) time.
3.3
        </p>
      </sec>
      <sec id="sec-3-4">
        <title>The size of PLSTs</title>
        <p>
          We now show that the size of PLST(T ) is linear with respect to the length n of a
text T . First, we show a linear upper bound on the number of nodes of PLST(T ).
The nodes of Type 1 appear in the p-su x tree, so they are at most 2n [
          <xref ref-type="bibr" rid="ref3">3</xref>
          ]. It is
enough to show that the number of nodes of Type 2 is linearly bounded as well.
Lemma 2. The number of Type 2 nodes in PLST(T ) is smaller than 2n.
Proof. Let us consider an implicit su x link chain in PSTrie(T ) starting from
w = prev(T [: k]) with 1 k &lt; n, i.e., (w; sl(w); sl2(w); : : : ; sljwj(w)). PSTrie(T )
has n 1 such chains and each internal node of PLST(T ) appears in at least
one chain. If a chain has two distinct Type 2 nodes sli(w) and slj(w) with i &lt; j,
since sli+1(w) is Type 1 by de nition, there exists a Type 1 node between them.
        </p>
        <p>De ne a binary relation R between V1 and V2 by
R = f (u; v) 2 V1</p>
        <p>V2 j there is i s.t. v = sli(u) and slj(u) 2= V2 for all j &lt; i g
and let R2 = f v 2 V2 j (u; v) 2 R for some u 2 V1 g. Since R is a partial
function from branching nodes to Type 2 nodes, we have jR2j n. By the above
argument on a chain, each chain has at most one Type 2 node v 2 V2 such
that v 2= R2. Since there are n 1 chains, we have jV2 n R2j &lt; n. All in all,
jV2j = jR2j + jV2 n R2j &lt; n + n = 2n. tu</p>
        <p>The number of edges and their labels, as well as the number of su x links,
depth and re-encoding sign for nodes, is asymptotically bounded above by the
number of nodes in PLST(T ). T 0 is a subsequence of prev(T ), thus its length is
O(n). Therefore, the size of PLST(T ) is O(n).</p>
        <p>Theorem 2. Given a p-string T of length n, the size of PLST(T ) is O(n).
4</p>
      </sec>
    </sec>
    <sec id="sec-4">
      <title>Experiments</title>
      <p>We performed comparative experiments on the number of nodes of PLSTs and
p-su x trees for four sorts of text strings changing their length. Text strings we
used are random strings of length n = 10; : : : ; 10240 over a constant alphabet
with j j = 2 and those over a parameter alphabet with j j = 2, and the
11th through 22nd Fibonacci strings over with j j = 2 and those over with
j j = 2. PLSTs for constant strings are of course identical to LSTs. For random
strings, we measured the average number of nodes for 100 strings of each length.
The results of our experiments are shown in Table 1. Recall that p-su x trees
consist of Type 1 nodes and prev(T ), while PLSTs have Type 1 and Type 2
nodes and T 0. For random strings, we can see that the number of Type 2 nodes
is close to the text length. Since a node requires much more memory size than a
character, PLSTs will be bigger than p-su x trees for random strings. On the
other hand, for Fibonacci strings, PLSTs have few Type 2 nodes and T 0 = .
Thus, PLSTs will use less space than p-su x trees for Fibonacci strings.</p>
      <p>
        In addition to Fibonacci strings, we constructed PLSTs for other kinds of
highly repetitive strings such as period-doubling and Thue-Morse strings [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ]. We
con rmed that those PLSTs have few Type 2 nodes and T 0 = . PLSTs for such
highly repetitive strings use less memory than p-su x trees.
5
      </p>
    </sec>
    <sec id="sec-5">
      <title>Conclusion and future work</title>
      <p>In this paper, we presented an indexing structure called a PLST for the
parameterized pattern matching problem. Given a p-string T of length n, the size
of PLST for T is O(n). We presented an algorithm that solves the problem in
O(m) time, where m is the length of the pattern. We experimentally showed that
PLST is space-saving from p-su x tree for indexing highly repetitive strings.</p>
      <p>
        For PLSTs to be useful for various applications, like computing the longest
common substrings, an e cient algorithm for constructing PLSTs is required
like LSTs [
        <xref ref-type="bibr" rid="ref11">11</xref>
        ]. Furthermore, the ideas developed in this paper may be useful to
generalize L-CDAWGs [
        <xref ref-type="bibr" rid="ref14">14</xref>
        ] to a data structure for parameterized strings.
      </p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          1.
          <string-name>
            <surname>Allouche</surname>
            ,
            <given-names>J.P.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Shallit</surname>
            ,
            <given-names>J.</given-names>
          </string-name>
          :
          <article-title>Automatic sequences: theory, applications</article-title>
          , generalizations. Cambridge university press (
          <year>2003</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          2.
          <string-name>
            <surname>Baker</surname>
            ,
            <given-names>B.S.:</given-names>
          </string-name>
          <article-title>A program for identifying duplicated code</article-title>
          .
          <source>Computing Science and Statistics</source>
          <volume>24</volume>
          ,
          <volume>49</volume>
          {
          <fpage>57</fpage>
          (
          <year>1992</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          3.
          <string-name>
            <surname>Baker</surname>
            ,
            <given-names>B.S.:</given-names>
          </string-name>
          <article-title>Parameterized pattern matching: Algorithms and applications</article-title>
          .
          <source>Journal of Computer and System Sciences</source>
          <volume>52</volume>
          (
          <issue>1</issue>
          ),
          <volume>28</volume>
          {
          <fpage>42</fpage>
          (
          <year>1996</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          4.
          <string-name>
            <surname>Crochemore</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Epifanio</surname>
            ,
            <given-names>C.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Grossi</surname>
            ,
            <given-names>R.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Mignosi</surname>
            ,
            <given-names>F.</given-names>
          </string-name>
          :
          <article-title>Linear-size su x tries</article-title>
          .
          <source>Theoretical Computer Science</source>
          <volume>638</volume>
          ,
          <issue>171</issue>
          {
          <fpage>178</fpage>
          (
          <year>2016</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          5.
          <string-name>
            <surname>Crochemore</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Rytter</surname>
            ,
            <given-names>W.</given-names>
          </string-name>
          :
          <article-title>Jewels of Stringology: Text Algorithms</article-title>
          . World Scienti c (
          <year>2003</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          6.
          <string-name>
            <surname>Deguchi</surname>
            ,
            <given-names>S.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Higashijima</surname>
            ,
            <given-names>F.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Bannai</surname>
            ,
            <given-names>H.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Inenaga</surname>
            ,
            <given-names>S.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Takeda</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          :
          <article-title>Parameterized su x arrays for binary strings</article-title>
          .
          <source>In: Proceedings of the Prague Stringology Conference</source>
          <year>2008</year>
          . pp.
          <volume>84</volume>
          {
          <issue>94</issue>
          (
          <year>2008</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          7.
          <string-name>
            <surname>Diptarama</surname>
            , Katsura,
            <given-names>T.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Otomo</surname>
            ,
            <given-names>Y.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Narisawa</surname>
            ,
            <given-names>K.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Shinohara</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          :
          <article-title>Position heaps for parameterized strings</article-title>
          .
          <source>In: 28th Annual Symposium on Combinatorial Pattern Matching (CPM</source>
          <year>2017</year>
          ). pp.
          <volume>8</volume>
          :
          <issue>1</issue>
          {8:
          <issue>13</issue>
          (
          <year>2017</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          8.
          <string-name>
            <surname>Fredriksson</surname>
            ,
            <given-names>K.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Mozgovoy</surname>
            ,
            <given-names>M.:</given-names>
          </string-name>
          <article-title>E cient parameterized string matching</article-title>
          .
          <source>Information Processing Letters</source>
          <volume>100</volume>
          (
          <issue>3</issue>
          ),
          <volume>91</volume>
          {
          <fpage>96</fpage>
          (
          <year>2006</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          9.
          <string-name>
            <surname>Fujisato</surname>
            ,
            <given-names>N.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Nakashima</surname>
            ,
            <given-names>Y.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Inenaga</surname>
            ,
            <given-names>S.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Bannai</surname>
            ,
            <given-names>H.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Takeda</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          :
          <article-title>Right-to-left online construction of parameterized position heaps</article-title>
          .
          <source>In: Prague Stringology Conference</source>
          <year>2018</year>
          . pp.
          <volume>91</volume>
          {
          <issue>102</issue>
          (
          <year>2018</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref10">
        <mixed-citation>
          10. Gus eld, D.: Algorithms on Strings,
          <source>Trees and Sequences: Computer Science and Computational Biology</source>
          . Cambridge University Press (
          <year>1997</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref11">
        <mixed-citation>
          11.
          <string-name>
            <surname>Hendrian</surname>
            ,
            <given-names>D.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Takagi</surname>
            ,
            <given-names>T.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Inenaga</surname>
            ,
            <given-names>S.</given-names>
          </string-name>
          :
          <article-title>Online Algorithms for Constructing LinearSize Su x Trie</article-title>
          .
          <source>In: 30th Annual Symposium on Combinatorial Pattern Matching (CPM</source>
          <year>2019</year>
          ). pp.
          <volume>30</volume>
          :
          <issue>1</issue>
          {
          <fpage>30</fpage>
          :
          <fpage>19</fpage>
          (
          <year>2019</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref12">
        <mixed-citation>
          12. I, T.,
          <string-name>
            <surname>Deguchi</surname>
            ,
            <given-names>S.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Bannai</surname>
            ,
            <given-names>H.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Inenaga</surname>
            ,
            <given-names>S.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Takeda</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          :
          <article-title>Lightweight parameterized su x array construction</article-title>
          .
          <source>In: Combinatorial Algorithms (IWOCA</source>
          <year>2009</year>
          ). pp.
          <volume>312</volume>
          {
          <issue>323</issue>
          (
          <year>2009</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref13">
        <mixed-citation>
          13.
          <string-name>
            <surname>Shibuya</surname>
            ,
            <given-names>T.</given-names>
          </string-name>
          :
          <article-title>Generalization of a su x tree for RNA structural pattern matching</article-title>
          .
          <source>Algorithmica</source>
          <volume>39</volume>
          (
          <issue>1</issue>
          ),
          <volume>1</volume>
          {
          <fpage>19</fpage>
          (
          <year>2004</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref14">
        <mixed-citation>
          14.
          <string-name>
            <surname>Takagi</surname>
            ,
            <given-names>T.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Goto</surname>
            ,
            <given-names>K.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Fujishige</surname>
            ,
            <given-names>Y.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Inenaga</surname>
            ,
            <given-names>S.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Arimura</surname>
          </string-name>
          , H.:
          <article-title>Linear-size cdawg: new repetition-aware indexing and grammar compression</article-title>
          .
          <source>In: International Symposium on String Processing and Information Retrieval</source>
          . pp.
          <volume>304</volume>
          {
          <issue>316</issue>
          (
          <year>2017</year>
          )
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>