The 2-Attractor Problem Is NP-Complete

Authors Janosch Fuchs , Philip Whittington

Thumbnail PDF


  • Filesize: 0.73 MB
  • 13 pages

Document Identifiers

Author Details

Janosch Fuchs
  • RWTH Aachen University, Germany
Philip Whittington
  • ETH Zürich, Switzerland

Cite AsGet BibTex

Janosch Fuchs and Philip Whittington. The 2-Attractor Problem Is NP-Complete. In 41st International Symposium on Theoretical Aspects of Computer Science (STACS 2024). Leibniz International Proceedings in Informatics (LIPIcs), Volume 289, pp. 35:1-35:13, Schloss Dagstuhl – Leibniz-Zentrum für Informatik (2024)


A k-attractor is a combinatorial object unifying dictionary-based compression. It allows to compare the repetitiveness measures of different dictionary compressors such as Lempel-Ziv 77, the Burrows-Wheeler transform, straight line programs and macro schemes. For a string T ∈ Σⁿ, the k-attractor is defined as a set of positions Γ ⊆ [1,n], such that every distinct substring of length at most k is covered by at least one of the selected positions. Thus, if a substring occurs multiple times in T, one position suffices to cover it. A 1-attractor is easily computed in linear time, while Kempa and Prezza [STOC 2018] have shown that for k ≥ 3, it is NP-complete to compute the smallest k-attractor by a reduction from k-set cover. The main result of this paper answers the open question for the complexity of the 2-attractor problem, showing that the problem remains NP-complete. Kempa and Prezza’s proof for k ≥ 3 also reduces the 2-attractor problem to the 2-set cover problem, which is equivalent to edge cover, but that does not fully capture the complexity of the 2-attractor problem. For this reason, we extend edge cover by a color function on the edges, yielding the colorful edge cover problem. Any edge cover must then satisfy the additional constraint that each color is represented. This extension raises the complexity such that colorful edge cover becomes NP-complete while also more precisely modeling the 2-attractor problem. We obtain a reduction showing k-attractor to be NP-complete and APX-hard for any k ≥ 2.

Subject Classification

