Spheres of Strings Under the Levenshtein Distance - Algarni, Said; Echi, Othman (Axioms, 2025)
Let Σ be a nonempty set of characters, called an alphabet. The run-length encoding (RLE) algorithm processes any nonempty string u over Σ and produces two outputs: a k-tuple (b1,b2,…,bk), where each bi is a character and bi+1≠bi; and a corresponding k-tuple (q1,q2,…,qk) of positive integers, so that the original string can be reconstructed as u=b1q1b2q2…bkqk. The integer k is termed the run-length of u, and symbolized by ρ(u). By convention, we let ρ(ε)=0. In the Euclidean space (Rn,∥·∥2), the volume of a sphere is determined solely by the dimension n and the radius, following well-established formulas. However, for spheres of strings under the edit metric, the situation is more complex, and no general formulas have been identified. This work intended to show that the volume of the sphere SL(u,1), composed of all strings of Levenshtein distance 1 from u, is dependent on the specific structure of the “RLE-decomposition” of u. Notably, this volume equals (2l(u)+1)s−2l(u)−ρ(u), where ρ(u) represents the run-length of u and l(u) denotes its length (i.e., the number of characters in u). Given an integer p≥2, we present a partial result concerning the computation of the volume |SL(u,p)| in the specific case where the run-length ρ(u)=1. More precisely, for a fixed integer n≥1 and a character a∈Σ, we explicitly compute the volume of the Levenshtein sphere of radius p, centered at the string u=an. This case corresponds to the simplest run structure and serves as a foundational step toward understanding the general behavior of Levenshtein spheres.