<!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>
      <journal-title-group>
        <journal-title>ICTCS</journal-title>
      </journal-title-group>
    </journal-meta>
    <article-meta>
      <title-group>
        <article-title>Algorithmic View on Circular String Attractors</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Giuseppe Romana</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>University of Palermo</institution>
          ,
          <country country="IT">Italy</country>
        </aff>
      </contrib-group>
      <pub-date>
        <year>2023</year>
      </pub-date>
      <volume>24</volume>
      <fpage>13</fpage>
      <lpage>15</lpage>
      <abstract>
        <p>The notion of circular string attractor has been recently introduced by Mantaci et al. [TCS 2021]. It consists of a set Γ of positions in a word such that each distinct circular factor has at least an occurrence crossing one of the elements of Γ. Its definition is an extension of the notion of string attractor by Kempa and Prezza [STOC 2018], which has been introduced as a unifying framework for some dictionary-based compressors. In this paper, we present the first linear time algorithm to check whether a set is a circular string attractor of a word  ∈ {1, . . . ,  } by using ( log ) bits of space. We further show that, for each  &gt; 0, the decision problem of having a circular string attractor of size ≤  is NP-complete. The proof is obtained through a reduction from the analogous problem for string attractors, for which Kempa and Prezza [STOC 2018] proved the NP-completeness. This reduction naturally leads to a new algorithm for checking whether a set is a string attractor that, unlike one of the solutions proposed by Kempa et al. [ESA 2018], it is independent from the size of the alphabet.</p>
      </abstract>
      <kwd-group>
        <kwd>eol&gt;Circular String Attractor</kwd>
        <kwd>String Attractor</kwd>
        <kwd>Sufix Array</kwd>
        <kwd>Conjugate Array</kwd>
        <kwd>Longest Common Prefix Array</kwd>
      </kwd-group>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>1. Introduction</title>
      <p>
        show the properties that the data structures used verify, then we use these results to prove the
correctness of the algorithm proposed. Later, we analyze the complexity of the decision problem
of finding a circular string attractor of a word  of size at most  &gt; 0. This complexity is
obtained through a reduction from analogous problem on classical string attractor, leading to a
new algorithm for checking whether a set Γ is a string attractor. Even if the bounds obtained are
analogous to those of one of the algorithms presented by [
        <xref ref-type="bibr" rid="ref7">7</xref>
        ], we use well-known and simpler
data structures widely used in combinatorial pattern matching, namely the Sufix Array and the
Longest Common Prefix Array.
      </p>
    </sec>
    <sec id="sec-2">
      <title>2. Preliminaries</title>
      <p>An alphabet Σ is a set of elements called letters (or characters). We assume Σ to be finite, and
we denote by  = |Σ| its cardinality. A word (or string)  is a sequence of letters from Σ, and
its length is denoted by ||. We denote with  the empty word, that is the only word such that
|| = 0. We denote by Σ* the set of all words over Σ, by Σ+ = Σ* ∖ {} the set of all non-empty
words over Σ, and by Σ = { ∈ Σ* | || = } the set of all words of length , for some
integer  &gt; 0. We denote by alph() ⊆ Σ the set of letters from Σ that occur in .</p>
      <p>For each pair ,  ∈ [1, ], we denote by [, ] the factor (or substring) of  starting at
position  and ending at position . Further, if  = 1 or  = , then [, ] is called prefix or
sufix , respectively. Note that [1, ] = , and if  &gt; , we assume that [, ] = . The set of
factors of a word  is denoted by ℱ ().</p>
      <p>
        Given two words ,  ∈ Σ* , if  = [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ][
        <xref ref-type="bibr" rid="ref2">2</xref>
        ] · · · [||] and  = [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ][
        <xref ref-type="bibr" rid="ref2">2</xref>
        ] · · · [||], the
concatenation of  and , denoted by  ·  or simply , is the word [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ][
        <xref ref-type="bibr" rid="ref2">2</xref>
        ] · · · [||] · [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ][
        <xref ref-type="bibr" rid="ref2">2</xref>
        ] · · · [||].
      </p>
      <p>If a total order on the elements of Σ is defined, then we can induce diferent orders on words.