ACM Subject Classification
  • Theory of computation → Problems, reductions and completeness
  • Theory of computation → Approximation algorithms analysis
  • Theory of computation → Data compression
  • String attractors
  • dictionary compression
  • computational complexity


  • Access Statistics
  • Total Accesses (updated on a weekly basis)
    PDF Downloads


  1. Tooru Akagi, Mitsuru Funakoshi, and Shunsuke Inenaga. Sensitivity of string compressors and repetitiveness measures. Inf. Comput., 291:104999, 2021. URL:
  2. Saieed Akbari, Vahid Liaghat, and Afshin Nikzad. Colorful paths in vertex coloring of graphs. Electr. J. Comb., 18, January 2011. URL:
  3. Hideo Bannai, Keisuke Goto, Masakazu Ishihata, Shunsuke Kanda, Dominik Köppl, and Takaaki Nishimoto. Computing np-hard repetitiveness measures via MAX-SAT. In Shiri Chechik, Gonzalo Navarro, Eva Rotenberg, and Grzegorz Herman, editors, 30th Annual European Symposium on Algorithms, ESA 2022, September 5-9, 2022, Berlin/Potsdam, Germany, volume 244 of LIPIcs, pages 12:1-12:16. Schloss Dagstuhl - Leibniz-Zentrum für Informatik, 2022. URL:
  4. Matthias Bentert, Leon Kellerhals, and Rolf Niedermeier. Fair short paths in vertex-colored graphs. Proceedings of the AAAI Conference on Artificial Intelligence, 37:12346-12354, June 2023. URL:
  5. Sergey Bereg, Feifei Ma, Wencheng Wang, Jian Zhang, and Binhai Zhu. On some matching problems under the color-spanning model. Theoretical Computer Science, 786:26-31, 2019. Frontiers of Algorithmics. URL:
  6. Piotr Berman, Marek Karpinski, and Alex D. Scott. Approximation hardness of short symmetric instances of max-3sat. Electron. Colloquium Comput. Complex., TR03, 2003. URL:
  7. Christina Büsing and Martin Comis. Budgeted colored matching problems. Electronic Notes in Discrete Mathematics, 64:245-254, 2018. 8th International Network Optimization Conference - INOC 2017. URL:
  8. Anders Roy Christiansen, Mikko Berggren Ettienne, Tomasz Kociumaka, Gonzalo Navarro, and Nicola Prezza. Optimal-time dictionary-compressed indexes. ACM Trans. Algorithms, 17(1), December 2021. URL:
  9. J. Cohen, Y. Manoussakis, H.P. Phong, and Zs. Tuza. Tropical matchings in vertex-colored graphs. Electronic Notes in Discrete Mathematics, 62:219-224, 2017. LAGOS'17 – IX Latin and American Algorithms, Graphs and Optimization. URL:
  10. Riccardo Dondi and Mohammad Mehdi Hosseinzadeh. Finding colorful paths in temporal graphs. In Rosa Maria Benito, Chantal Cherifi, Hocine Cherifi, Esteban Moro, Luis M. Rocha, and Marta Sales-Pardo, editors, Complex Networks & Their Applications X, pages 553-565, Cham, 2022. Springer International Publishing. Google Scholar
  11. Lubomíra Dvořáková. String attractors of episturmian sequences. CoRR, abs/2211.01660v2, 2022. URL:
  12. France Gheeraert, Giuseppe Romana, and Manon Stipulanti. String attractors of fixed points of k-bonacci-like morphisms. CoRR, abs/2302.13647, 2023. URL:
  13. Johan Håstad. Some optimal inapproximability results. Electron. Colloquium Comput. Complex., TR97, 2001. URL:
  14. Dominik Kempa and Tomasz Kociumaka. Resolution of the burrows-wheeler transform conjecture. Commun. ACM, 65(6):91-98, 2022. URL:
  15. Dominik Kempa, Alberto Policriti, Nicola Prezza, and Eva Rotenberg. String attractors: Verification and optimization. In Yossi Azar, Hannah Bast, and Grzegorz Herman, editors, 26th Annual European Symposium on Algorithms, ESA 2018, August 20-22, 2018, Helsinki, Finland, volume 112 of LIPIcs, pages 52:1-52:13. Schloss Dagstuhl - Leibniz-Zentrum für Informatik, 2018. URL:
  16. Dominik Kempa and Nicola Prezza. At the roots of dictionary compression: string attractors. In Ilias Diakonikolas, David Kempe, and Monika Henzinger, editors, Proceedings of the 50th Annual ACM SIGACT Symposium on Theory of Computing, STOC 2018, Los Angeles, CA, USA, June 25-29, 2018, pages 827-840. ACM, 2018. URL:
  17. Dominik Kempa and Barna Saha. An upper bound and linear-space queries on the lz-end parsing. In Joseph (Seffi) Naor and Niv Buchbinder, editors, Proceedings of the 2022 ACM-SIAM Symposium on Discrete Algorithms, SODA 2022, Virtual Conference / Alexandria, VA, USA, January 9 - 12, 2022, pages 2847-2866. SIAM, 2022. URL:
  18. Tomasz Kociumaka, Gonzalo Navarro, and Nicola Prezza. Towards a definitive measure of repetitiveness. In Yoshiharu Kohayakawa and Flávio Keidi Miyazawa, editors, LATIN 2020: Theoretical Informatics - 14th Latin American Symposium, São Paulo, Brazil, January 5-8, 2021, Proceedings, volume 12118 of Lecture Notes in Computer Science, pages 207-219. Springer, 2020. URL:
  19. Sebastian Kreft and Gonzalo Navarro. Lz77-like compression with fast random access. In 2010 Data Compression Conference, pages 239-248, 2010. URL:
  20. Sabrina Mantaci, Antonio Restivo, Giuseppe Romana, Giovanna Rosone, and Marinella Sciortino. A combinatorial view on string attractors. Theor. Comput. Sci., 850:236-248, 2021. URL:
  21. Jérôme Monnot. The labeled perfect matching in bipartite graphs. Inf. Process. Lett., 96(3):81-88, 2005. URL:
  22. Gonzalo Navarro and Nicola Prezza. Universal compressed text indexing. Theoretical Computer Science, 762:41-50, 2019. URL:
  23. Nicola Prezza. String attractors. CoRR, abs/1709.05314, 2017. URL:
  24. Antonio Restivo, Giuseppe Romana, and Marinella Sciortino. String attractors and infinite words. CoRR, abs/2206.00376, 2022. URL:
  25. Jeffrey O. Shallit and Luke Schaeffer. String attractors for automatic sequences. CoRR, abs/2012.06840, 2020. URL:
Questions / Remarks / Feedback

Feedback for Dagstuhl Publishing

Thanks for your feedback!

Feedback submitted

Could not send message

Please try again later or send an E-mail