arXiv:2608.24347cs.DSAug 2026

Manuscript Offprint

arXiv:2608.24347

Streaming algorithms for computing coresets and kk-median clustering in the Hamming space

Taha El Ghazi, Jonas Ellert, Chien-Chung Huang, Tatiana Starikovskaya

Taha El Ghazi 1^{1}, Jonas Ellert 2^{2}, Chien-Chung Huang 1^{1}, and Tatiana Starikovskaya 1^{1}

CNRS & DIENS, École normale supérieure de Paris, PSL Research University, Paris, France

{taha.elghazi,chien-chung.huang,tatiana.starikovskaya}@ens.fr

Department of Mathematics and Computer Science (IMADA), University of Southern Denmark, Odense, Denmark

ellert@imada.sdu.dk

Abstract. Clustering is one of the most fundamental tools in data analysis, allowing large datasets to be summarized by a small number of representative points. Given a metric space (X,d)(\mathcal{X}, \mathbb{d}) and a set SS of nn points in this space, the continuous kk-median clustering problem asks to find a set CC of kk points that minimizes the objective function ∑s∈Sd(s,C)\sum_{s \in S} \mathbb{d}(s, C). When X=Σℓ\mathcal{X} = \Sigma^\ell is the set of strings of length ℓ\ell and d\mathbb{d} is the Hamming distance, the continuous kk-median clustering problem is known to be W[1]-hard when parameterized by kk. In this work, we present the first (1+ε)(1+\varepsilon)-approximation algorithm for this problem with FPT runtime 2poly(ε−1,k)⋅nℓ2^{\text{poly}(\varepsilon^{-1}, k)} \cdot n \ell polylog nn. An additional feature of the algorithm is that it can be implemented in streaming, requiring only O~ε(ℓk+k2)\tilde{\mathcal{O}}_{\varepsilon}(\ell k + k^2) space. As an auxiliary tool of independent interest, we show the first streaming algorithm for computing an ε\varepsilon-coreset for continuous kk-median clustering under the Hamming distance.

Keywords: Streaming Algorithms · Coresets · k-Median Clustering · Hamming Distance · Parameterized Approximation Algorithms

1 Introduction

Clustering is one of the most fundamental tools in data analysis, allowing large datasets to be summarized by a small number of representative points. As an optimization problem, it has been extensively studied in Euclidean and general metric spaces from the viewpoints of approximation algorithms, parameterized complexity, and streaming, where the points arrive one-by-one and one must account for all the space used. Given a metric space (X,d)(\mathcal{X}, \mathbb{d}) and a set XX of nn points in this space, the continuous (k,z)(k, z)-clustering problem asks to find a set CC of kk points ("centers") that minimizes the objective function ∑x∈X(d(x,C))z\sum_{x \in X} (\mathbb{d}(x, C))^z. When z=1z = 1, the (k,z)(k, z)-clustering problem is called the continuous kk-median clustering problem, and when z=2z = 2, it is called the continuous kk-means clustering problem. Below, we omit "continuous" for brevity.

T. El Ghazi et al.

For LpL_{p} and general metric spaces, the complexity of this problem is rather well understood (see, e.g., [15,16] and references therein). In contrast, for classical string metrics such as Hamming, edit, and Ulam distances, the algorithmic landscape remains far less developed. String distances, and in particular the edit distance, are often used as similarity measures in bioinformatics, where clustering biological sequences is an increasingly important task. For instance, clustering is employed to reduce redundancy, bin sequencing reads, and group protein sequences into homologous families (see, e.g., [13,32,40]).

Recall that the edit distance between two strings is the smallest number of character insertions, deletions, and replacements that are required to transform one string into the other. For k=1k = 1, clustering under edit distance is also known as the median string problem [29], and even this special variant of the problem is known to be NP-complete [24], and remains so even on finite alphabets [38]. This hardness result does not exclude efficient approximation algorithms, but, to the best of our knowledge, none are known.

This motivated Chakraborty, Das, and Krauthgamer [11] to study the Ulam distance, a special variant of the edit distance. The Ulam distance is defined on permutations over {1,…,ℓ}\{1,\ldots,\ell\} as the smallest number of character-move operations required to transform one string into another. While solving the 1-median clustering problem under the Ulam distance exactly is NP-hard [20], [11] showed a (2−δ)(2-\delta)-approximation algorithm for 1-median clustering under the Ulam distance, for small constant δ\delta. Later, Chakraborty, Das and Krauthgamer [12] gave a randomized 1.9999995-approximation algorithm in streaming for the kk-median clustering problem, using k2ℓk^2\ell polylog(nℓn\ell) space and (klog⁡(nℓ))O(k)ℓ3(k\log(n\ell))^{O(k)}\ell^3 update time (which is not FPT in kk). Jaiswal, Kumar, and Yadav [26] then gave the first offline (2−δ)(2-\delta)-approximation algorithm for the kk-median clustering problem under the Ulam distance, in FPT time O((2k)knℓ)\mathcal{O}((2k)^k n\ell).

Another common stepping stone for the edit distance is the Hamming distance (see, e.g., [7] who reduced the problem of streaming pattern matching under the edit distance to that under Hamming distance, or [14], where a framework for pattern matching under Hamming distance was extended to that under the edit distance). The Hamming distance between two equal-length strings is defined as the number of mismatches between them. The k-median problem under Hamming distance is already computationally hard. Under the Unique Games Conjecture, it is NP-hard to approximate within a factor better than 1.21 [17]. Moreover, W[1]-hardness with respect to k [21] suggests that an exact FPT algorithm is unlikely. In the offline setting, the best known result for the Hamming distance is by Ostrovsky and Rabani [39], who gave a (1+ε)(1+\varepsilon)-approximation algorithm in ℓk2nO(ε−1k2)\ell^{k^2}n^{\mathcal{O}(\varepsilon^{-1}k^2)} time, but no (1+ε)(1+\varepsilon)-approximation algorithm with running time f(k,ε)⋅(nℓ)O(1)f(k,\varepsilon)\cdot(n\ell)^{\mathcal{O}(1)} was previously known. Such approximation algorithms are referred to as efficient parameterized approximation schemes (EPAS) [1,35].

Related Work. In the related (yet quite different in nature) consensus string problem, the goal is to find a string A that minimizes the objective function max⁡B∈Xd(B,A)\max_{B \in X} \mathbb{d}(B, A). This NP-hard problem has been studied for both the Hamming and the edit distance, and in particular in the parameterized setting. We refer the reader to a survey [9], see also [3–6, 10, 22, 23, 31]. However, the techniques developed for this problem do not seem to extend to (k,z)(k, z)-clustering directly.

References (39)