Given two words ,  ∈ Σ* , we say that  ≤  if  is prefix of , or there exists a word  and
two letters  &lt;  ∈ Σ such that  and  are prefixes of  and  respectively. We refer to this
order of the words as lexicographical order.</p>
      <p>Given two words 1, 2 ∈ Σ* , we say that 1 is a conjugate (or cyclic rotation, or simply
rotation) of 2 if there exist ,  ∈ Σ* such that 1 =  and 2 = . We denote by ℛ()
the set of rotations of the word . Note that ℛ(1) = ℛ(2) if and only if 1 and 2 are
respectively conjugate. A finite word  is then primitive if and only if |ℛ()| = ||, i.e.,
when all rotations of  are distinct. A circular factor of a word  is a factor that occur in
at least one of the rotations of . The set of all circular factors of a word  is denoted by
() = ⋃︀′∈ℛ() ℱ (′).</p>
      <p>The Sufix Array (SA) of a word  ∈ Σ is an array of length  such that [SA[], ] &lt;
[SA[], ] for every 1 ≤  &lt;  ≤ . The Inverse Sufix Array (ISA) is the inverse of SA, i.e.
ISA[] =  if and only if SA[] = . Analogously, let CA be the Conjugate Array of a word ,
defined as:</p>
      <p>CA[] =  if  = [, ][1,  − 1],
where  is the th rotation in lexicographical order.</p>
      <p>
        Given two words ,  ∈ Σ* , let ℓ(, ) be the the longest common prefix between  and ,
that is ℓ(, ) = [1, |ℓ(, )|] = [1, |ℓ(, )|], but [|ℓ(, )|+1] ̸= [|ℓ(, )|+1]
(assuming ℓ(, ) &lt; min{||, ||}). The Longest Common Prefix Array (LCP) of  ∈ Σ is an
array of length  such that LCP[
        <xref ref-type="bibr" rid="ref1">1</xref>
        ] = 0 and LCP[] = |ℓ([SA[ − 1], ], [SA[], ))|, where
1 &lt;  &lt; . Analogously, we denote by LCP the circular Longest Common Prefix Array , defined
as follows:
      </p>
      <p>LCP[] =
