Faster Binary Mean Computation Under Dynamic Time Warping

Authors Nathan Schaar, Vincent Froese, Rolf Niedermeier

Thumbnail PDF


  • Filesize: 0.74 MB
  • 13 pages

Document Identifiers

Author Details

Nathan Schaar
  • Technische Universität Berlin, Faculty IV, Algorithmics and Computational Complexity, Germany
Vincent Froese
  • Technische Universität Berlin, Faculty IV, Algorithmics and Computational Complexity, Germany
Rolf Niedermeier
  • Technische Universität Berlin, Faculty IV, Algorithmics and Computational Complexity, Germany

Cite AsGet BibTex

Nathan Schaar, Vincent Froese, and Rolf Niedermeier. Faster Binary Mean Computation Under Dynamic Time Warping. In 31st Annual Symposium on Combinatorial Pattern Matching (CPM 2020). Leibniz International Proceedings in Informatics (LIPIcs), Volume 161, pp. 28:1-28:13, Schloss Dagstuhl – Leibniz-Zentrum für Informatik (2020)


Many consensus string problems are based on Hamming distance. We replace Hamming distance by the more flexible (e.g., easily coping with different input string lengths) dynamic time warping distance, best known from applications in time series mining. Doing so, we study the problem of finding a mean string that minimizes the sum of (squared) dynamic time warping distances to a given set of input strings. While this problem is known to be NP-hard (even for strings over a three-element alphabet), we address the binary alphabet case which is known to be polynomial-time solvable. We significantly improve on a previously known algorithm in terms of worst-case running time. Moreover, we also show the practical usefulness of one of our algorithms in experiments with real-world and synthetic data. Finally, we identify special cases solvable in linear time (e.g., finding a mean of only two binary input strings) and report some empirical findings concerning combinatorial properties of optimal means.

Subject Classification

ACM Subject Classification
  • Theory of computation → Dynamic programming
  • Theory of computation → Pattern matching
  • consensus string problems
  • time series averaging
  • minimum 1-separated sum
  • sparse strings


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


  1. A. Abboud, A. Backurs, and V. V. Williams. Tight hardness results for LCS and other sequence similarity measures. In 2015 IEEE 56th Annual Symposium on Foundations of Computer Science (FOCS '15), pages 59-78, 2015. Google Scholar
  2. Markus Brill, Till Fluschnik, Vincent Froese, Brijnesh J. Jain, Rolf Niedermeier, and David Schultz. Exact mean computation in dynamic time warping spaces. Data Mining and Knowledge Discovery, 33(1):252-291, 2019. Google Scholar
  3. Karl Bringmann and Marvin Künnemann. Quadratic conditional lower bounds for string problems and dynamic time warping. In 2015 IEEE 56th Annual Symposium on Foundations of Computer Science (FOCS '15), pages 79-97, 2015. Google Scholar
  4. Kevin Buchin, Anne Driemel, and Martijn Struijs. On the hardness of computing an average curve. CoRR, abs/1902.08053, 2019. Preprint appeared at the 35th European Workshop on Computational Geometry (EuroCG '19). Google Scholar
  5. Laurent Bulteau, Vincent Froese, and Rolf Niedermeier. Tight hardness results for consensus problems on circular strings and time series. CoRR, abs/1804.02854, 2018. Google Scholar
  6. Laurent Bulteau, Falk Hüffner, Christian Komusiewicz, and Rolf Niedermeier. Multivariate algorithmics for NP-hard string problems. Bulletin of the EATCS, 114, 2014. Google Scholar
  7. Zhi-Zhong Chen, Bin Ma, and Lusheng Wang. A three-string approach to the closest string problem. Journal of Computer and System Sciences, 78(1):164-178, 2012. Google Scholar
  8. Zhi-Zhong Chen, Bin Ma, and Lusheng Wang. Randomized fixed-parameter algorithms for the closest string problem. Algorithmica, 74(1):466-484, 2016. Google Scholar
  9. Zhi-Zhong Chen and Lusheng Wang. Fast exact algorithms for the closest string and substring problems with application to the planted (𝓁, d)-motif model. IEEE/ACM Transactions Computational Biology and Bioinformatics, 8(5):1400-1410, 2011. Google Scholar
  10. Diane Cook, Aaron Crandall, Brian Thomas, and Narayanan Krishnan. Casas: A smart home in a box. Computer, 46, 2013. Google Scholar
  11. Moti Frances and Ami Litman. On covering problems of codes. Theory of Computing Systems, 30(2):113-119, 1997. Google Scholar
  12. Omer Gold and Micha Sharir. Dynamic time warping and geometric edit distance: Breaking the quadratic barrier. ACM Transactions on Algorithms, 14(4):50:1-50:17, 2018. Google Scholar
  13. Jens Gramm, Rolf Niedermeier, and Peter Rossmanith. Fixed-parameter algorithms for closest string and related problems. Algorithmica, 37(1):25-42, 2003. Google Scholar
  14. William Kuszmaul. Dynamic time warping in strongly subquadratic time: Algorithms for the low-distance regime and approximate evaluation. In Proceedings of the 46th International Colloquium on Automata, Languages, and Programming (ICALP '19), pages 80:1-80:15, 2019. Google Scholar
  15. Ming Li, Bin Ma, and Lusheng Wang. On the closest string and substring problems. Journal of the ACM, 49(2):157-171, 2002. Google Scholar
  16. A. Mueen, N. Chavoshi, N. Abu-El-Rub, H. Hamooni, and A. Minnich. AWarp: Fast warping distance for sparse time series. In 2016 IEEE 16th International Conference on Data Mining (ICDM '16), pages 350-359, 2016. Google Scholar
  17. Naomi Nishimura and Narges Simjour. Enumerating neighbour and closest strings. In 7th International Symposium on Parameterized and Exact Computation, (IPEC '12), pages 252-263. Springer, 2012. Google Scholar
  18. H. Sakoe and S. Chiba. Dynamic programming algorithm optimization for spoken word recognition. IEEE Transactions on Acoustics, Speech, and Signal Processing, 26(1):43-49, 1978. Google Scholar
  19. Anooshiravan Sharabiani, Houshang Darabi, Samuel Harford, Elnaz Douzali, Fazle Karim, Hereford Johnson, and Shun Chen. Asymptotic dynamic time warping calculation with utilizing value repetition. Knowledge and Information Systems, 57(2):359-388, 2018. Google Scholar
  20. Shota Yuasa, Zhi-Zhong Chen, Bin Ma, and Lusheng Wang. Designing and implementing algorithms for the closest string problem. Theoretical Computer Science, 786:32-43, 2019. Google Scholar
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