︂{
0
|ℓ(− 1, )|
if  = 0
otherwise
.
[, ].</p>
      <p>
        A string attractor of a word  ∈ Σ is a set of  positions Γ = {1, . . . ,  } such that every
factor [, ] has an occurrence [′, ′] = [, ] with  ∈ [′, ′], for some  ∈ [1,  ] [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ]. We
denote by  * () the size of a smallest string attractor of a word . Furthermore, we say that
an occurrence [, ] crosses a position  ∈ Γ if  ∈ [, ], and symmetrically that  is crossed by
      </p>
      <p>
        Throughout the paper, we will show examples of the algorithms applied on the family of
ifnite Fibonacci words , which can be defined recursively as follows: 0 = b, 1 = a, and
+1 =  · − 1, for all integer  &gt; 1.
3. Circular String Attractors
Analogously to the definition of string attractor, Mantaci et al. [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ] extended such a notion in
order to capture factors that occur on the boundaries of a word.
      </p>
      <p>Definition 1</p>
      <p>Let  ∈ Σ, for some  &gt; 0. A set Γ = {1, 2, . . .   } ⊆
string attractor of  if each circular factor of  has at least a circular occurrence that crosses a
position of Γ. Moreover, we denote with  * () the size of a smallest circular string attractor of
[1, ] is a circular
the word .</p>
      <p>Example 1 Let  =  be a word over the alphabet Σ = {, , }. The set Γ =
{2, 5, 8} is a string attractor for , since it covers any of its factors, but it is not a circular string
attractor since the circular factor (in blue)  escapes from it. On the other hand, the set
Γ = {1, 4, 9} is a circular string attractor for  =  but it is not a string attractor.
In fact, the factor  (in blue), fully contained in , is covered only if we consider its circular
occurrence crossing position 1.</p>
      <p>
        From the definition, it easily follows that the sizes  * of smallest circular string attractors of
conjugate words are equal [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ].
 &gt; 0, but that also the structures of the respective circular string attractors are related.
      </p>
      <p>The following lemma shows not only that  * () =  * (), for all  ∈ Σ* and integer
Γ′ = ⋃︀</p>
      <p>∈[1, ]{ + ||} is a circular string attractor of .</p>
      <p>Lemma 1 Let  ∈ Σ* be a finite word and</p>
      <p>Γ = {1, 2, . . . ,   } ⊆
circular string attractor of  if and only if, for all  &gt; 1 and for all  ∈ [0,  −
[1, ||]. Then, Γ is a
1]  , the set
Proof For the first direction, note that since the word  has period ||, all circular factors of
length at most || which cross the position  for some  ∈ [1,  ] have another occurrence crossing
the position  + ||. For all the circular factors of  of length greater than ||, for the same
argument we can find (at least)  circular occurrences through  at distance ||, covering the
a
a
a
a
a
a
a
a
b
b
b
b
b
a
a
a
b
b
b
b
b
a
a
a
a
a
b
b
b
a
a
a
a
a
a
a
a
b
b
a
a
a
a
a
a
b
b
b
b
b
a
a
a
b
b
b
b
b
a
a
a
a
a
a
a
b
a
a
a
a
a
a
a
a
b
b
b
b
a
a
a
a
b
b
b
b
b
a
a
a
a
b
b
b
b
a
a
a
a
a
a
a
a
b
a
a
a
a
a
a
a
b
b
b
b
b
a
b
b
b
b
b
a
a
a
a
a
a
a
a
whole word, and therefore these factors can be moved to every other occurrence of  where a
position from Γ′ falls.</p>
      <p>
        For the second implication, by hypothesis the set Γ is a circular string attractor of .
Symmetrically to the previous direction, since the set of all circular factors of  of length at most ||
corresponds to the set (), and each of these circular factors from () is fully covered from the
elements in Γ, the thesis follows.
4. Checking the Circular Attractor Property in Linear Time
Given a word  of length  &gt; 0, let us consider the matrix ℳ() = {1, . . . , } of the
rotations of  sorted in lexicographical order. For every factor  ∈ (), we denote with ℐ
the set of rotations from ℳ() starting with , taken in lexicographical order. In order to
give a high-level view of how the algorithm works, let us consider the finite Fibonacci word
6 = abaababaabaab. In Figure 1, it is shown the matrix of sorted rotations of 6 and, for each
rotation, the positions of a circular string attractor described in [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ]. One can verify that, for
each circular factor  ∈ (6), the rotations having  as prefix are consecutive, and at least one
of these prefixes crosses a position of the circular string attractor. Note that this is not a matter
of chance, since each occurrence of every circular factor is a prefix of a rotation.
      </p>
      <p>For each  ∈ () ∖ {}, let ℓ, , with 1 ≤ ℓ ≤  ≤ , be the indices such that
ℐ = {ℓ , ℓ+1, . . . ,  }. The following lemma summarises how to detect the indices ℓ
and  from the LCP array.</p>
      <p>Lemma 2 Let  ∈ Σ, for some  &gt; 0. The following hold:
1. ℓ = 1 or LCP[ℓ] &lt; ||;
2.  =  or LCP[ + 1] &lt; ||;
3. LCP[] ≥ | |, for all  ∈ [ℓ + 1, ].</p>
      <p>Proof For case 1., suppose ℓ &gt; 1. By contradiction, if LCP[ℓ] ≥ , then also the rotation ℓ+1
has  as prefix, which is a contradiction by hypothesis on ℓ.</p>
      <p>Case 2. is treated symmetrically.</p>
      <p>Case 3. follows by observing that all the rotations in ℐ are consecutive and share the same
prefix of length ||. □</p>
      <p>Given an ordered set Γ = {1, 2, . . . ,   } and a word  ∈ Σ, let succ ∈ {0, 1, . . . ,  −
1} be the array of circular distances of each position  ∈ [1, ] of  to the next position  in
Γ, that is:
succ[] =
⎧⎨ 1 −  if 1 ≤  ≤ 1</p>
      <p>+1 −  if  &lt;  ≤ +1, for all  ∈ [1,   − 1]
⎩ ( − ) + 1 if   &lt; .</p>
      <p>
        Example 2 Let us consider the word  = abbabaa and the set Γ = {3, 5, 6} (the underlined
positions in ). Then, succ = [
        <xref ref-type="bibr" rid="ref1 ref1 ref2 ref3">2, 1, 0, 1, 0, 0, 3</xref>
        ].
      </p>
      <p>By Lemma 1, we know that a set Γ is a circular string attractor for the word , where  &gt; 1,
if and only if Γ′ = ⋃︀∈Γ {( − 1 mod ||) + 1} is a circular string attractor of . Thus,
we can assume that  is primitive, otherwise we can find its root  in linear time and check
whether the set Γ′ obtained as just described is a circular string attractor of .
Lemma 3 Let  ∈ Σ be a primitive word, and let Γ ⊆ [1, ] be a set of positions in , for some
 &gt; 0. Then, Γ is a circular string attractor of  if and only if, for all  ∈ (), there exists
 ∈ [ℓ, ] such that succ[CA[]] &lt; ||.</p>
      <p>Proof For the first implication, if Γ is a circular string attractor, then for each  ∈ () there
exists at least one occurrence that is crossed by a position  ∈ Γ. Let  ∈ [ℓ, ] be the index
of the rotation starting with such an occurrence of . Thus, if we project the position from Γ in
the th rotation, such a position falls at most at distance ||, and therefore succ[CA[]] is at most
|| − 1.</p>
      <p>The other direction is treated symmetrically. In fact, by contradiction, if for all  ∈ [ℓ, ]
it holds that succ[CA[]] ≥ | |, then none of the occurrences of  crosses a position in Γ, and
therefore it can not be a circular string attractor; contradiction. □</p>
      <p>Thus, in order to check whether a set Γ is a circular string attractor, we need to check if,
for all  ∈ (), there exists  ∈ [ℓ, ] such that succ[CA[]] &lt; ||. In Algorithm 1 we
describe the designed procedure. We store in a stack  the ranges of lengths of the circular
factors left to cover, and proceeding by comparing in order the LCP with the succ array. We
use Lemma 2 to understand if we are still in the range [ℓ, ] without even knowing , but
just by using the LCP array (line 8). Note that this is legit since for all ,  ∈ Σ* it holds that
[ℓ, ] ⊆ [ℓ, ], i.e., we can not leave the range [ℓ, ] before checking if the factor 
is covered within [ℓ, ]. The consecutive lengths of the circular factors left to cover are
inserted as a pair (, ) in .</p>
      <p>We can then obtain the following:
Algorithm 1: Algorithm for checking if a set Γ is a circular string attractor of a word

else
if LCP[] ≤ succ[CA[]] then
if  = LCP[] then</p>
      <p>.ℎ((, succ[CA[]]))
else
.ℎ((, ))
if LCP[] 1&lt;7 succ[CA[]] then .ℎ((LCP[] + 1, succ[CA[]]))
25 if  is empty then
26 return true
27 else
28 return false
else
while  is not empty ∧ succ[CA[]] ≤  do</p>
      <p>(, ) ← .()
if  &lt; succ[CA[]] then</p>
      <p>.ℎ((, min{, succ[CA[]]}))
else</p>
      <p>if LCP[] &lt; succ[CA[]] then .ℎ((LCP[] + 1, succ[CA[]]))
Theorem 1 Given a primitive word  ∈ Σ and a set Γ ⊆ [1, ], Algorithm 1 checks whether or
not the set Γ is a circular string attractor for . Moreover, it runs in () time using ( log )
bits of space.</p>
      <p>
        Proof The Conjugate Array CA can be computed in linear time [
        <xref ref-type="bibr" rid="ref8">8</xref>
        ]. The LCP array can be
computed in linear time from CA [
        <xref ref-type="bibr" rid="ref10 ref9">9, 10</xref>
        ]. The main loop (line 5) is executed at most  times. Further,
the inner loop in line 19 where we empty the stack  can be executed at most || times in total.
Since we add at most one pair in  at each iteration of the main loop, it holds that the number of
elements in the stack is || = (), occupying at most ( log ) bits of space. Thus, Algorithm 1
works in () time using ( log ) bits of space and the thesis follows. □
Example 3 In Figure 2, we show the steps of Algorithm 1 applied to the 5th finite Fibonacci word
5 = abaababa with the set Γ = {4, 5}. The matrix of the sorted rotations is shown to give to
the reader a graphical interpretation of the procedure, however recall that we do not use it.
      </p>
      <p>
        The stack  is initially empty, so at the iteration  = 1 we start to fill it with the lengths of the
prefixes of the first rotation in lexicographical order that need to cross a position from Γ. Since
succ[CA[
        <xref ref-type="bibr" rid="ref1">1</xref>
        ]] = 4, this means that all prefixes of the first rotation with length greater than 4 cross
a position from Γ. On the other hand, we can not say anything yet on the prefixes from length
1 to 4, which are a, aa, aab, and aaba. In fact, since LCP[
        <xref ref-type="bibr" rid="ref1">1</xref>
        ] = 0 &lt; 4 = succ[CA[
        <xref ref-type="bibr" rid="ref1">1</xref>
        ]], we push
into the stack  the pair (1, 4) (line 24), as displayed in Subfigure 2a.
      </p>
      <p>
        On the iteration  = 2, we pop from the stack the ranges of lengths (1, 4), and we compare the
maximum (4) with LCP[
        <xref ref-type="bibr" rid="ref2">2</xref>
        ], since we want to check whether there is another occurrence of all the
factors represented in the stack. Since LCP[
        <xref ref-type="bibr" rid="ref2">2</xref>
        ] = 4, we have another rotation with prefix aaba, and
therefore such a rotation starts by a, aa, and aab as well. In Subfigure 2b, since succ[CA[
        <xref ref-type="bibr" rid="ref2">2</xref>
        ]] = 1,
analogously to the previous case all prefixes longer than 1 cross a position from Γ, and therefore
only a is left to cover, and we insert in the stack the range (1, 1) (line 22).
      </p>
      <p>
        Then, at the iteration  = 3 (Subfigure 2c), the prefix a still occurs (LCP[
        <xref ref-type="bibr" rid="ref3">3</xref>
        ] = 1), but it does not
cross a position from Γ (succ[CA[
        <xref ref-type="bibr" rid="ref3">3</xref>
        ]] = 6), so we extend the range from (1, 1) to (1, 6) and push
it in  (line 13), that is we keep track of the factors a, ab, aba, abaa, abaab, and abaaba.
      </p>
      <p>
        The algorithm proceeds as shown in Subfigure 2d, by shrinking the range (1, 6) to (1, 3) (line 22).
At the following iteration shown in Subfigure 2e the stack is emptied for the first time, since
succ[CA[
        <xref ref-type="bibr" rid="ref5">5</xref>
        ]] = 0 and the condition of line 21 is not met.
      </p>
      <p>We keep following the procedure for the iterations 6, 7, and 8, respectively shown in Subfigures 2f,
2g, and 2h. Since at the end of the main loop the stack is empty, each circular factor crosses at least
a position from Γ, and therefore we return true.</p>
      <p>
        Remark 1 Given a pair (, ) in , every pair (′, ′) that goes on top of (, ) must verify that
′ &gt; , since if ′ =  then (, ) is replaced with (, ′). Thus, in the worst-case scenario  would
contain the pairs (1, 1), (3, 3), . . . , (⌊︀ 2 ⌉︀ , ︀⌊ 2 ⌉︀ ), that is  requires at most  log  bits of space.
Overall, Algorithm 1 requires up to 4 log  bits of space to run.
5. Complexity of circular-attractor
In their original work, Kempa and Prezza [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ] have formulated the following decision problem
attractor = {⟨, ⟩ :  has a string attractor of size ≤ }.
      </p>
      <p>In the same work, they proved that this problem is NP-complete. Here we define the analogous
problem extended to the notion of circular string attractor:</p>
      <p>circular-attractor = {⟨, ⟩ :  has a circular string attractor of size ≤ }.</p>
      <p>The following lemma shows a reduction to the analogous problem on circular string attractors.
Lemma 4 Given an integer  &gt; 0, let  ∈ Σ be a finite word and let $ ∈/ Σ. A set Γ is a string
attractor for  if and only if Γ ∪ { + 1} is a circular string attractor for $</p>
      <p>CA</p>
      <p>Proof Let $($) denote the set of all circular factors of $ containing the letter $. One can
observe that ($) = ℱ () ∪ $($). Indeed, ℱ () ∩ $($) = ∅, and the position { + 1} is
crossed by all and only circular factors from $($). Thus, the factors to cover in  are the same
as the circular factors in ($) ∖ $($), and since they are located in the same positions in both
words the thesis follows. □</p>
      <p>From the reduction above, we can deduce the computational complexity of the
circular-attractor problem.</p>
      <p>Theorem 2 The circular-attractor problem is NP-complete.</p>
      <p>
        Proof By Theorem 1, each solution for the circular-attractor problem can be checked in polynomial
time and space, and therefore circular-attractor ∈ NP. Furthermore, Lemma 4 shows how to reduce
an instance ⟨, ⟩ for the problem attractor to circular-attractor by replacing  and  with $
and  + 1 respectively, since for each string attractor Γ of  the set Γ ∪ { + 1} is a circular string
attractor of $. □
6. Novel Algorithm for Checking the Attractor Property
If we consider the same problem on classical string attractors, Kempa et al. presented two
algorithms for checking whether a set Γ is a string attractor for a word  ∈ Σ [
        <xref ref-type="bibr" rid="ref7">7</xref>
        ]. The
ifrst algorithm uses optimal ( log  ) bits of space and operates in ( log ) time, for any
constant  &gt; 0. To reach the linear time, Kempa et al. proposed another algorithm requiring
((log  + log )) bits of space. Both algorithms are based on sufix trees and other data
structures supporting range-minimum queries, for which the implementation is not trivial in
all programming languages.
      </p>
      <p>Here we present a novel algorithm taking the same time and space complexities as
Algorithm 1. The algorithm is constructed from the strategies developed in Algorithm 1 and from
the equivalence of Lemma 4. Recall that appending a $ smaller than any other symbol in Σ
implies that CA = SA and LCP = LCP. We can then derive the following Theorem.
Theorem 3 Given a word  ∈ Σ and a set Γ ⊆ [1, ], Algorithm 2 checks whether or not the
set Γ is a string attractor for  in () time using ( log ) bits of space.</p>
      <p>Proof The correctness of Algorithm 2 is derived from its equivalence in Lemma 4 with Algorithm 1.
The Sufix Array SA, the LCP array, and the succ array can be computed in () time using
( log ) bits of space. Note that, unlike Algorithm 1, Algorithm 2 takes in input also words
that are not primitive, since by appending the letter $ ∈/ Σ every word becomes primitive. Since
Algorithm 2 takes the same time and space as Algorithm 1, the thesis follows. □
Example 4 Let us consider the word  ′ = ababaaba, that is a rotation of the word 5 from
Example 3, and let us consider the set of positions Γ = {7, 8}. In Figure 3, the iterations of
Algorithm 2 with  ′ and Γ in input are shown. Recall that we compute the LCP, succ, and SA
arrays for the word  ′$, and we extend Γ with the position of the $, i.e. Γ = {7, 8, 9}.
25 if  is empty then
26 return true
27 else
28 return false
else
while  is not empty ∧succ[SA[]] ≤  do</p>
      <p>(, ) ← .()
if  &lt; succ[SA[]] then</p>
      <p>.ℎ((, min{, succ[SA[]]}))
if LCP[] &lt; succ[SA[]] then .ℎ((LCP[] + 1, succ[SA[]]))
Algorithm 2: Algorithm for checking if a set Γ is a string attractor for a word</p>
      <p>
        As shown in Subfigure 3a, at first the stack is empty and the condition of line 24 is not met, since
LCP[
        <xref ref-type="bibr" rid="ref1">1</xref>
        ] = succ[SA[
        <xref ref-type="bibr" rid="ref1">1</xref>
        ]] = 0, and therefore nothing is added into . The same procedure occurs at
the following iteration, in Subfigure 3b.
      </p>
      <p>
        Since at the third iteration the stack is still empty, each factor that is prefix of the first two rotations
has an occurrence crossing at least a position in Γ. Since this time 1 = LCP[
        <xref ref-type="bibr" rid="ref3">3</xref>
        ] &lt; succ[SA[
        <xref ref-type="bibr" rid="ref3">3</xref>
        ]] = 2,
we add to the stack in line 24 only the factors that have not occurred yet (i.e. of length at least
LCP[
        <xref ref-type="bibr" rid="ref3">3</xref>
        ] + 1) and that are not crossing a position in Γ (i.e. of length at most succ[SA[
        <xref ref-type="bibr" rid="ref3">3</xref>
        ]]), and
therefore we add the range (2, 2). As shown in Subfigure 3c, such a range corresponds to the factor
aa.
      </p>
      <p>LCP = 0 0 1 1 3 3 0 2 2</p>
      <p>SA
→ 9
8
5
6
3
1
7
4
2
SA
9
8
→ 5
6
3
1
7
4
2
$ a b a b a a b a
a $ a b a b a a b
a a b a $ a b a b
a b a $ a b a b a
a b a a b a $ a b
a b a b a a b a $
b a $ a b a b a a
b a a b a $ a b a
b a b a a b a $ a</p>
      <p>(a)  = 1
$ a b a b a a b a
a $ a b a b a a b
a a b a $ a b a b
a b a $ a b a b a
a b a a b a $ a b
a b a b a a b a $
b a $ a b a b a a
b a a b a $ a b a
b a b a a b a $ a
(c)  = 3


↓
(2, 2)</p>
      <p>
        Finally, in Subfigure 3d, one can see that the factor aa does not occur as prefix in the following
rotations. In fact, at the iteration  = 4 Algorithm 2 checks in line 9 whether the factor that we are
looking for occurs again as prefix by comparing LCP[
        <xref ref-type="bibr" rid="ref4">4</xref>
        ] = 1 with the maximum value from the top
of the stack. Since the condition is not met, the algorithm returns false, i.e. the factor aa is not
crossed by any position in Γ, and therefore Γ is not a string attractor.
      </p>
    </sec>
    <sec id="sec-3">
      <title>7. Conclusions</title>
      <p>In this work, we have shown an easy reduction from the attractor decision problem to its
circular version, leading to an NP-completeness for circular-attractor. We have also presented
the first algorithm in literature that checks whether a set Γ is a circular string attractor for
a word  ∈ Σ, operating in () time and ( log ) bits of space. Furthermore, given the
reduction above mentioned and the equivalence between the order of the rotations and order
of the sufixes for words of the type $, we have presented a new algorithm for checking the
attractor property of a set by using the sufix and the Longest Common Prefix Arrays, using
the same time and space bound as the previous one. With respect to the solutions proposed by
Kempa et al., the algorithm here proposed is independent from the size of the alphabet.</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          [1]
          <string-name>
            <given-names>D.</given-names>
            <surname>Kempa</surname>
          </string-name>
          ,
          <string-name>
            <given-names>N.</given-names>
            <surname>Prezza</surname>
          </string-name>
          ,
          <article-title>At the roots of dictionary compression: string attractors</article-title>
          ,
          <source>in: STOC</source>
          <year>2018</year>
          , ACM,
          <year>2018</year>
          , pp.
          <fpage>827</fpage>
          -
          <lpage>840</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          [2]
          <string-name>
            <given-names>S.</given-names>
            <surname>Mantaci</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Restivo</surname>
          </string-name>
          , G. Romana, G. Rosone,
          <string-name>
            <given-names>M.</given-names>
            <surname>Sciortino</surname>
          </string-name>
          ,
          <article-title>A combinatorial view on string attractors</article-title>
          ,
          <source>Theor. Comput. Sci</source>
          .
          <volume>850</volume>
          (
          <year>2021</year>
          )
          <fpage>236</fpage>
          -
          <lpage>248</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          [3]
          <string-name>
            <given-names>K.</given-names>
            <surname>Kutsukake</surname>
          </string-name>
          ,
          <string-name>
            <given-names>T.</given-names>
            <surname>Matsumoto</surname>
          </string-name>
          ,
          <string-name>
            <given-names>Y.</given-names>
            <surname>Nakashima</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>Inenaga</surname>
          </string-name>
          ,
          <string-name>
            <given-names>H.</given-names>
            <surname>Bannai</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Takeda</surname>
          </string-name>
          ,
          <article-title>On repetitiveness measures of Thue-Morse words</article-title>
          ,
          <source>in: SPIRE</source>
          , volume
          <volume>12303</volume>
          of Lect. Notes Comput. Sc., Springer,
          <year>2020</year>
          , pp.
          <fpage>213</fpage>
          -
          <lpage>220</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          [4]
          <string-name>
            <given-names>L.</given-names>
            <surname>Schaefer</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.</given-names>
            <surname>Shallit</surname>
          </string-name>
          ,
          <article-title>String attractors for automatic sequences</article-title>
          , CoRR abs/
          <year>2012</year>
          .06840 (
          <year>2021</year>
          ). arXiv:
          <year>2012</year>
          .06840.
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          [5]
          <string-name>
            <given-names>A.</given-names>
            <surname>Restivo</surname>
          </string-name>
          , G. Romana,
          <string-name>
            <given-names>M.</given-names>
            <surname>Sciortino</surname>
          </string-name>
          ,
          <article-title>String attractors and infinite words</article-title>
          ,
          <source>in: LATIN</source>
          , volume
          <volume>13568</volume>
          of Lecture Notes in Computer Science, Springer,
          <year>2022</year>
          , pp.
          <fpage>426</fpage>
          -
          <lpage>442</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          [6]
          <string-name>
            <given-names>F.</given-names>
            <surname>Gheeraert</surname>
          </string-name>
          , G. Romana,
          <string-name>
            <given-names>M.</given-names>
            <surname>Stipulanti</surname>
          </string-name>
          ,
          <article-title>String attractors of fixed points of k-bonacci-like morphisms</article-title>
          ,
          <source>in: WORDS</source>
          , volume
          <volume>13899</volume>
          of Lecture Notes in Computer Science, Springer,
          <year>2023</year>
          , pp.
          <fpage>192</fpage>
          -
          <lpage>205</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          [7]
          <string-name>
            <given-names>D.</given-names>
            <surname>Kempa</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Policriti</surname>
          </string-name>
          ,
          <string-name>
            <given-names>N.</given-names>
            <surname>Prezza</surname>
          </string-name>
          , E. Rotenberg, String Attractors:
          <article-title>Verification and Optimization</article-title>
          , in: ESA, volume
          <volume>112</volume>
          of Leibniz International Proceedings in Informatics (LIPIcs),
          <source>Schloss Dagstuhl-Leibniz-Zentrum fuer Informatik</source>
          , Dagstuhl, Germany,
          <year>2018</year>
          , pp.
          <volume>52</volume>
          :
          <fpage>1</fpage>
          -
          <lpage>52</lpage>
          :
          <fpage>13</fpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          [8]
          <string-name>
            <given-names>C.</given-names>
            <surname>Boucher</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D.</given-names>
            <surname>Cenzato</surname>
          </string-name>
          ,
          <string-name>
            <given-names>Z.</given-names>
            <surname>Lipták</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Rossi</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Sciortino</surname>
          </string-name>
          ,
          <article-title>Computing the original ebwt faster, simpler, and with less memory</article-title>
          ,
          <source>in: SPIRE</source>
          , volume
          <volume>12944</volume>
          of Lecture Notes in Computer Science, Springer,
          <year>2021</year>
          , pp.
          <fpage>129</fpage>
          -
          <lpage>142</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          [9]
          <string-name>
            <given-names>T.</given-names>
            <surname>Kasai</surname>
          </string-name>
          ,
          <string-name>
            <given-names>G.</given-names>
            <surname>Lee</surname>
          </string-name>
          ,
          <string-name>
            <given-names>H.</given-names>
            <surname>Arimura</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>Arikawa</surname>
          </string-name>
          ,
          <string-name>
            <given-names>K.</given-names>
            <surname>Park</surname>
          </string-name>
          ,
          <article-title>Linear-time longest-common-prefix computation in sufix arrays and its applications</article-title>
          , in: CPM, volume
          <volume>2089</volume>
          <source>of Lecture Notes in Computer Science</source>
          , Springer,
          <year>2001</year>
          , pp.
          <fpage>181</fpage>
          -
          <lpage>192</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref10">
        <mixed-citation>
          [10]
          <string-name>
            <given-names>J.</given-names>
            <surname>Kärkkäinen</surname>
          </string-name>
          , G. Manzini,
          <string-name>
            <given-names>S. J.</given-names>
            <surname>Puglisi</surname>
          </string-name>
          ,
          <article-title>Permuted longest-common-prefix array</article-title>
          ,
          <source>in: CPM</source>
          , volume
          <volume>5577</volume>
          of Lecture Notes in Computer Science, Springer,
          <year>2009</year>
          , pp.
          <fpage>181</fpage>
          -
          <lpage>192</lpage>
          .
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>