This paper was converted on www.awesomepapers.org from LaTeX by an anonymous user.
Want to know more? Visit the Converter page.

Optimal Ternary Codes with Weight ww and Distance 2w22w-2 in 1\ell_{1}-Metric

Xin Wei, Tingting Chen, and Xiande Zhang X. Wei ([email protected]) and T. Chen ([email protected]) are with School of Mathematical Sciences and School of Cyber Security, University of Science and Technology of China, Hefei, 230026, Anhui, China.X. Zhang ([email protected]) is with School of Mathematical Sciences, University of Science and Technology of China, Hefei, 230026, Anhui, China. The research of X. Zhang is supported by NSFC under grant 11771419, and by “the Fundamental Research Funds for the Central Universities”.
Abstract

The study of constant-weight codes in 1\ell_{1}-metric was motivated by the duplication-correcting problem for data storage in live DNA. It is interesting to determine the maximum size of a code given the length nn, weight ww, minimum distance dd and the alphabet size qq. In this paper, based on graph decompositions, we determine the maximum size of ternary codes with constant weight ww and distance 2w22w-2 for all sufficiently large length nn. Previously, this was known only for a very sparse family nn of density 4/w(w1)4/w(w-1).

Index Terms:
DNA storage, constant-weight code, 𝟏\ell_{1}-metric, packing.

I Introduction

Codes in 1\ell_{1}-metric distance have attracted a lot attention in the last decade for their useful applications in rank-modulation scheme for flash memory [1, 2, 3, 4, 5, 6]. In the recent error correcting problem of data storage in live DNA, 1\ell_{1}-metric was also revealed to play an important role in attacking the tandem duplication errors [7]. To store information in live DNA, the reliability of data is crucial. A tandem duplication error, which means an error happens by inserting a copy of a segment of the DNA adjacent to its original position during replication, is one of the errors we must fight against during DNA coding. According to [8], tandem duplications constitute about 3% of our human genome and may cause serious phenomena and severe information loss. As a consequence, duplication correcting codes have been studied by many recent works, for example [7, 9, 10, 11, 12]. Specially, the work in [7] connects duplication correcting codes with constant-weight codes (CWCs) in 1\ell_{1}-metric over integers, and shows that the existence of optimal CWCs with certain weights and lengths will result in optimal tandem duplication correcting codes [7, Theorem 20].

Motivated by this connection, it is interesting to study CWCs in 1\ell_{1}-metric. The central problem regarding CWCs is to determine the exact value of maximum cardinality of a code with given length, weight, minimum distance, and the alphabet size. CWCs with Hamming distance have been well studied [13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24] due to its wide applications in coding for bandwidth-efficient channels [25], the design of oligonucleotide sequences for DNA computing [26, 27], and so on. If the code is binary, the Hamming distance is indeed the 1\ell_{1}-metric. However, when it is qq-ary with q3q\geq 3, the metrics are different. The study of non-binary CWCs with 1\ell_{1}-metric is very rare. Based on our knowledge, only works in [28, 29, 30] are involved.

In this paper, we consider ternary CWCs with 1\ell_{1}-metric. A ternary code of constant 1\ell_{1}-weight ww, minimum 1\ell_{1}-distance dd and length nn is denoted by an (n,d,w)3(n,d,w)_{3} code. The maximum size among all (n,d,w)3(n,d,w)_{3} codes is denoted by A3(n,d,w)A_{3}(n,d,w), and a code achieving this size is called optimal. Optimal (n,d,w)3(n,d,w)_{3} codes were constructed in [30] when w=3,4w=3,4 for all possible distances dd and length nn with only finite many cases undetermined. For general weight ww and distance 2w22w-2, the authors in [30] provided an upper bound A3(n,2w2,w)n(n1(w1)(w2))w(w1)+nA_{3}(n,2w-2,w)\leq\left\lfloor\frac{n(n-1-(w-1)(w-2))}{w(w-1)}\right\rfloor+n, and showed that this bound can be achieved for nn is large enough and nw,2w+3,1n\equiv w,-2w+3,1 or w+2mod(w1)w-w+2\mod(w-1)w. This is only a fraction of the numbers nn when ww is big.

Our main contribution in this paper is showing that, given the weight ww, the upper bound of A3(n,2ww,w)A_{3}(n,2w-w,w) provided in [30] can be achieved for all sufficiently large nn, which greatly improves the result in [30]. We state our main result as follows.

Main Result: For any integer w5w\geq 5, A3(n,2w2,w)=n(n1(w1)(w2))w(w1)+nA_{3}(n,2w-2,w)=\left\lfloor\frac{n(n-1-(w-1)(w-2))}{w(w-1)}\right\rfloor+n for all sufficiently large nn.

Further, we show that there exists an optimal (n,2w2,w)3(n,2w-2,w)_{3} code that is balanced unless when ww is odd and n1mod(w1)n\equiv 1\mod(w-1) with certain restrictions. Here, a code is balanced means that the collection of supports of all codewords, viewed as cliques, forms a decomposition of the complete graph KnK_{n}. Our methods rely on a famous result of Alon et al. [31] on graph decompositions, which reduces the whole problem to looking for a sparse code with desired properties.

This paper is organized as follows. In Section II, we first introduce some necessary definitions and notations, then connect codes with graph packings to reduce the problem of finding an optimal code 𝒞\mathcal{C} to finding a proper sub-code 𝒮𝒞\mathcal{S}\subset\mathcal{C}. Section III gives the general idea of how to find the sub-code 𝒮\mathcal{S}, and illustrates the idea by taking n0,1mod(w1)n\equiv 0,1\mod(w-1) with certain restrictions. A complete solution to the cases of n0,1mod(w1)n\equiv 0,1\mod(w-1) is given in Section IV, where a nonexistence result of an optimal balanced code with n1mod(w1)n\equiv 1\mod(w-1) under additional conditions is deduced. In Section V, we deal with all other cases, ntmod(w1)n\equiv t\mod(w-1) with 2tw22\leq t\leq w-2 by an algorithmic construction of the required sub-code 𝒮\mathcal{S}. Finally we conclude our results in Section VI.

II Preliminaries

For integers mm,m\leq m^{\prime}, we denote [m,m]{m,m+1,,m}[m,m^{\prime}]\triangleq\{m,m+1,\dots,m^{\prime}\} and [m][1,m][m]\triangleq[1,m] for short. Let q2q\geq 2 be an integer. A qq-ary code 𝒞\mathcal{C} of length nn is a set of vectors in IqnI_{q}^{n}, in which Iq:={0,1,,q1}I_{q}:=\{0,1,\ldots,q-1\}. An element in 𝒞\mathcal{C} is called a codeword. For two codewords 𝒖=(ui)1in\bm{u}=(u_{i})_{1\leq i\leq n} and 𝒗=(vi)1in\bm{v}=(v_{i})_{1\leq i\leq n}, the 1\ell_{1}-distance between 𝒖\bm{u} and 𝒗\bm{v} is d(𝒖,𝒗)=i=1n|uivi|d(\bm{u},\bm{v})=\sum_{i=1}^{n}|u_{i}-v_{i}|. Here the sum and subtraction are on {\mathbb{Z}}. The 1\ell_{1}-weight of 𝒗\bm{v} is the 1\ell_{1}-distance between 𝒗\bm{v} and vector 𝟎\bm{0}. If a code 𝒞\mathcal{C} satisfies that the 1\ell_{1}-weight of any codeword is ww for some integer ww, then we call 𝒞\mathcal{C} a constant-weight code. If further the minimum 1\ell_{1}-distance between any two distinct codewords in 𝒞\mathcal{C} is at least dd, we say that 𝒞\mathcal{C} is an (n,d,w)q(n,d,w)_{q} code.

In this paper, we focus on ternary codes, that is q=3.q=3. The maximum size among all (n,d,w)3(n,d,w)_{3} codes is denoted by A3(n,d,w).A_{3}(n,d,w). We call an (n,d,w)3(n,d,w)_{3} code 𝒞\mathcal{C} optimal if the size of 𝒞\mathcal{C} reaches A3(n,d,w).A_{3}(n,d,w). The following lemma from [30] gives us an upper bound for A3(n,2w2,w).A_{3}(n,2w-2,w).

Lemma II.1.

[30] A3(n,2w2,w)n(n1(w1)(w2))w(w1)+n.A_{3}(n,2w-2,w)\leq\left\lfloor\frac{n(n-1-(w-1)(w-2))}{w(w-1)}\right\rfloor+n.

When weight ww is fixed, let B(n)n(n1(w1)(w2))w(w1)B(n)\triangleq\left\lfloor\frac{n(n-1-(w-1)(w-2))}{w(w-1)}\right\rfloor for convenience. Our main work is to show that the upper bound B(n)+nB(n)+n can be achieved when nn is sufficiently large for any fixed ww.

For any codeword 𝒖𝒞\bm{u}\in\mathcal{C}, the support of 𝒖\bm{u} is defined as supp(𝒖)={x[n],ux0}.supp(\bm{u})=\{x\in[n],u_{x}\neq 0\}. There is a canonical one-to-one correspondence between a vector 𝒖\bm{u} in I3nI_{3}^{n} to a subset of [n]×[2][n]\times[2]. We can express the vector 𝒖=(u1,u2,,un)\bm{u}=(u_{1},u_{2},\ldots,u_{n}) as a subset {(x,ux)[n]×[2]xsupp(𝒖)}\{(x,{u_{x}})\in[n]\times[2]\mid{x\in supp(\bm{u})}\}, which we call the labeled support of 𝒖\bm{u}. Specially for any j[n]j\in[n], if uj=iI3u_{j}=i\in I_{3}, we say the position jj is labeled by the symbol ii in the codeword 𝒖\bm{u}. For short, we usually write a member (a,b)[n]×[2](a,b)\in[n]\times[2] in the form aba_{b}.

Example II.1.

When n=5n=5, codewords 12000,12000, 10200,10200, 1120011200 and 2020020200 can be described as {11,22},\{1_{1},2_{2}\}, {11,32},\{1_{1},3_{2}\}, {11,21,32}\{1_{1},2_{1},3_{2}\} and {12,32}\{1_{2},3_{2}\}, respectively. Furthermore in 1120011200, the position 3 is labeled by 22.

For ternary codes of constant weight ww, the type of a codeword is denoted by 1a2b1^{a}2^{b} for some nonnegative integers aa and bb satisfying a+2b=wa+2b=w. Here, a codeword is of type 1a2b1^{a}2^{b} if there are in total aa different positions labeled by 11 and bb different positions labeled by 22 in it. We usually write 1w1^{w} instead of 1w201^{w}2^{0} for convenience. By a simple observation, there exists a necessary and sufficient condition of an (n,2w2,w)3(n,2w-2,w)_{3} code.

Fact II.1.

A ternary CWC code 𝒞\mathcal{C} with weight ww is an (n,2w2,w)3(n,2w-2,w)_{3} code if and only if the following conditions are satisfied:

  • (a)

    For any two different codewords 𝒖\bm{u} and 𝒗\bm{v} in 𝒞\mathcal{C}, |supp(𝒖)supp(𝒗)|1|supp(\bm{u})\cap supp(\bm{v})|\leq 1.

  • (b)

    If there exists a codeword 𝒖𝒞\bm{u}\in\mathcal{C} and a position i[n]i\in[n] such that ui=2u_{i}=2, then for any other codeword 𝒗𝒞\bm{v}\in\mathcal{C}, vi2v_{i}\neq 2.

On the one hand, conditions (a) and (b) can lead to an (n,2w2,w)3(n,2w-2,w)_{3} code trivially. On the other hand, if any one of them are violated, there must be two different codewords in 𝒞\mathcal{C} such that the 1\ell_{1}-distance between them is less than 2w2.2w-2. We will use the language in graph packings to rewrite this fact in the next subsection.

II-A From Codes to Graph Packings

A graph GG is a pair (V,E)(V,E), where VV is a finite set of vertices and EE is a set of 22-subsets of VV, called edges. The order of GG is the number of vertices, denoted by |G||G|. Correspondingly, e(G)e(G) means the numbers of edges. The degree of a vertex vv in GG is the number of edges containing vv, and it is denoted by dG(v).d_{G}(v). A graph is called complete if each pair of vertices is contained in an edge. We write the complete graph with order nn as KnK_{n}.

We have given a one-to-one correspondence between a ternary vector and its labeled support. Here we give another one-to-one correspondence between a ternary vector and a colored complete subgraph. Given a vector 𝒖I3n\bm{u}\in I_{3}^{n}, we map it to a complete subgraph (clique) K𝒖K_{\bm{u}} of KnK_{n} with vertex set supp(𝒖)supp(\bm{u}) equipped with a 22-coloring, such that the vertex isupp(𝒖)i\in supp(\bm{u}) is colored by 𝒖i\bm{u}_{i}. By these correspondences, a vector in I3nI_{3}^{n}, a labeled support in [n]×[2][n]\times[2], and a 22-colored clique are indeed the same objects, so they share the same notations like weight and type.

Next we will restate Fact II.1 in the graph packing language. The packing of a graph GG is a set of its subgraphs ={G1,G2,,Gs}\mathcal{M}=\{G_{1},G_{2},\ldots,G_{s}\} such that any edge of GG appears in at most one subgraph in \mathcal{M}. If the packing \mathcal{M} covers all edges in GG, we call it a decomposition of GG. If all Gi,i[s]G_{i},i\in[s] are isomorphic to some graph HH, then we call \mathcal{M} an HH-packing. Further if an HH-packing \mathcal{M} is also a decomposition, we call it an HH-decomposition. We have the following corollary from Fact II.1.

Corollary II.1.

A ternary CWC code 𝒞\mathcal{C} with weight ww is an (n,2w2,w)3(n,2w-2,w)_{3} code if and only if the following conditions are satisfied:

  • (a)(a^{\prime})

    The set {K𝒖:𝒖𝒞}\{K_{\bm{u}}:\bm{u}\in\mathcal{C}\} forms a packing of KnK_{n}.

  • (b)(b^{\prime})

    Each vertex i[n]i\in[n] is colored by 22 in 𝒞\mathcal{C} at most once, i.e. there exists at most one codeword 𝒖𝒞\bm{u}\in\mathcal{C} such that ii is colored by 2 in K𝒖K_{\bm{u}}.

The proof of Corollary II.1 is straightforward from Fact II.1. By Corollary II.1, the problem of finding an optimal (n,2w2,w)3(n,2w-2,w)_{3} code turns to the one of finding a maximum-sized packing of KnK_{n} by colored cliques with the same weight ww satisfying condition (b)(b^{\prime}). Here we point out that the number of codewords of type 1a2b1^{a}2^{b} with b>0b>0 in an (n,2w2,w)3(n,2w-2,w)_{3} code is no more than nn due to condition (b)(b^{\prime}). This means the set of codewords of type 1w1^{w} is an absolute majority when the upper bound B(n)+nB(n)+n is attained for large nn.

Our desired CWC is constructed by a packing of KnK_{n} with two parts 𝒫𝒮\mathcal{P}\cup\mathcal{S}, where 𝒫\mathcal{P} consists of all cliques of order ww in the packing, and 𝒮\mathcal{S} consists of all others. So 𝒫\mathcal{P} corresponds to all codewords of type 1w1^{w} and 𝒮\mathcal{S} corresponds to at most nn codewords of type 1a2b1^{a}2^{b} with some b>0b>0. The theorem below given in [31] guarantees the existence of 𝒫\mathcal{P} as long as we have a suitable 𝒮\mathcal{S}, which has been used in [30] for a construction of optimal CWCs of distance 2w22w-2 for several congruence classes. We need some notations to state this theorem.

For a graph HH without isolated vertices, let gcd(H)\gcd(H) denote the greatest common divisor of the degrees of all vertices of HH. A graph GG is called dd-divisible if gcd(G)\gcd(G) is divisible by dd, while GG is called nowhere dd-divisible if no vertex of GG has degree divisible by dd. The HH-packing number of GG, denoted by P(H,G)P(H,G) is the maximum cardinality of an HH-packing of GG.

Theorem II.1.

[31] Let HH be a graph with hh edges, and let gcd(H)=e\gcd(H)=e. Then there exist N=N(H)N=N(H), and ε=ε(H)\varepsilon=\varepsilon(H) such that for any ee-divisible or nowhere ee-divisible graph G=(V,E)G=(V,E) with n>N(H)n>N(H) vertices and δ(G)>(1ε(H))n\delta(G)>(1-\varepsilon(H))n,

P(H,G)=vVαv2h,P(H,G)=\left\lfloor\frac{\sum_{v\in V}\alpha_{v}}{2h}\right\rfloor,

unless when GG is ee-divisible and 0<|E|(modh)e220<|E|\pmod{h}\leq\frac{e^{2}}{2}, in which case

P(H,G)=vVαv2h1.P(H,G)=\left\lfloor\frac{\sum_{v\in V}\alpha_{v}}{2h}\right\rfloor-1.

Here, αv\alpha_{v} is the degree of vertex vv, rounded down to the closest multiple of ee.

Remark II.1.

If we choose H=KwH=K_{w}, then gcd(H)=w1gcd(H)=w-1. For any given positive integer nn, if we can find a subgraph GnG_{n} of Kn,K_{n}, such that e(H)|e(Gn)e(H)|e(G_{n}) and for any vertex vKnv\in K_{n},

{dGn(v)n12w2;(w1)|dGn(v),\left\{\begin{array}[]{lr}{d_{G_{n}}(v)\geq n-1-2w^{2};}&\\ {(w-1)|d_{G_{n}}(v),}&\end{array}\right.

then there exists an integer N=N(H)N^{\prime}=N^{\prime}(H) such that if n>Nn>N^{\prime}, an KwK_{w}-decomposition of GnG_{n} is guaranteed.

In fact, by the condition dGn(v)n12w2d_{G_{n}}(v)\geq n-1-2w^{2}, we have δ(Gn)n12w2>(1ε)n\delta(G_{n})\geq n-1-2w^{2}>(1-\varepsilon)n for any n>1+2w2εn>\frac{1+2w^{2}}{\varepsilon}. This remark can be immediately derived from Theorem II.1.

By Corollary II.1 and Remark II.1, to construct an (n,2w2,w)3(n,2w-2,w)_{3} code of size B(n)+nB(n)+n, it is sufficient to find a subgraph SS of KnK_{n} such that the following conditions are satisfied:

  • (1)

    Gn=KnSG_{n}=K_{n}-S satisfies the conditions in Remark II.1, so that GnG_{n} has a KwK_{w}-decomposition 𝒫\mathcal{P}. The cliques in 𝒫\mathcal{P} will produce all codewords of type 1w1^{w}.

  • (2)

    SS has a packing 𝒮\mathcal{S} of size B(n)+n|𝒫|B(n)+n-|\mathcal{P}| containing cliques of order less than ww, such that each clique could be colored by {1,2}\{1,2\} independently to become a colored clique of weight ww, and each vertex i[n]i\in[n] is colored by 22 at most once among all cliques in 𝒮\mathcal{S}. The cliques in 𝒮\mathcal{S} will yield all codewords of type 1a2b1^{a}2^{b} for some b>0b>0.

If 𝒮\mathcal{S} is also a decomposition of SS, we say that the desired code is a balanced code, that is, the set 𝒫𝒮\mathcal{P}\cup\mathcal{S} of cliques corresponding to all codewords forms a decomposition of KnK_{n}. How to construct such a graph SS with a packing 𝒮\mathcal{S} by colored cliques, or equivalently the sub-code 𝒮𝒞\mathcal{S}\subset\mathcal{C} consisting of only codewords of type 1a2b1^{a}2^{b} for some b>0b>0, needs some techniques. The most important tool used throughout this paper is the modular Golomb ruler.

II-B Modular Golomb rulers

An (n,w)(n,w) modular Golomb ruler [32] is a set of ww integers {a1,a2,,aw}n\{a_{1},a_{2},\ldots,a_{w}\}\subset{\mathbb{Z}}_{n}, such that all of the differences, {aiaj1ijw}\{a_{i}-a_{j}\mid 1\leq i\neq j\leq w\}, are distinct and nonzero. Notice that all calculations here are in n{\mathbb{Z}}_{n}. The set {aiaj1ijw}\{a_{i}-a_{j}\mid 1\leq i\neq j\leq w\} is called the set of differences of the modular Golomb ruler. Given an (n,w1)(n,w-1) modular Golomb ruler {a1,a2,,aw1}\{a_{1},a_{2},\ldots,a_{w-1}\}, we construct nn codewords 𝒂i={(a1+i)2,(a2+i)1,,(aw1+i)1}n×[2]\bm{a}_{i}=\{(a_{1}+i)_{2},(a_{2}+i)_{1},\ldots,(a_{w-1}+i)_{1}\}\subset{\mathbb{Z}}_{n}\times[2] of type 1w2211^{w-2}2^{1} for any ini\in{\mathbb{Z}}_{n}. Here the set of positions [n][n] is replaced by n{\mathbb{Z}}_{n} with a natural order. These nn codewords have pairwise distances at least 2w22w-2 by definition, and each position in n{\mathbb{Z}}_{n} is labeled by 22 exactly once. Using the language of graphs, these colored cliques of type 1w2211^{w-2}2^{1} are edge-disjoint on n{\mathbb{Z}}_{n} and each vertex in n{\mathbb{Z}}_{n} is colored by 22 exactly once among these colored cliques.

Example II.2.

The set {0,1,3}\{0,1,3\} is an (8,3)(8,3) modular Golomb ruler. The eight codewords are 𝐚0={02,11,31},\bm{a}_{0}=\{0_{2},1_{1},3_{1}\}, 𝐚1={12,21,41},\bm{a}_{1}=\{1_{2},2_{1},4_{1}\}, 𝐚2={22,31,51},\bm{a}_{2}=\{2_{2},3_{1},5_{1}\}, 𝐚3={32,41,61},\bm{a}_{3}=\{3_{2},4_{1},6_{1}\}, 𝐚4={42,51,71},\bm{a}_{4}=\{4_{2},5_{1},7_{1}\}, 𝐚5={52,61,01},\bm{a}_{5}=\{5_{2},6_{1},0_{1}\}, 𝐚6={62,71,11}\bm{a}_{6}=\{6_{2},7_{1},1_{1}\} and 𝐚7={72,01,21}.\bm{a}_{7}=\{7_{2},0_{1},2_{1}\}. Each vertex in 8{\mathbb{Z}}_{8} is colored by 22 exactly once.

We show an example to explain how we use modular Golomb ruler to get subgraphs SS and GnG_{n} of KnK_{n} and then lead to an optimal code. The example below is from [30, Theorem VI.2.].

Example II.3.

When n=Ω(w2)n=\Omega(w^{2}), there exists an (n,w1)(n,w-1) modular Golomb ruler [32]. Let the whole graph KnK_{n} be of vertex set n.{\mathbb{Z}}_{n}. By our discussion above, the nn codewords 𝐚i\bm{a}_{i}, ini\in{\mathbb{Z}}_{n} from the modular Golomb ruler form a packing by nn colored cliques of type 1w2211^{w-2}2^{1}. Let S=inK𝐚iS=\cup_{i\in{{\mathbb{Z}}_{n}}}K_{\bm{a}_{i}}, which has a trivial decomposition of size nn, and let Gn=KnS.G_{n}=K_{n}-S. For any vnv\in{\mathbb{Z}}_{n}, dGn(v)=n1(w1)(w2).d_{G_{n}}(v)=n-1-(w-1)(w-2). Further, there are n(n1)2n(w1)(w2)2\frac{n(n-1)}{2}-n\frac{(w-1)(w-2)}{2} edges in GnG_{n}. When nwmodw(w1),n\equiv w\mod w(w-1), it is easy to check that GnG_{n} satisfies all conditions in Remark II.1 and then there exists a decomposition 𝒫\mathcal{P} of GnG_{n} by colored cliques of type 1w1^{w} as long as n>N(w).n>N^{\prime}(w). With simple calculations we get |𝒫|=B(n).|\mathcal{P}|=B(n). Hence the code 𝒞={𝐚i:in}𝒫\mathcal{C}=\{\bm{a}_{i}:i\in{\mathbb{Z}}_{n}\}\cup\mathcal{P} forms a balanced (n,2w2,w)3(n,2w-2,w)_{3} code of size B(n)+nB(n)+n by Corollary II.1. This lead to the following conclusion:

Given any w5w\geq 5, if nwmodw(w1),n\equiv w\mod w(w-1), A3(n,2w2,w)=B(n)+nA_{3}(n,2w-2,w)=B(n)+n for any sufficiently large integer n.n.

A finite set B={b1,b2,,bm}[n1]B=\{b_{1},b_{2},\ldots,b_{m}\}\subset[n-1] is free from an (n,w)(n,w) modular Golomb ruler {a1,,aw}\{a_{1},\ldots,a_{w}\} if all bi,i[m]b_{i},i\in[m], as elements of n{\mathbb{Z}}_{n}, do not appear in the set of differences. Such an (n,w)(n,w) modular Golomb ruler is called BB-free. It is trivial to observe that the (8,3)(8,3) modular Golomb ruler in Example II.2 is {4}\{4\}-free. Specially, by definition if {a1,,aw}\{a_{1},\ldots,a_{w}\} is a BB-free (n,w)(n,w) modular Golomb ruler, so is the set {a1+i,,aw+i}\{a_{1}+i,\ldots,a_{w}+i\} for all in.i\in{\mathbb{Z}}_{n}.

Lemma II.2.

For any integer w5w\geq 5 and a set B[n1]B\subset[n-1] with the largest element bb, there exists a BB-free (n,w1)(n,w-1) modular Golomb ruler when nw(2b+w2)n\geq w(2b+w^{2}). Specially when BB is empty, we define b=0b=0.

Proof.

We will greedily find w1w-1 pairwise distinct integers a1,a2,,aw1a_{1},a_{2},\cdots,a_{w-1} in [0,n1][0,n-1], which form a BB-free (n,w1)(n,w-1) modular Golomb ruler when viewed as elements of n{\mathbb{Z}}_{n}. Start with a1=0a_{1}=0. The set {0}\{0\} is clearly a BB-free (n,1)(n,1) modular Golomb ruler.

For any k[2,w1]k\in[2,w-1], assume that there exists pairwise distinct integers a1,,ak1a_{1},\ldots,a_{k-1} in [0,n1][0,n-1] such that {a1,,ak1}\{a_{1},\ldots,a_{k-1}\} forms a BB-free (n,k1)(n,k-1) modular Golomb ruler. We consider the kkth step. If there exists an integer v[0,n1]v\in[0,n-1], such that both the following conditions are satisfied,

  • for any i[k1],i\in[k-1], b<vai<nbb<v-a_{i}<n-b;

  • for any i[k1],i\in[k-1], vaiv-a_{i} is not in the set of differences of {a1,,ak1}\{a_{1},\ldots,a_{k-1}\},

then {a1,,ak}\{a_{1},\ldots,a_{k}\} is a BB-free (n,k)(n,k) modular Golomb ruler after we set ak=v.a_{k}=v. There are at most (k1)(2b+1)(k-1)(2b+1) integers in [n1][n-1] violate the first condition and at most 2(k1)(k12)2(k-1)\binom{k-1}{2} integers violate the second one. When nw(2b+w2)n\geq w(2b+w^{2}), by pigeonhole principle such vv always exists. ∎

Before ending this section, we mention that in our constructions in the sections to follow, we usually use nk{b1,,bk}{\mathbb{Z}}_{n-k}\cup\{b_{1},\ldots,b_{k}\} with a natural order, to denote the set of positions of the code, or equivalently the vertex set of KnK_{n} to be packed. This setting will help us to give a clearer prospect for the structure of our desired subgraph SS and its packing 𝒮\mathcal{S} with colored cliques.

III General Idea

In this section, we illustrate the idea of our main construction of 𝒮\mathcal{S} by simple cases such that the resulting code is optimal and balanced. To make our constructions simple, we assume that 𝒮\mathcal{S} only contains codewords of types 1w2211^{w-2}2^{1} and 1w4221^{w-4}2^{2}. Let xx, yy and zz denote the number of codewords of types 1w1^{w}, 1w2211^{w-2}2^{1} and 1w4221^{w-4}2^{2}, respectively.

Based on the above assumption, we first figure out the valid numbers xx, yy, and zz of codewords with different types by the balanced property. We start with x=B(n)x=B(n), y=ny=n, and z=0z=0, which in total reaches the upper bound. Note that the current SS is the union of cliques of order w1w-1 from these nn codewords of type 1w2211^{w-2}2^{1}. Let \ell be the number in the range 0<(w2)0\leq\ell<{w\choose 2} such that

(n2)n(w12)mod(w2),\ell\equiv{n\choose 2}-n{w-1\choose 2}\mod{{w\choose 2}}, (1)

that is

2n(n1)n(w1)(w2)modw(w1).2\ell\equiv n(n-1)-n(w-1)(w-2)\mod{w(w-1)}. (2)

Let Gn=KnSG_{n}=K_{n}-S, then the right hand side of Equation (1) is the number of edges in GnG_{n}. If 0\ell\neq 0, i.e., e(Kw)e(Gn)e(K_{w})\nmid e(G_{n}), then there does not exist a KwK_{w}-decomposition of GnG_{n}, that is the code can not be balanced. To make it balanced, we need to modify the initial numbers xx, yy and zz so that all cliques consume \ell extra edges. We do the following two operations without changing the sum x+y+zx+y+z.

  •   (O1)

    Replace one codeword of type 1w2211^{w-2}2^{1} by a codeword of type 1w1^{w} to consume (w1)(w-1) more edges, i.e., xx+1x\rightarrow x+1, yy1y\rightarrow y-1;

  • (O2)

    Replace two codewords of type 1w2211^{w-2}2^{1} by a codeword of type 1w1^{w} and one of type 1w4221^{w-4}2^{2} to consume one more edge, i.e., yy2y\rightarrow y-2, xx+1x\rightarrow x+1 and zz+1z\rightarrow z+1.

By these two operations, we are able to figure out some values of xx, yy and zz, such that the total number of codewords x+y+z=B(n)+nx+y+z=B(n)+n still holds, and \ell extra edges are all consumed, that is, they are valid for a balanced code. Suppose that we do aa times of (O1) and bb times of (O2), then (a,b)(a,b) is just any nonnegative integral solution to

a(w1)+b=.a(w-1)+b=\ell. (3)

Then x=B(n)+a+bx=B(n)+a+b, y=na2by=n-a-2b, z=bz=b. We always choose bb as the smallest nonnegative integer such that Equation (3) has a nonnegative integral solution.

Next, we try to construct yy codewords of type 1w2211^{w-2}2^{1} and zz codewords of type 1w4221^{w-4}2^{2} to form a new subgraph SS. It is clear now that the new Gn=KnSG_{n}=K_{n}-S will satisfy e(Kw)e(Gn)e(K_{w})\mid e(G_{n}). To apply Theorem II.1 or Remark II.1, we need that GnG_{n} is (w1)(w-1)-divisible, or equivalently, for all vV(Kn)v\in V(K_{n}), n1dS(v)0mod(w1)n-1-d_{S}(v)\equiv 0\mod{(w-1)}. For any vV(Kn),v\in V(K_{n}), we define yvy_{v} and zvz_{v} the number of cliques of type 1w2211^{w-2}2^{1} and 1w4221^{w-4}2^{2}, respectively, containing vv in 𝒮\mathcal{S}. Thus dS(v)=yv(w2)+zv(w3)d_{S}(v)=y_{v}(w-2)+z_{v}(w-3) and

n1dS(v)=n1yv(w2)zv(w3)n1+yv+2zv0mod(w1).n-1-d_{S}(v)=n-1-y_{v}(w-2)-z_{v}(w-3)\equiv n-1+y_{v}+2z_{v}\equiv 0\mod{(w-1)}.

Denote R(v)yv+2zvR(v)\triangleq y_{v}+2z_{v}. For simplicity, we assume R(v)R(v) can only be the least two non-negative integers satisfying this equation. Assume that ntmod(w1)n\equiv t\mod(w-1) with 0tw20\leq t\leq w-2. Let

Rm{1, if t=0;0, if t=1;wt, if t2.R_{m}\triangleq\left\{\begin{array}[]{ll}1,&\text{ if }t=0;\\ 0,&\text{ if }t=1;\\ w-t,&\text{ if }t\geq 2.\end{array}\right. (4)

Then R(v){Rm,Rm+w1}R(v)\in\{R_{m},R_{m}+w-1\}.

When constructing 𝒮\mathcal{S}, we follow an additional rule that each vertex can be in at most one clique of type 1w422,1^{w-4}2^{2}, i.e., zv=0z_{v}=0 or 11 for all v.v. Since there are in total z=bz=b cliques of type 1w4221^{w-4}2^{2}, |{vV(Kn):zv=1}|=b(w2).|\{v\in V(K_{n}):z_{v}=1\}|=b(w-2). Note that dS(v)=(w2)R(v)(w1)zvd_{S}(v)=(w-2)R(v)-(w-1)z_{v}, then vdS(v)=v(w2)R(v){v:zv=1}(w1)=v(w2)R(v)b(w1)(w2).\sum_{v}d_{S}(v)=\sum_{v}(w-2)R(v)-\sum_{\{v:z_{v}=1\}}(w-1)=\sum_{v}(w-2)R(v)-b(w-1)(w-2). Let cc be the number of vertices having R(v)=RmR(v)=R_{m} in SS. By the handshaking lemma, vdS(v)=2e(S)\sum_{v}d_{S}(v)=2e(S), and we have

c(w2)Rm+(nc)(w2)(Rm+w1)b(w2)(w1)=(na2b)(w1)(w2)+b(w2)(w3).c(w-2)R_{m}+(n-c)(w-2)(R_{m}+w-1)-b(w-2)(w-1)=(n-a-2b)(w-1)(w-2)+b(w-2)(w-3).

That is

c(w1)=nRm+a(w1)+2b.c(w-1)=nR_{m}+a(w-1)+2b. (5)

So far, we have two equations (3) and (5), and three undetermined parameters a,b,ca,b,c. It is possible for us to find a common nonnegative integral solution (a,b,c)(a,b,c) to both equations. Note that the value cc reflects the distribution of vertices in codewords of type 1w2211^{w-2}2^{1} and 1w4221^{w-4}2^{2} in some way. In Example II.3, an (n,w1)(n,w-1) modular Golomb ruler produces nn codewords of type 1w2211^{w-2}2^{1} such that each vertex occurs in exactly (w1)(w-1) such codewords, which contributes (w1)(w-1) to yvy_{v} or R(v)R(v) for each vnv\in{\mathbb{Z}}_{n}.

Based on the above valid choices of a,b,ca,b,c, we have the following result.

Lemma III.1.

Given an integer w5w\geq 5 and a sufficiently large ntmod(w1)n\equiv t\mod(w-1) for some t[0,w2]t\in[0,w-2], let a,b,ca,b,c and RmR_{m} be non-negative integers satisfying Equations (3)-(5). If 𝒮\mathcal{S} is an (n,2w2,w)3(n,2w-2,w)_{3} code consisting of na2bn-a-2b codewords of type 1w2211^{w-2}2^{1} and bb codewords of type 1w4221^{w-4}2^{2}, such that

  • (1)

    there are exactly cc positions (or vertices vv of KnK_{n}) with R(v)=RmR(v)=R_{m}, all others are Rm+w1R_{m}+w-1;

  • (2)

    the sets supp(𝒖)supp(\bm{u}) for all codewords 𝒖\bm{u} of type 1w4221^{w-4}2^{2} are disjoint,

then there is an optimal balanced (n,2w2,w)3(n,2w-2,w)_{3} code and A3(n,2w2,w)=B(n)+nA_{3}(n,2w-2,w)=B(n)+n.

Proof.

Let S=𝒂𝒮K𝒂S=\cup_{\bm{a}\in\mathcal{S}}K_{\bm{a}} be a graph and Gn=KnS.G_{n}=K_{n}-S. We apply Remark II.1 to prove that GnG_{n} has a KwK_{w}-decomposition of size B(n)+a+bB(n)+a+b.

First, for any vV(Kn),v\in V(K_{n}), dGn(v)=n1dS(V)n1R(v)(w2)>n12w2.d_{G_{n}}(v)=n-1-d_{S}(V)\geq n-1-R(v)(w-2)>n-1-2w^{2}. Specially, since dGn(v)n1+R(v)mod(w1),d_{G_{n}}(v)\equiv n-1+R(v)\mod(w-1), we have dGn(v)0mod(w1),d_{G_{n}}(v)\equiv 0\mod(w-1), i.e. GnG_{n} is (w1)(w-1)-divisible.

Further, we have

e(Gn)e(Kw)\displaystyle\frac{e(G_{n})}{e(K_{w})} =2e(Gn)2e(Kw)\displaystyle=\frac{2e(G_{n})}{2e(K_{w})}
=n(n1)n(w1)(w2)w(w1)+(a+2b)(w1)(w2)b(w2)(w3)w(w1)\displaystyle=\frac{n(n-1)-n(w-1)(w-2)}{w(w-1)}+\frac{(a+2b)(w-1)(w-2)-b(w-2)(w-3)}{w(w-1)}
=B(n)+2+(a+2b)(w1)(w2)b(w2)(w3)w(w1)\displaystyle=B(n)+\frac{2\ell+(a+2b)(w-1)(w-2)-b(w-2)(w-3)}{w(w-1)}
=B(n)+a+b,\displaystyle=B(n)+a+b,

where the last step is by (3).

With all conditions satisfied, Remark II.1 gives us an integer N=N(w)N=N(w) such that if n>N,n>N, there exists a KwK_{w}-decomposition 𝒫\mathcal{P} of GnG_{n}. By vertex-coloring all cliques in 𝒫\mathcal{P} with color 11, 𝒫\mathcal{P} is a code with B(n)+a+bB(n)+a+b codewords of type 1w.1^{w}.

Finally, by Corollary II.1 and Lemma II.1, A3(n,2w2,w)=B(n)+nA_{3}(n,2w-2,w)=B(n)+n and the code 𝒞=𝒮𝒫\mathcal{C}=\mathcal{S}\cup\mathcal{P} is an optimal balanced (n,2w2,w)3(n,2w-2,w)_{3} code. ∎

By Lemma III.1, to show that an optimal balanced (n,2w2,w)3(n,2w-2,w)_{3} code exists with A3(n,2w2,w)=B(n)+nA_{3}(n,2w-2,w)=B(n)+n, we only need to find an (n,2w2,w)3(n,2w-2,w)_{3} code 𝒮\mathcal{S} satisfying Lemma III.1. Next, we take n0,1mod(w1)n\equiv 0,1\mod(w-1) to show the way of computing the valid triple (a,b,c)(a,b,c), and then the numbers x,yx,y and zz. By computing the right hand side of Equation (2), we know that (w1)2(w-1)\mid 2\ell. Assume that (w1)(w-1)\mid\ell in the following constructions, since in this case we only need to do operation (O1). We will give constructions for code 𝒮\mathcal{S} satisfying Lemma III.1.

III-A n1mod(w1)n\equiv 1\mod(w-1) and (w1)(w-1)\mid\ell

Let n=h(w1)+1n=h(w-1)+1, and 2=2k(w1)2\ell=2k(w-1) for some k[0,w21]k\in[0,\lceil\frac{w}{2}\rceil-1]. Then we do operation (O1) kk times to consume =k(w1)\ell=k(w-1) edges, that is a=ka=k and b=0b=0. The value R(v){0,w1}R(v)\in\{0,w-1\} and Rm=0R_{m}=0 in this case, so c=a=kc=a=k by (5). The candidates of numbers of codewords of types 1w1^{w}, 1w2211^{w-2}2^{1} and 1w4221^{w-4}2^{2} are x=B(n)+kx=B(n)+k, y=nky=n-k and z=0z=0. Let KnK_{n} be the complete graph with vertex set nk{bi:i[k]}{\mathbb{Z}}_{n-k}\cup\{b_{i}:i\in[k]\}. The code 𝒮\mathcal{S} is constructed as follows.

When hh is large enough such that nk>w3n-k>w^{3}, by Lemma II.2, there exists an (nk,w1)(n-k,w-1) modular Golomb ruler {a1,a2,,aw1}\{a_{1},a_{2},\ldots,a_{w-1}\} on nk{\mathbb{Z}}_{n-k}. Define codewords 𝒂i={(a1+i)2,(a2+i)1,(a3+i)1,,(aw1+i)1}\bm{a}_{i}=\{(a_{1}+i)_{2},(a_{2}+i)_{1},(a_{3}+i)_{1},\ldots,(a_{w-1}+i)_{1}\} of type 1w2211^{w-2}2^{1} for inki\in{\mathbb{Z}}_{n-k}. This gives us nkn-k cliques of type 1w2211^{w-2}2^{1} which form a packing of KnK_{n}. Define 𝒮={𝒂i:ink}\mathcal{S}=\{{\bm{a}_{i}}:i\in{\mathbb{Z}}_{n-k}\}. Each vertex vv in nk{\mathbb{Z}}_{n-k} is colored by 22 exactly once, and contained in w1w-1 different colored cliques of 𝒮\mathcal{S}, that is R(v)=w1R(v)=w-1. The c=kc=k vertices bib_{i} are not contained in any colored clique of 𝒮\mathcal{S}, that is R(v)=0R(v)=0. So 𝒮\mathcal{S} is an (n,2w2,w)3(n,2w-2,w)_{3} code satisfying Lemma III.1, thus A3(n,2w2,w)=B(n)+nA_{3}(n,2w-2,w)=B(n)+n for sufficiently large nn.

III-B n0mod(w1)n\equiv 0\mod(w-1) and (w1)(w-1)\mid\ell

Let n=h(w1)n=h(w-1), and 2=2k(w1)2\ell=2k(w-1) for some k[0,w21]k\in[0,\lceil\frac{w}{2}\rceil-1]. Then we do operation (O1) kk times to consume =k(w1)\ell=k(w-1) edges, that is a=ka=k and b=0b=0. The value R(v){1,w}R(v)\in\{1,w\} and Rm=1R_{m}=1 in this case, so c=h+a=h+kc=h+a=h+k. The numbers of codewords of types 1w1^{w}, 1w2211^{w-2}2^{1} and 1w4221^{w-4}2^{2} will be x=B(n)+kx=B(n)+k, y=nky=n-k and z=0z=0.

Let n=nhkn^{\prime}=n-h-k, and let the vertex set of KnK_{n} be the union of three parts: n{\mathbb{Z}}_{n^{\prime}}, {bi}i[h]\{b_{i}\}_{i\in[h]} and {cj}j[k].\{c_{j}\}_{j\in[k]}. The set {bi}i[h]{cj}j[k]\{b_{i}\}_{i\in[h]}\cup\{c_{j}\}_{j\in[k]} will be the c=h+kc=h+k vertices with R(v)=1R(v)=1. The code 𝒮\mathcal{S} is constructed as follows.

When hh is large enough such that n>2w3n^{\prime}>2w^{3}, by Lemma II.2 there exists a [w1][w-1]-free (n,w1)(n^{\prime},w-1) modular Golomb ruler {a1,a2,,aw1}\{a_{1},a_{2},\ldots,a_{w-1}\}. From this, we get nn^{\prime} codewords of type 1w2211^{w-2}2^{1}, 𝒂i={(a1+i)2,(a2+i)1,(a3+i)1,,(aw1+i)1}\bm{a}_{i}=\{(a_{1}+i)_{2},(a_{2}+i)_{1},(a_{3}+i)_{1},\ldots,(a_{w-1}+i)_{1}\} for ini\in{\mathbb{Z}}_{n^{\prime}}. The other hh codewords 𝒔i,\bm{s}_{i}, i[h]i\in[h] of type 1w2211^{w-2}2^{1} are constructed as follows, whose supports form a partition of the vertex set of KnK_{n}. When i[k]i\in[k], 𝒔i={(bi)2,(ci)1}[(w3)(i1),(w3)i1]1\bm{s}_{i}=\{(b_{i})_{2},(c_{i})_{1}\}\cup[(w-3)(i-1),(w-3)i-1]_{1}; when i[k+1,h]i\in[k+1,h], 𝒔i={(bi)2}[(w2)(i1)k,(w2)ik1]1\bm{s}_{i}=\{(b_{i})_{2}\}\cup[(w-2)(i-1)-k,(w-2)i-k-1]_{1}. Here, [,]1[\cdot,\cdot]_{1} means that all integers in the interval are labeled by 11.

Let 𝒮={𝒂i:in}{𝒔i:i[h]}\mathcal{S}=\{{\bm{a}_{i}}:i\in{\mathbb{Z}}_{n^{\prime}}\}\cup\{{\bm{s}_{i}}:i\in[h]\}. It is clear that each vertex of KnK_{n} is colored by 22 at most once. We claim that 𝒮\mathcal{S} as a set of colored cliques forms a packing of KnK_{n}. If it is false, there exists two different 𝒂,𝒃𝒮\bm{a},\bm{b}\in\mathcal{S}, such that K𝒂K_{\bm{a}} and K𝒃K_{\bm{b}} have one edge uvuv in common. In other words, uu and vv are both in supp(𝒂)supp(𝒃).supp(\bm{a})\cap supp(\bm{b}). As {K𝒂i:in}\{K_{\bm{a}_{i}}:i\in{\mathbb{Z}}_{n^{\prime}}\} and {K𝒔i:i[h]}\{K_{\bm{s}_{i}}:i\in[h]\} are both packings already, we assume 𝒂=𝒔i\bm{a}=\bm{s}_{i} and 𝒃=𝒂j\bm{b}=\bm{a}_{j} for some i[h]i\in[h] and jn.j\in{\mathbb{Z}}_{n^{\prime}}. Thus, both uu and vv are in n{\mathbb{Z}}_{n^{\prime}} and we may assume u>vu>v as integers. Since uu and vv are in supp(𝒔i)supp(\bm{s}_{i}), uv[w1],u-v\in[w-1], which contradicts to the fact that supp(𝒂j)supp(\bm{a}_{j}) is a [w1][w-1]-free modular Golomb ruler. So 𝒮\mathcal{S} is an (n,2w2,w)3(n,2w-2,w)_{3} code. Further, each vertex vnv\in{\mathbb{Z}}_{n^{\prime}} is contained in ww different colored cliques in 𝒮\mathcal{S}, that is R(v)=wR(v)=w; each vnv\not\in{\mathbb{Z}}_{n^{\prime}} is contained in only one colored clique in 𝒮\mathcal{S}, that is R(v)=1R(v)=1. So 𝒮\mathcal{S} satisfies Lemma III.1, and A3(n,2w2,w)=B(n)+nA_{3}(n,2w-2,w)=B(n)+n for sufficiently large nn.

IV Completing the Cases n0,1mod(w1)n\equiv 0,1\mod(w-1)

Subsections III-A and III-B give us two similar constructions of the required (n,2w2,w)3(n,2w-2,w)_{3} codes 𝒮\mathcal{S} when n0,1mod(w1)n\equiv 0,1\mod(w-1) and (w1)(w-1)\mid\ell. The property (w1)(w-1)\mid\ell always holds when ww is even. In this section, we assume that ww is odd, and consider constructions of optimal (n,2w2,w)3(n,2w-2,w)_{3} codes when n0,1mod(w1)n\equiv 0,1\mod(w-1) and (w1)(w-1)\nmid\ell.

IV-A n0mod(w1)n\equiv 0\mod(w-1) and (w1)(w-1)\nmid\ell

Let n=h(w1)n=h(w-1) and 2=(2k+1)(w1)2\ell=(2k+1)(w-1) for some k[0,w32].k\in[0,\frac{w-3}{2}]. Then we do operation (O1) kk times and operation (O2) w12\frac{w-1}{2} times to consume =k(w1)+w12\ell=k(w-1)+\frac{w-1}{2} edges, that is a=ka=k and b=w12.b=\frac{w-1}{2}. The value R(v){1,w}R(v)\in\{1,w\} and Rm=1R_{m}=1 in this case, and c=nw1+a+2bw1=h+k+1.c=\frac{n}{w-1}+a+\frac{2b}{w-1}=h+k+1. So the candidates of numbers of codewords of type 1w1^{w}, 1w2211^{w-2}2^{1} and 1w4221^{w-4}2^{2} are x=B(n)+k+w12x=B(n)+k+\frac{w-1}{2}, y=nk(w1)y=n-k-(w-1) and z=w12.z=\frac{w-1}{2}.

Let KnK_{n} be the complete graph with vertex set nBC{\mathbb{Z}}_{n^{\prime}}\cup B\cup C, where n=n(w1)(w2)2(h+k+1)n^{\prime}=n-\frac{(w-1)(w-2)}{2}-(h+k+1). The set BB has (w1)(w2)2\frac{(w-1)(w-2)}{2} vertices, b¯i\bar{b}_{i}, i[w1]i\in[w-1] and bj,j[(w1)(w4)2]b_{j},j\in[\frac{(w-1)(w-4)}{2}]. The set CC consists of h+k+1h+k+1 vertices, c¯i\bar{c}_{i}, i[h+1]i\in[h+1] and cjc_{j}, j[k]j\in[k]. An (n,2w2,w)3(n,2w-2,w)_{3} code 𝒮\mathcal{S} consisting of nk(w1)n-k-(w-1) codewords of type 1w2211^{w-2}2^{1} and w12\frac{w-1}{2} codewords of type 1w4221^{w-4}2^{2} is given below.

Construction IV.1.

Suppose hh is large enough so that hk+w3h\geq k+w^{3}. We construct six disjoint classes of codewords below.

  • (1)

    The w12\frac{w-1}{2} codewords of type 1w4221^{w-4}2^{2} are

    𝒛i={(b¯2i1)2,(b¯2i)2}{(b(w4)(i1)+1)1,(b(w4)(i1)+2)1,,(b(w4)i)1}, for all i[w12].\bm{z}_{i}=\{(\bar{b}_{2i-1})_{2},(\bar{b}_{2i})_{2}\}\cup\{(b_{(w-4)(i-1)+1})_{1},(b_{(w-4)(i-1)+2})_{1},\ldots,(b_{(w-4)i})_{1}\},\text{ for all }i\in\left[\frac{w-1}{2}\right].

    Let 𝒵={𝒛i:i[w12]}.\mathcal{Z}=\{\bm{z}_{i}:i\in[\frac{w-1}{2}]\}. Note that supp(𝒛i)supp(\bm{z}_{i}), i[w12]i\in[\frac{w-1}{2}] form a partition of the set BB, and each b¯i\bar{b}_{i}, i[w1]i\in[w-1] is labeled by 22 exactly once.

  • (2)

    Since n>2w3n^{\prime}>2w^{3}, there exists a [w1][w-1]-free (n,w1)(n^{\prime},w-1) Golomb ruler {a1,a2,,aw1}\{a_{1},a_{2},\ldots,a_{w-1}\}, which derives the first nn^{\prime} codewords of type 1w2211^{w-2}2^{1},

    𝒂i={(a1+i)2,(a2+i)1,(a3+i)1,,(aw1+i)1}, for all in.\bm{a}_{i}=\{(a_{1}+i)_{2},(a_{2}+i)_{1},(a_{3}+i)_{1},\ldots,(a_{w-1}+i)_{1}\},\text{ for all }i\in{\mathbb{Z}}_{n^{\prime}}.

    Let 𝒴1={𝒂i:in}\mathcal{Y}_{1}=\{\bm{a}_{i}:i\in{\mathbb{Z}}_{n^{\prime}}\}. Each vertex vnv\in{\mathbb{Z}}_{n^{\prime}} appears in exactly w1w-1 cliques in 𝒴1\mathcal{Y}_{1} and is labeled by 22 in exactly one codeword.

  • (3)

    Let n0=(w1)(w2)(w4)2n_{0}=\frac{(w-1)(w-2)(w-4)}{2}. Since n>n0n^{\prime}>n_{0}, the next (w1)(w4)2\frac{(w-1)(w-4)}{2} codewords of type 1w2211^{w-2}2^{1} are

    𝒔i={(bi)2}[(w2)(i1),(w2)i1]1, for all i[(w1)(w4)2].\bm{s}_{i}=\{(b_{i})_{2}\}\cup[(w-2)(i-1),(w-2)i-1]_{1},\text{ for all }i\in\left[\frac{(w-1)(w-4)}{2}\right].

    Let 𝒴2={𝒔i:i[(w1)(w4)2]}\mathcal{Y}_{2}=\{\bm{s}_{i}:i\in[\frac{(w-1)(w-4)}{2}]\}. Note that supp(𝒔i)supp(\bm{s}_{i}), i[(w1)(w4)2]i\in[\frac{(w-1)(w-4)}{2}] are pairwise disjoint, covering all bib_{i} in BB, and elements in [0,n01]n[0,n_{0}-1]\subset{\mathbb{Z}}_{n^{\prime}}. Further, each bi,i[(w1)(w4)2]b_{i},i\in[\frac{(w-1)(w-4)}{2}] is labeled by 22 exactly once.

  • (4)

    Let α=(w2)(w1)+(w3)(w4)(w1)2\alpha=(w-2)(w-1)+(w-3)\frac{(w-4)(w-1)}{2}. Note that nn0+α(w3)n^{\prime}\geq n_{0}+\alpha(w-3) and hα+kh\geq\alpha+k. We consider a sequence r1,r2,,rαr_{1},r_{2},\ldots,r_{\alpha} with elements in BB as follows. When i(w2)(w1)i\leq(w-2)(w-1), ri=b¯iw2r_{i}=\bar{b}_{\lceil\frac{i}{w-2}\rceil}; when (w2)(w1)<iα(w-2)(w-1)<i\leq\alpha, ri=bi(w1)(w2)w3.r_{i}=b_{\lceil\frac{i-(w-1)(w-2)}{w-3}\rceil}. In this sequence, each b¯i\bar{b}_{i}, i[w1]i\in[w-1] appears w2w-2 times and each bib_{i}, i[(w4)(w1)2]i\in[\frac{(w-4)(w-1)}{2}] appears w3w-3 times. The third class of codewords of type 1w2211^{w-2}2^{1} are

    𝒚i={(c¯i)2,(ri)1}[n0+(i1)(w3),n0+i(w3)1]1, for all i[α].\bm{y}_{i}=\{(\bar{c}_{i})_{2},(r_{i})_{1}\}\cup[n_{0}+(i-1)(w-3),n_{0}+i(w-3)-1]_{1},\text{ for all }i\in[\alpha].

    Let 𝒴3={𝒚i:i[α]}.\mathcal{Y}_{3}=\{\bm{y}_{i}:i\in[\alpha]\}. Each element from [n0,β1]n[n_{0},\beta-1]\subset{\mathbb{Z}}_{n^{\prime}} appears in exactly one clique in 𝒴3\mathcal{Y}_{3}, where β=n0+(w3)α\beta=n_{0}+(w-3)\alpha. Each c¯i\bar{c}_{i}, i[α]i\in[\alpha] is labeled by 22 once.

  • (5)

    Since hα+kh\geq\alpha+k, hkα+1h-k-\alpha+1 is a positive integer. The fourth class of codewords of type 1w2211^{w-2}2^{1} are

    𝒚α+t={(c¯α+t)2}[β+(w2)(t1),β+(w2)t1]1, for all t[hkα+1].\bm{y}_{\alpha+t}=\{(\bar{c}_{\alpha+t})_{2}\}\cup[\beta+(w-2)(t-1),\beta+(w-2)t-1]_{1},\text{ for all }t\in[h-k-\alpha+1].

    Let 𝒴4={𝒚i:i[α+1,hk+1]}.\mathcal{Y}_{4}=\{\bm{y}_{i}:i\in[\alpha+1,h-k+1]\}. Each element from [β,γ1][\beta,\gamma-1] in n{\mathbb{Z}}_{n^{\prime}} appears in exactly one clique in 𝒴4\mathcal{Y}_{4}, where γ=β+(w2)(hkα+1)\gamma=\beta+(w-2)(h-k-\alpha+1). Each c¯i\bar{c}_{i}, i[α+1,hk+1]i\in[\alpha+1,h-k+1] is labeled by 22 once.

  • (6)

    The last kk codewords of type 1w2211^{w-2}2^{1} are

    𝒚hk+1+i={(c¯hk+1+i)2,(ci)1}[γ+(w3)(i1),γ+(w3)i1]1,\bm{y}_{h-k+1+i}=\{(\bar{c}_{h-k+1+i})_{2},(c_{i})_{1}\}\cup[\gamma+(w-3)(i-1),\gamma+(w-3)i-1]_{1},

    for i[k]i\in[k]. Let 𝒴5={𝒚hk+1+i:i[k]}.\mathcal{Y}_{5}=\{\bm{y}_{h-k+1+i}:i\in[k]\}. The sets supp(𝒚hk+1+i),i[k]supp(\bm{y}_{h-k+1+i}),i\in[k] are pairwise disjoint, and cover all the remaining elements in CC and n{\mathbb{Z}}_{n^{\prime}}. Further, each c¯i\bar{c}_{i}, i[hk+2,h+1]i\in[h-k+2,h+1] is labeled by 22 once.

Finally, Let 𝒴=i[5]𝒴i\mathcal{Y}=\cup_{i\in[5]}\mathcal{Y}_{i} and 𝒮=𝒵𝒴.\mathcal{S}=\mathcal{Z}\cup\mathcal{Y}. All vertices in KnK_{n} other than cic_{i}, i[k]i\in[k] are colored by 22 exactly once in 𝒮.\mathcal{S}. For any vertex vCv\in C, R(v)=1.R(v)=1. More specifically, c¯i\bar{c}_{i} is only contained in 𝒚i\bm{y}_{i}, while cjc_{j} is only contained in 𝒚hk+1+j\bm{y}_{h-k+1+j}. Similarly, any vertex vv in BB is contained in exactly one clique in 𝒵\mathcal{Z} and w2w-2 cliques in 𝒴,\mathcal{Y}, so R(v)=wR(v)=w. Each vertex vnv\in{\mathbb{Z}}_{n^{\prime}} is contained in exactly ww cliques in 𝒴\mathcal{Y} and no clique in 𝒵\mathcal{Z}, so R(v)=wR(v)=w. It is left to check that 𝒮\mathcal{S} as a set of cliques forms a packing of KnK_{n}.

If it is false, there exists two different 𝒂,𝒃𝒮\bm{a},\bm{b}\in\mathcal{S} such that K𝒂K_{\bm{a}} and K𝒃K_{\bm{b}} have one edge uvuv in common. Note that from modular Golomb ruler, 𝒵𝒴1\mathcal{Z}\cup\mathcal{Y}_{1} is already a packing, and 𝒴\𝒴1\mathcal{Y}\backslash\mathcal{Y}_{1} is also a packing by simple verification. So we assume 𝒂𝒵𝒴1\bm{a}\in\mathcal{Z}\cup\mathcal{Y}_{1} and 𝒃𝒴\𝒴1.\bm{b}\in\mathcal{Y}\backslash\mathcal{Y}_{1}. If 𝒂𝒵,\bm{a}\in\mathcal{Z}, all vertices in 𝒂\bm{a} are in BB while no codeword in 𝒴\𝒴1\mathcal{Y}\backslash\mathcal{Y}_{1} has more than one element in BB, hence K𝒂K_{\bm{a}} and K𝒃K_{\bm{b}} are edge disjoint. If 𝒂𝒴1\bm{a}\in\mathcal{Y}_{1}, then both uu and vv are in n.\mathbb{Z}_{n^{\prime}}. Suppose that u>vu>v as integers. Since {u,v}supp(𝒃)\{u,v\}\subset supp(\bm{b}) and 𝒃𝒴\𝒴1,\bm{b}\in\mathcal{Y}\backslash\mathcal{Y}_{1}, by our construction uv[w1]u-v\in[w-1], which contradicts to the fact that supp(𝒂)supp(\bm{a}) is a [w1][w-1]-free modular Golomb ruler.

Combing the result above with Lemma III.1 and Subsection III-B, we have the following theorem.

Theorem IV.1.

For any w5w\geq 5, there exists an integer N=N(w)N=N(w) such that, for any integer n>Nn>N and n0mod(w1),n\equiv 0\mod(w-1), A3(n,2w2,w)=B(n)+nA_{3}(n,2w-2,w)=B(n)+n. Furthermore, there exists a balanced optimal (n,2w2,w)3(n,2w-2,w)_{3} code.

IV-B n1mod(w1)n\equiv 1\mod(w-1) and (w1)(w-1)\nmid\ell

A balanced optimal code may not exist for certain parameters ww and nn. In this subsection, we will show the nonexistence of balanced optimal (n,2w2,w)3(n,2w-2,w)_{3} codes when n1mod(w1)n\equiv 1\mod(w-1) and (w1)(w-1)\nmid\ell. In other words, if there is an (n,2w2,w)3(n,2w-2,w)_{3} code of size B(n)+nB(n)+n, then there must be at least one edge which is not covered by any colored clique. We first state that a code reaching the theoretical upper bound cannot be balanced.

Theorem IV.2.

Suppose that n1mod(w1)n\equiv 1\mod(w-1) and n(n1)n(w1)(w2)(2k+1)(w1)modw(w1)n(n-1)-n(w-1)(w-2)\equiv(2k+1)(w-1)\mod w(w-1) for some k[0,w32]k\in[0,\frac{w-3}{2}]. Then an (n,2w2,w)3(n,2w-2,w)_{3} code of size B(n)+nB(n)+n is not balanced.

We need the following lemma to prove Theorem IV.2.

Lemma IV.1.

Under the same parameters as in Theorem IV.2, if there is a balanced (n,2w2,w)3(n,2w-2,w)_{3} code 𝒞\mathcal{C} of size B(n)+nB(n)+n, then 𝒞\mathcal{C} must contain a codeword which is neither of type 1w1^{w} nor of type 1w221.1^{w-2}2^{1}.

Proof.

Suppose to the contrary that 𝒞\mathcal{C} consists of only codewords of type 1w1^{w} and 1w2211^{w-2}2^{1}, and xx, yy are their numbers, respectively. Then

x+y=B(n)+n.x+y=B(n)+n.

Since 𝒞\mathcal{C} is balanced,

xe(Kw)+ye(Kw1)=e(Kn).xe(K_{w})+ye(K_{w-1})=e(K_{n}).

Combining both equations, we get y=wB(n)+n(wn1w1)2y=\frac{wB(n)+n(w-\frac{n-1}{w-1})}{2}. But substituting B(n)=n(n1)n(w1)(w2)(2k+1)(w1)w(w1)B(n)=\frac{n(n-1)-n(w-1)(w-2)-(2k+1)(w-1)}{w(w-1)} into this expression, we have y=nk12y=n-k-\frac{1}{2}, which is not even an integer. ∎

Proof of Theorem IV.2.

Suppose that 𝒞\mathcal{C} is a balanced (n,2w2,w)3(n,2w-2,w)_{3} code of size B(n)+nB(n)+n. Let y(i)y(i), i0i\geq 0 be the number of codewords in 𝒞\mathcal{C} with type 1w2i2i1^{w-2i}2^{i}. By Lemma IV.1, there exists some i[2,w2]i\in[2,\lfloor\frac{w}{2}\rfloor] such that y(i)0y(i)\neq 0. Consider the complete graph KnK_{n} with vertex set VV. Let SS be the union of all cliques from codewords of type 1w2i2i1^{w-2i}2^{i} with i>0i>0, and let ss be the number of non-isolated vertices in SS. Since a codeword of type 1w2i2i1^{w-2i}2^{i} labels ii vertices by 22, the condition (b)(b^{\prime}) in Corollary II.1 gives us the following inequality.

i>0iy(i)s.\sum_{i>0}iy(i)\leq s. (6)

For any vertex vVv\in V, let yv(i)y_{v}(i) be the number of codewords of type 1w2i2i1^{w-2i}2^{i} whose support contains vv. Since 𝒞\mathcal{C} is balanced, G=KnSG=K_{n}-S is (w1)(w-1)-divisible, and so is SS. Thus for any vV,v\in V,

dS(v)=i>0(wi1)yv(i)0mod(w1).d_{S}(v)=\sum_{i>0}(w-i-1)y_{v}(i)\equiv 0\mod(w-1).

That is, for any vertex vVv\in V, there exists some integer kv0k_{v}\geq 0 such that

i>0iyv(i)=kv(w1).\sum_{i>0}iy_{v}(i)=k_{v}(w-1).

The integer kv1k_{v}\geq 1 if and only if vv is not isolated in SS. Sum both sides above over all vertices vVv\in V to get

vVi>0iyv(i)=vVkv(w1)s(w1).\sum_{v\in V}\sum_{i>0}iy_{v}(i)=\sum_{v\in V}k_{v}(w-1)\geq s(w-1). (7)

On the other hand,

vVi>0iyv(i)=i>0ivVyv(i)=i>0iy(i)(wi).\sum_{v\in V}\sum_{i>0}iy_{v}(i)=\sum_{i>0}i\sum_{v\in V}y_{v}(i)=\sum_{i>0}iy(i)(w-i). (8)

Combine (6), (7) and (8),

i>0iy(i)(wi)s(w1)i>0iy(i)(w1),\sum_{i>0}iy(i)(w-i)\geq s(w-1)\geq\sum_{i>0}iy(i)(w-1),

which holds if and only if y(i)=0y(i)=0 for all i>1i>1. This contradicts to Lemma IV.1. ∎

Since a balanced (n,2w2,w)3(n,2w-2,w)_{3} code of size B(n)+nB(n)+n does not exist, we next construct an optimal code that is not balanced. Let n=h(w1)+1n=h(w-1)+1 and 2=(2k+1)(w1)2\ell=(2k+1)(w-1) for some k[0,w32]k\in[0,\frac{w-3}{2}]. We only allow codewords of type 1w1^{w} and 1w2211^{w-2}2^{1}. By doing operation (O1) kk times and consuming k(w1)k(w-1) more edges, there are finally w12\frac{w-1}{2} edges left uncovered. In this case, x=B(n)+k,x=B(n)+k, y=nky=n-k and z=0.z=0.

We denote all vertices of KnK_{n} as the union of three parts: one single vertex \infty, kk vertices cj,j[k]c_{j},j\in[k], and nk1.{\mathbb{Z}}_{n-k-1}. Define a sequence (r1,r2,,rw1)(r_{1},r_{2},\ldots,r_{w-1}) of w1w-1 different vertices by

ri={i1,iwk2;,i=wk1;cwi,iwk.r_{i}=\left\{\begin{array}[]{ll}i-1,&i\leq w-k-2;\\ \infty,&i=w-k-1;\\ c_{w-i},&i\geq w-k.\end{array}\right.

Let m=2w3+1m=2w^{3}+1, then by Lemma II.2 there exists a [w1][w-1]-free (m,w1)(m,w-1) modular Golomb ruler A={0=a1,,aw1}A=\{0=a_{1},\ldots,a_{w-1}\} on m{\mathbb{Z}}_{m}. Assume that a1<a2<<aw1<ma_{1}<a_{2}<\cdots<a_{w-1}<m. When hh is large enough such that h>5mh>5m, we can embed m{\mathbb{Z}}_{m} into nk1{\mathbb{Z}}_{n-k-1} in a natural way so that AA is also a [w1][w-1]-free (nk1,w1)(n-k-1,w-1) modular Golomb ruler in nk1{\mathbb{Z}}_{n-k-1}. The following calculations are all in nk1{\mathbb{Z}}_{n-k-1}.

Let 𝒂i={(a1+i)2,(a2+i)1,(a3+i)1,,(aw1+i)1} for all ink1.\bm{a}_{i}=\{(a_{1}+i)_{2},(a_{2}+i)_{1},(a_{3}+i)_{1},\ldots,(a_{w-1}+i)_{1}\}\text{ for all }i\in{\mathbb{Z}}_{n-k-1}. Let 𝒮={𝒂i:ink1}\mathcal{S}^{\prime}=\{\bm{a}_{i}:i\in{\mathbb{Z}}_{n-k-1}\}. Replace the codeword 𝒂2m𝒮\bm{a}_{2m}\in\mathcal{S}^{\prime} by two other special ones of type 1w2211^{w-2}2^{1},

𝒔1={(a1+2m)2,(a2+2m)1,,(aw12+2m)1}{(r1)1,(r2)1,,(rw12)1},\bm{s}_{1}=\{(a_{1}+2m)_{2},(a_{2}+2m)_{1},\ldots,(a_{\frac{w-1}{2}}+2m)_{1}\}\cup\{(r_{1})_{1},(r_{2})_{1},\ldots,(r_{\frac{w-1}{2}})_{1}\},
𝒔2={(rw+12)1,,(rw2)1,(rw1)2}{(aw+12+2m)1,,(aw1+2m)1}.\bm{s}_{2}=\{(r_{\frac{w+1}{2}})_{1},\ldots,(r_{w-2})_{1},(r_{w-1})_{2}\}\cup\{(a_{\frac{w+1}{2}}+2m)_{1},\ldots,(a_{w-1}+2m)_{1}\}.

Let 𝒮=(𝒮\{𝒂2m}){𝒔1,𝒔2},\mathcal{S}=(\mathcal{S}^{\prime}\backslash\{\bm{a}_{2m}\})\cup\{\bm{s}_{1},\bm{s}_{2}\}, which is a set of nkn-k cliques of type 1w2211^{w-2}2^{1}. Define a set of edges E={ei:i[w12]}E=\{e_{i}:i\in[\frac{w-1}{2}]\} where ei=rirwie_{i}=r_{i}r_{w-i}. It is easy to see that eie_{i} is not contained in any clique of 𝒮\mathcal{S}. Then let S=(𝒂𝒮K𝒂)ES=\left(\cup_{\bm{a}\in\mathcal{S}}K_{\bm{a}}\right)\cup E and Gn=KnSG_{n}=K_{n}-S. We will show that 𝒮\mathcal{S} forms a packing of KnK_{n}, and GnG_{n} has a KwK_{w}-decomposition when nn is large enough.

Lemma IV.2.

The set 𝒮\mathcal{S} above forms a packing of KnK_{n}.

Proof.

Suppose not, then there are two different codewords 𝒂,𝒃𝒮\bm{a},\bm{b}\in\mathcal{S}, such that K𝒂K_{\bm{a}} and K𝒃K_{\bm{b}} share at least one edge. Since 𝒮\mathcal{S}^{\prime} is a packing, 𝒂\bm{a} and 𝒃\bm{b} cannot both belong to 𝒮\mathcal{S}^{\prime}. Furthermore, since h>5mh>5m and 2mai+2m3m<nk12m\leq a_{i}+2m\leq 3m<n-k-1 for each i[w1],i\in[w-1], the 2(w1)2(w-1) vertices rir_{i}, i[w1]i\in[w-1] and aj+2ma_{j}+2m, j[w1]j\in[w-1] are all distinct, that is to say {𝒂,𝒃}{𝒔1,𝒔2}\{\bm{a},\bm{b}\}\neq\{\bm{s}_{1},\bm{s}_{2}\}.

Suppose that 𝒂𝒮\{𝒂2m}\bm{a}\in\mathcal{S}^{\prime}\backslash\{\bm{a}_{2m}\} and 𝒃{𝒔1,𝒔2}\bm{b}\in\{\bm{s}_{1},\bm{s}_{2}\}. Since supp(𝒂)supp(\bm{a}) is a [w1][w-1]-free (nk1,w1)(n-k-1,w-1) modular Golomb ruler and each aia_{i}, i[w1]i\in[w-1] is less than mm while h>5mh>5m. The cliques 𝒔i\bm{s}_{i}, i=1,2i=1,2 never share any edge with 𝒂j\bm{a}_{j} for j2mj\neq 2m. So 𝒮\mathcal{S} forms a packing of Kn.K_{n}.

Lemma IV.3.

There exists an integer N=N(w)N=N(w) such that when h>N(w)h>N(w), GnG_{n} has a KwK_{w}-decomposition.

Proof.

If all conditions given in Remark II.1 hold, the proof is complete. For any vertex vv, if v=riv=r_{i} for iwk2i\leq w-k-2, it is contained in ww cliques of 𝒮\mathcal{S} and one edge in EE. So dGn(v)=n1w(w2)10mod(w1).d_{G_{n}}(v)=n-1-w(w-2)-1\equiv 0\mod(w-1). If v=riv=r_{i} for i>wk2i>w-k-2, vv is in one clique of 𝒮\mathcal{S} and one edge in EE. So dGn(v)=n1(w2)10mod(w1).d_{G_{n}}(v)=n-1-(w-2)-1\equiv 0\mod(w-1). If vV(Kn)\{ri}i[w1]v\in V(K_{n})\backslash\{r_{i}\}_{i\in[w-1]}, it is contained in w1w-1 cliques in 𝒮\mathcal{S}, and dGn(v)=n1(w1)(w2)0mod(w1).d_{G_{n}}(v)=n-1-(w-1)(w-2)\equiv 0\mod(w-1). Furthermore, for each vertex v[n]v\in[n], dGn(v)n12w2.d_{G_{n}}(v)\geq n-1-2w^{2}.

We check that e(Gn)e(Kw)\frac{e(G_{n})}{e(K_{w})} is an integer.

e(Gn)e(Kw)\displaystyle\frac{e(G_{n})}{e(K_{w})} =n(n1)(nk)(w1)(w2)(w1)w(w1)\displaystyle=\frac{n(n-1)-(n-k)(w-1)(w-2)-(w-1)}{w(w-1)}
=B(n)+(2k+1)(w1)+k(w1)(w2)(w1)w(w1)\displaystyle=B(n)+\frac{(2k+1)(w-1)+k(w-1)(w-2)-(w-1)}{w(w-1)}
=B(n)+k.\displaystyle=B(n)+k.

By Remark II.1, there exists an integer N=N(w)N=N(w) such that when h>N(w)h>N(w), the KwK_{w}-decomposition 𝒫\mathcal{P} of GG exists. ∎

We color all cliques in 𝒫\mathcal{P} as type 1w1^{w} and get a code 𝒫\mathcal{P} of B(n)+kB(n)+k codewords. By Corollary II.1, 𝒞=𝒮𝒫\mathcal{C}=\mathcal{S}\cup\mathcal{P} is an optimal (n,2w2,w)3(n,2w-2,w)_{3} code with size B(n)+nB(n)+n but not balanced. Combining the result above and Subsection III-A, we have proven the following theorem.

Theorem IV.3.

For any integer w5w\geq 5, there exists an integer N=N(w)N=N(w) such that for any n>Nn>N and n1mod(w1),n\equiv 1\mod(w-1), A3(n,2w2,w)=B(n)+nA_{3}(n,2w-2,w)=B(n)+n.

However, by Theorem IV.2, an optimal balanced (n,2w2,w)3(n,2w-2,w)_{3} code does not exist when n1mod(w1)n\equiv 1\mod(w-1), and n(n1)n(w1)(w2)(2k+1)(w1)modw(w1)n(n-1)-n(w-1)(w-2)\equiv(2k+1)(w-1)\mod w(w-1) for some k[0,w32]k\in[0,\frac{w-3}{2}].

V Constructions for ntmod(w1)n\equiv t\mod(w-1) with t[2,w2]t\in[2,w-2]

In this section, we show that an optimal balanced (n,2w2,w)3(n,2w-2,w)_{3} code exists for sufficiently large ntmod(w1)n\equiv t\mod(w-1) when t[2,w2]t\in[2,w-2]. Our method is similar to the cases when t=0,1t=0,1, that is, constructing a code 𝒮\mathcal{S} satisfying Lemma III.1, but is more complicated. Our main result is the following theorem.

Theorem V.1.

For any integers w5w\geq 5 and t[2,w2]t\in[2,w-2], there exists an integer N=N(w)N=N(w) such that for any n>Nn>N and ntmod(w1),n\equiv t\mod(w-1), there is a balanced (n,2w2,w)3(n,2w-2,w)_{3} code with size B(n)+nB(n)+n, that is A3(n,2w2,w)=B(n)+nA_{3}(n,2w-2,w)=B(n)+n.

V-A Strategy

When ww is fixed, let n=h(w1)+tn=h(w-1)+t for some t[2,w2]t\in[2,w-2] be a sufficiently large integer. With \ell defined in Equation (2), there are unique non-negative integers rr and kk such that 2=2k(w1)+2r2\ell=2k(w-1)+2r for 02r<2(w1)0\leq 2r<2(w-1) and 02k(w1)+2r<w(w1).0\leq 2k(w-1)+2r<w(w-1). In this sense, rr and kk are functions of nn with values smaller than w.w.

We apply operations (O1) kk times and (O2) rr times to digest the exceeding \ell edges, that is a=ka=k and b=rb=r. By Equation (4), Rm=wtR_{m}=w-t and R(v){wt,2wt1}R(v)\in\{w-t,2w-t-1\}. Then by Equation (5), c=h(wt)+k+t+2r(t1)tw1c=h(w-t)+k+t+\frac{2r-(t-1)t}{w-1}, which is a positive integer by Equation (2). So the desired numbers of codewords of types 1w1^{w}, 1w2211^{w-2}2^{1} and 1w4221^{w-4}2^{2} are x=B(n)+k+r,x=B(n)+k+r, y=nk2ry=n-k-2r and z=rz=r, respectively.

By Lemma III.1, it suffices to construct a code 𝒮\mathcal{S} consisting of nk2rn-k-2r codewords of type 1w2211^{w-2}2^{1} and rr codewords of type 1w4221^{w-4}2^{2} satisfying all conditions in Lemma III.1. The vertex set of KnK_{n} is defined as a union of three parts with the prescribed distribution of different values of R(v)R(v) in each part as follows.

  • (R1)

    Let h~=hw(w+2)\tilde{h}=h-w(w+2) and n=h~(w1)n^{\prime}=\tilde{h}(w-1), then the first part of V(Kn)V(K_{n}) is n{\mathbb{Z}}_{n^{\prime}}. There will be h~(wt)\tilde{h}(w-t) vertices in n{\mathbb{Z}}_{n^{\prime}} with R(v)=wtR(v)=w-t, and all others with R(v)=2wt1R(v)=2w-t-1.

  • (R2)

    Let BB be the second part consisting r(w2)r(w-2) vertices, which are b¯i\bar{b}_{i}, i[2r]i\in[2r] and bjb_{j}, j[r(w4)]j\in[r(w-4)]. All vertices in BB have R(v)=2wt1R(v)=2w-t-1.

  • (R3)

    Let CC be the third part consisting all remaining vertices, which are c¯i\bar{c}_{i}, i[ch~(wt)]i\in[c-\tilde{h}(w-t)] with R(v)=wtR(v)=w-t, and cjc_{j}, j[κ]j\in[\kappa] with R(v)=2wt1R(v)=2w-t-1. Here κ=nch~(t1)r(w2)\kappa=n-c-\tilde{h}(t-1)-r(w-2). Note that κ>k\kappa>k, and there will be kk vertices cjc_{j} that are not colored by 22 in the desired 𝒮\mathcal{S}.

Note that in this setting, the number of vertices with R(v)=wtR(v)=w-t is exactly cc, and with R(v)=2wt1R(v)=2w-t-1 is ncn-c. See Fig. 1 for an illustration of the vertices and R(v)R(v). Our strategy of constructing 𝒮\mathcal{S} is as follows.

Refer to caption
Figure 1: Three parts of V(Kn)V(K_{n}) with the corresponding R(v)R(v)

First, we construct an (n,2w2,w)3(n^{\prime},2w-2,w)_{3} code \mathcal{H} over n{\mathbb{Z}}_{n^{\prime}} consisting of nn^{\prime} codewords of type 1w2211^{w-2}2^{1}, such that the requirement of R(v)R(v) in (R1) is satisfied. See Construction V.1 and Proposition V.1 for details of \mathcal{H}. View \mathcal{H} as a code of length nn over the vertex set of KnK_{n}. Note that \mathcal{H} colors each vertex in n{\mathbb{Z}}_{n^{\prime}} by 22 exactly once.

Second, we construct rr codewords of type 1w4221^{w-4}2^{2}

𝒛i={(b¯2i1)2,(b¯2i)2}{(b(w4)(i1)+1)1,(b(w4)(i1)+2)1,,(b(w4)i)1}, for all i[r],\bm{z}_{i}=\{(\bar{b}_{2i-1})_{2},(\bar{b}_{2i})_{2}\}\cup\{(b_{(w-4)(i-1)+1})_{1},(b_{(w-4)(i-1)+2})_{1},\ldots,(b_{(w-4)i})_{1}\},\text{ for all }i\in\left[r\right],

whose supports form a partition of the set BB. Let 𝒵={𝒛i:i[r]}.\mathcal{Z}=\{\bm{z}_{i}:i\in[r]\}. Each b¯i,i[2r]\bar{b}_{i},i\in[2r] is colored by 22 exactly once.

Third, construct an m×(w1)m\times(w-1) array MM with entries in BCB\cup C, where m=r(w4)+|C|k=nn2rkm=r(w-4)+|C|-k=n-n^{\prime}-2r-k, such that

  • the first column of MM covers each vertex bjb_{j}, j[r(w4)]j\in[r(w-4)], and each vertex in CC except some kk vertices cjc_{j} exactly once.

  • the number of occurrence of each vv in MM is R(v)2R(v)-2 if vBv\in B, and is R(v)R(v) if vCv\in C, where R(v)R(v) is defined in (R2) and (R3).

Such an array MM exists by simply checking the equality m(w1)=vB(R(v)2)+vCR(v)m(w-1)=\sum_{v\in B}(R(v)-2)+\sum_{v\in C}R(v). Each row of MM will serve as a candidate of a codeword of type 1w2211^{w-2}2^{1} by coloring the first element by 22 and all others by 11. However, the current MM is not valid since each row may have repeated elements. Let \mathcal{M} denote the collection of colored rows of the current MM. We would like to do some operations of \mathcal{M}\sqcup\mathcal{H}, so that finally, 𝒵\mathcal{M}\sqcup\mathcal{H}\sqcup\mathcal{Z} will give the desired 𝒮\mathcal{S}. The symbol \sqcup means the disjoint union of collections.

Before presenting our algorithms of the operations of \mathcal{M}\sqcup\mathcal{H} in SectionV-C, we give a construction of \mathcal{H}.

V-B Construction of \mathcal{H} and its Properties

Construction V.1.

Suppose that h~>2w3\tilde{h}>2w^{3}. Start from an (h~,w1)(\tilde{h},w-1) modular Golomb ruler {a0=0,a1,a2,,aw2}\{a_{0}=0,a_{1},a_{2},\ldots,a_{w-2}\}, and view it as a subset in n{\mathbb{Z}}_{n^{\prime}}, where n=h~(w1)n^{\prime}=\tilde{h}(w-1). The code \mathcal{H} consisting of nn^{\prime} codewords of type 1w2211^{w-2}2^{1} is constructed below.

  • (1)

    For each i[0,t2]i\in[0,t-2] and j[0,h~1],j\in[0,\tilde{h}-1], let

    𝒂i,j={(j(w1)+i)1,((a1+j)(w1)+i)1,,((aw3+j)(w1)+i)1,((aw2+j)(w1)+i)2}.\bm{a}_{i,j}=\{(j(w-1)+i)_{1},((a_{1}+j)(w-1)+i)_{1},\ldots,((a_{w-3}+j)(w-1)+i)_{1},((a_{w-2}+j)(w-1)+i)_{2}\}.
  • (2)

    For each i[0,wt1]i\in[0,w-t-1] and j[0,h~1]j\in[0,\tilde{h}-1], let

    supp(𝒃i,j)={(i+j)(w1),(2i+j)(w1)+1,(3i+j)(w1)+2,,((w1)i+j)(w1)+w2},supp(\bm{b}_{i,j})=\{(i+j)(w-1),(2i+j)(w-1)+1,(3i+j)(w-1)+2,\ldots,((w-1)i+j)(w-1)+w-2\},

    where the vertex ((t+i)i+j)(w1)+(t+i1)((t+i)i+j)(w-1)+(t+i-1) is colored by 22 and all other vertices are colored by 11.

Then ={𝐚i,j:i[0,t2],j[0,h~1]}{𝐛i,j:i[0,wt1],j[0,h~1]}.\mathcal{H}=\{\bm{a}_{i,j}:i\in[0,t-2],j\in[0,\tilde{h}-1]\}\cup\{\bm{b}_{i,j}:i\in[0,w-t-1],j\in[0,\tilde{h}-1]\}. It is easy to verify that each vertex in n{\mathbb{Z}}_{n^{\prime}} is colored by 2 exactly once in \mathcal{H}.

Proposition V.1.

The code \mathcal{H} in Construction V.1 is an (n,2w2,w)3(n^{\prime},2w-2,w)_{3} code. Further, there are exactly h~(wt)\tilde{h}(w-t) vertices in n{\mathbb{Z}}_{n^{\prime}} with R(v)=wtR(v)=w-t, and all others with R(v)=2wt1R(v)=2w-t-1, which satisfies the requirement of R(v)R(v) in (R1).

Proof.

For any vertex vnv\in\mathbb{Z}_{n^{\prime}}, there are exactly wtw-t cliques 𝒃i,j\bm{b}_{i,j} containing vv. Let vimod(w1)v\equiv i\mod(w-1) for some i[0,w2]i\in[0,w-2]. If ii is in [0,t2],[0,t-2], then vv is contained in exactly w1w-1 cliques 𝒂i,j\bm{a}_{i,j}, otherwise vv does not appear in any clique of 𝒂i,j.\bm{a}_{i,j}. This proves the distribution of R(v)R(v).

It is left to prove that the collection of all supports of codewords in 𝒞\mathcal{C} forms a packing. Here are five cases.

  • (1)

    By modular Golomb ruler, for any 0jjh~10\leq j\neq j^{\prime}\leq\tilde{h}-1 and i[0,t2],i\in[0,t-2], |supp(𝒂i,j)supp(𝒂i,j)|1.|supp(\bm{a}_{i,j})\cap supp(\bm{a}_{i,j^{\prime}})|\leq 1.

  • (2)

    Since any vertex of supp(𝒂i,j)supp(\bm{a}_{i,j}) modulo (w1)(w-1) equals ii, then for any 0i1i2t20\leq i_{1}\neq i_{2}\leq t-2 with any jj and jj^{\prime}, |supp(𝒂i1,j)supp(𝒂i2,j)|=0.|supp(\bm{a}_{i_{1},j})\cap supp(\bm{a}_{i_{2},j^{\prime}})|=0.

  • (3)

    It is easy to see that |supp(𝒃i,j)supp(𝒃i,j)|=0|supp(\bm{b}_{i,j})\cap supp(\bm{b}_{i,j^{\prime}})|=0 for any 0jjh~1.0\leq j\neq j^{\prime}\leq\tilde{h}-1.

  • (4)

    For any 0i1<i2wt10\leq i_{1}<i_{2}\leq w-t-1 and 0j,jh~10\leq j,j^{\prime}\leq\tilde{h}-1, we also have |supp(𝒃i1,j)supp(𝒃i2,j)|1.|supp(\bm{b}_{i_{1},j})\cap supp(\bm{b}_{i_{2},j^{\prime}})|\leq 1. Otherwise, there exists a pair (s1,s2)(s_{1},s_{2}) from [w1][w-1] with s1<s2s_{1}<s_{2} such that the following two equations hold:

    (s1i1+j)(w1)+s11(s1i2+j)(w1)+s11modn;(s_{1}i_{1}+j)(w-1)+s_{1}-1\equiv(s_{1}i_{2}+j^{\prime})(w-1)+s_{1}-1\mod n^{\prime};
    (s2i1+j)(w1)+s21(s2i2+j)(w1)+s21modn.(s_{2}i_{1}+j)(w-1)+s_{2}-1\equiv(s_{2}i_{2}+j^{\prime})(w-1)+s_{2}-1\mod n^{\prime}.

    We calculate the differences of these two equations on both side and get (s2s1)(i2i1)0modh~.(s_{2}-s_{1})(i_{2}-i_{1})\equiv 0\mod\tilde{h}. However, 0(s2s1)(i2i1)(w2)(wt1)<2w2<h~0\leq(s_{2}-s_{1})(i_{2}-i_{1})\leq(w-2)(w-t-1)<2w^{2}<\tilde{h}, a contradiction.

  • (5)

    For any 0it20\leq i\leq t-2, 0iwt10\leq i^{\prime}\leq w-t-1 and 0j,jh10\leq j,j^{\prime}\leq h-1, we have |𝒂i,j𝒃i,j|1.|\bm{a}_{i,j}\cap\bm{b}_{i^{\prime},j^{\prime}}|\leq 1. That is because all vertices in supp(𝒂i,j)supp(\bm{a}_{i,j}) are the same while all vertices of supp(𝒃i,j)supp(\bm{b}_{i^{\prime},j^{\prime}}) are pairwise different after modulo (w1).(w-1).

V-C Constructing 𝒮\mathcal{S}

Let \mathcal{H}, 𝒵\mathcal{Z}, \mathcal{M} and MM be defined as before. By abuse of notation, we also use 𝒵\mathcal{Z}, \mathcal{M}, and \mathcal{H} to denote the corresponding collections of unlabeled (multi) subsets of V(Kn)V(K_{n}). We express \mathcal{H} as row vectors of an n×(w1)n^{\prime}\times(w-1) array HH with each row being the support of a codeword in \mathcal{H}, where the only vertex labeled by 22 is always located in the first column. Let M¯\bar{{M}}, H¯\bar{H} be obtained from MM and HH by deleting the first column.

Let 𝒮\mathcal{S}^{\prime} be the disjoint union of the collections \mathcal{H}, 𝒵\mathcal{Z} and \mathcal{M}, denoted by 𝒮=𝒵\mathcal{S}^{\prime}=\mathcal{H}\sqcup\mathcal{Z}\sqcup\mathcal{M}. Observe that if we can make 𝒮\mathcal{S}^{\prime} an (n,2w2,w)3(n,2w-2,w)_{3} code by only exchanging entries in M¯\bar{{M}} and H¯\bar{H}, then the resultant code will satisfy all conditions of Lemma III.1, that is, contain b=rb=r codewords of type 1w4221^{w-4}2^{2} whose supports are pairwise disjoint (codewords in 𝒵\mathcal{Z}), contain na2b=nk2rn-a-2b=n-k-2r codewords of type 1w2211^{w-2}2^{1} (codewords in modified \mathcal{H}\sqcup\mathcal{M}), and has exactly cc vertices with R(v)=Rm=wtR(v)=R_{m}=w-t and all others with R(v)=Rm+w1R(v)=R_{m}+w-1. Since each vertex is colored by 22 in 𝒮\mathcal{S}^{\prime} exactly once except kk vertices cjc_{j}, by Corollary II.1, it suffices to exchange entries in M¯\bar{{M}} and H¯\bar{H} so that there are no repeated entries in each member of \mathcal{M}\sqcup\mathcal{H} and no common pairs among all members of 𝒵\mathcal{H}\sqcup\mathcal{Z}\sqcup\mathcal{M}. The initial state of 𝒵\mathcal{H}\sqcup\mathcal{Z} is already an (n,2w2,w)3(n,2w-2,w)_{3} code, so we can do this exchange one by one on all entries of M¯\bar{{M}} with a natural order.

In the algorithm to follow, all our operations are supposed to exchange some entry in M¯\bar{{M}} and some entry in H¯\bar{H} only. Let 𝒎i\bm{m}_{i} denote the iith row of MM, and let mi,jm_{i,j} be the (i,j)(i,j)th entry of MM. Suppose that we have modified all entries mi,jm_{i^{\prime},j^{\prime}} with 1i<i1\leq i^{\prime}<i for any 2jw12\leq j^{\prime}\leq w-1, and mi,jm_{i,j^{\prime}} for 2j<j2\leq j^{\prime}<j, such that

  • (h1)

    the updated {𝒎i:i<i}\mathcal{H}\sqcup\{\bm{m}_{i^{\prime}}:i^{\prime}<i\} has no repeated vertex in each element;

  • (h2)

    the updated entries mi,1,mi,2,,mi,j1m_{i,1},m_{i,2},\ldots,m_{i,j-1} are pairwise distinct;

  • (h3)

    the updated multiset 𝒵{𝒎i:i<i}{{mi,j:j<j}}\mathcal{H}\sqcup\mathcal{Z}\sqcup\{\bm{m}_{i^{\prime}}:i^{\prime}<i\}\sqcup\{\{m_{i,j^{\prime}}:j^{\prime}<j\}\} is a set, and further a packing over V(Kn)V(K_{n}).

Now we focus on the entry mi,jm_{i,j}. If the following properties (p1)-(p3) are already satisfied, we do nothing but change jj+1j\rightarrow j+1 if j<w1j<w-1, or change ii+1i\rightarrow i+1 and j2j\rightarrow 2 if j=w1j=w-1. Otherwise, we need to find an entry \hbar in the current H¯\bar{H}, so that exchanging mi,jm_{i,j} and \hbar will result in that

  • (p1)

    the updated {𝒎i:i<i}\mathcal{H}\sqcup\{\bm{m}_{i^{\prime}}:i^{\prime}<i\} have no repeated vertex in each element;

  • (p2)

    the updated entries mi,1,mi,2,,mi,jm_{i,1},m_{i,2},\ldots,m_{i,j} are pairwise distinct;

  • (p3)

    the updated multiset 𝒵{𝒎i:i<i}{{mi,j:jj}}\mathcal{H}\sqcup\mathcal{Z}\sqcup\{\bm{m}_{i^{\prime}}:i^{\prime}<i\}\sqcup\{\{m_{i,j^{\prime}}:j^{\prime}\leq j\}\} is a set, and further a packing over V(Kn)V(K_{n}).

The properties (p1)-(p3) will be used as the new (h1)-(h3) in the next step of modification. We claim that the existence of \hbar is always possible for fixed ww and sufficiently large nn. We give the proof below.

The number mm of rows of MM is m=t+w(w+2)(w1)2rk2w3m=t+w(w+2)(w-1)-2r-k\leq 2w^{3}, so the set TT of distinct entries in any updated MM is of size at most 2w42w^{4}. Each vertex of TT can appear in at most Rm+w1=2wt1R_{m}+w-1=2w-t-1 members of 𝒵\mathcal{H}\sqcup\mathcal{Z}\sqcup\mathcal{M}, so the set NN of vertices in V(Kn)V(K_{n}) appearing in the same member of 𝒵\mathcal{H}\sqcup\mathcal{Z}\sqcup\mathcal{M} with some vertex in TT is of size at most 2w4(2wt1)(w1)4w62w^{4}\cdot(2w-t-1)\cdot(w-1)\leq 4w^{6}. All vertices in NN appear in at most 4w6(2wt1)8w74w^{6}\cdot(2w-t-1)\leq 8w^{7} members of 𝒵\mathcal{H}\sqcup\mathcal{Z}\sqcup\mathcal{M}. Since 8w7=O(1)8w^{7}=O(1) when nn goes to infinity, ||=Θ(n)|\mathcal{H}|=\Theta(n), there is at least one codeword of \mathcal{H} containing no vertex in NN. Choose such a codeword 𝒂\bm{a}\in\mathcal{H} and a vertex supp(𝒂)\hbar\in supp(\bm{a}) that is colored by 11. It is clear that \hbar is an entry of H¯\bar{H}. Let 𝒂\bm{a} be modified by replacing \hbar with mi,jm_{i,j}, and update \mathcal{H}. Replace mi,jm_{i,j} by \hbar and update MM. We show that the three properties (p1)–(p3) follow after this round of updating.

In fact, by the disjointness between supp(𝒂)supp(\bm{a}) and NN, supp(𝒂)supp(\bm{a}) contains no vertices from MM. Thus properties (p1) and (p2), and the part of telling the multiset is a set in property (p3) are obvious. The only thing need to prove is the packing property in (p3). For convenience, let 𝒞\mathcal{C} be the collection 𝒵{𝒎i:i<i}{{mi,j:j<j}}\mathcal{H}\sqcup\mathcal{Z}\sqcup\{\bm{m}_{i^{\prime}}:i^{\prime}<i\}\sqcup\{\{m_{i,j^{\prime}}:j^{\prime}<j\}\} before exchanging mi,jm_{i,j} and \hbar, and let 𝒞¯\mathcal{\bar{C}} be 𝒵{𝒎i:i<i}{{mi,j:jj}}\mathcal{H}\sqcup\mathcal{Z}\sqcup\{\bm{m}_{i^{\prime}}:i^{\prime}<i\}\sqcup\{\{m_{i,j^{\prime}}:j^{\prime}\leq j\}\} after the exchange. If (p3) is false, there exist two vertices uu and vv in V(Kn)V(K_{n}) such that at least two different elements, denoted as 𝒖\bm{u} and 𝒗\bm{v}, in 𝒞¯\mathcal{\bar{C}} contain both of them. If mi,jm_{i,j} and \hbar are both out of {u,v}\{u,v\}, the number of members in 𝒞¯\mathcal{\bar{C}} containing both uu and vv is the same as that in 𝒞\mathcal{C}. By induction hypothesis 𝒞\mathcal{C} is already a packing and thus such two elements 𝒖\bm{u} and 𝒗\bm{v} do not exist. As for the case when {u,v}\{u,v\} contains at least one vertex of mi,jm_{i,j} and \hbar, contradiction can be derived directly by that supp(𝒂)supp(\bm{a}) is disjoint from NN.

Finally, we complete the proof by showing the initial hypothesis holds. When i=1i=1 and j=2j=2, no entries of MM need to be modified before. So properties (h1)-(h3) are satisfied naturally from our constructions of \mathcal{H} and 𝒵\mathcal{Z}. Thus we can find an \hbar to exchange m1,2m_{1,2} such that (p1)-(p3) are satisfied, which will be used as the new (h1)-(h3) when we modify m1,3m_{1,3}. Continuing this exchanging algorithm until we modify all entries in M¯\bar{{M}}, so that the modified 𝒵\mathcal{H}\sqcup\mathcal{Z}\sqcup\mathcal{M} is a packing over V(Kn)V(K_{n}). Then 𝒮\mathcal{S} is the set 𝒵\mathcal{H}\cup\mathcal{Z}\cup\mathcal{M} with the prescribed color structures.

VI Conclusion

In this paper we study ternary constant weight codes in 1\ell_{1}-metric for any given length nn, weight ww and minimum distance 2w2.2w-2. We show that the upper bound on the maximum size of an (n,2w2,w)3(n,2w-2,w)_{3} code in [30] can be achieved for all sufficiently large nn. Our main result is stated below by combining all results in Theorems IV.1, IV.3 and V.1.

Theorem VI.1.

For any integer w5w\geq 5, there exists an integer N=N(w)N=N(w) such that for any n>Nn>N, A3(n,2w2,w)=B(n)+nA_{3}(n,2w-2,w)=B(n)+n. Further, there exists an optimal (n,2w2,w)3(n,2w-2,w)_{3} code that is balanced if and only if the following does not happen.

  • The weight ww is odd, n1mod(w1)n\equiv 1\mod(w-1) and n(n1)n(w1)(w2)(2k+1)(w1)modw(w1)n(n-1)-n(w-1)(w-2)\equiv(2k+1)(w-1)\mod w(w-1) for some integer kk such that 2k+1[0,w1].2k+1\in[0,w-1].

The optimal codes that we construct only contain codewords of types 1w1^{w}, 1w2211^{w-2}2^{1} and 1w4221^{w-4}2^{2}. The method we use is transferring the problem of finding an optimal (n,2w2,w)3(n,2w-2,w)_{3} code to the problem of finding a packing of KnK_{n} of the same size by colored cliques with extra restrictions. We use BB-free modular Golomb rulers to find a packing 𝒮\mathcal{S} with size no more than nn of colored cliques to produce all codewords of types 1w2211^{w-2}2^{1} and 1w4221^{w-4}2^{2}. Our constructions of 𝒮\mathcal{S} satisfy the conditions of Lemma III.1, so that Kn(𝒂𝒮K𝒂)K_{n}\setminus(\cup_{\bm{a}\in\mathcal{S}}K_{\bm{a}}) has a KwK_{w}-decomposition by Theorem II.1 when nn is large enough, which produces all codewords of type 1w1^{w}.

Our method works well on the distance 2w22w-2. However, it does not work when the minimum distance d<2w2.d<2w-2. Meanwhile, since the existence of a KwK_{w}-decomposition in Theorem II.1 is not explicit, efficient algorithms to find out an optimal (n,2w2,w1)3(n,2w-2,w-1)_{3} code in polynomial time are in need. We leave these problems for future study.

References

  • [1] A. Barg and A. Mazumdar, “Codes in permutations and error correction for rank modulation,” IEEE Transactions on Information Theory, vol. 56, no. 7, pp. 3158–3165, 2010.
  • [2] A. Jiang, H. Li, and Y. Wang, “Error scrubbing codes for flash memories,” in 2009 11th Canadian Workshop on Information Theory.   IEEE, 2009, pp. 32–35.
  • [3] L. G. Tallini and B. Bose, “On l1l_{1}-distance error control codes,” in 2011 IEEE International Symposium on Information Theory Proceedings.   IEEE, 2011, pp. 1061–1065.
  • [4] H. Zhou, M. Schwartz, A. A. Jiang, and J. Bruck, “Systematic error-correcting codes for rank modulation,” IEEE Transactions on Information Theory, vol. 61, no. 1, pp. 17–32, 2014.
  • [5] F. Farnoud, V. Skachek, and O. Milenkovic, “Error-correction in flash memories via codes in the ulam metric,” IEEE Transactions on Information Theory, vol. 59, no. 5, pp. 3003–3020, 2013.
  • [6] G. Kabatiansky and S. Kruglik, “On codes correcting constant number of errors in l1l_{1} metric,” in Sbornik trudov 39-æmezhdisciplinarnoæxkody-konferencii IPPI RAN “Informacionnye tehnologii i sistemy 2015”, 2015, pp. 152–157.
  • [7] S. Jain, F. F. Hassanzadeh, M. Schwartz, and J. Bruck, “Duplication-correcting codes for data storage in the DNA of living organisms,” IEEE Transactions on Information Theory, vol. 63, no. 8, pp. 4996–5010, 2017.
  • [8] E. Lander, L. Linton, B. Birren, C. Nusbaum, M. Zody, J. Baldwin, K. Devon, K. Dewar, M. Doyle, W. FitzHugh et al., “Initial sequencing and analysis of the human genome.” Nature, vol. 409, no. 6822, pp. 860–921, 2001.
  • [9] M. Kovačević and V. Y. F. Tan, “Asymptotically optimal codes correcting fixed-length duplication errors in DNA storage systems,” IEEE Communications Letters, vol. 22, no. 11, pp. 2194–2197, 2018.
  • [10] A. Lenz, N. Jünger, and A. Wachter-Zeh, “Bounds and constructions for multi-symbol duplication error correcting codes,” arXiv preprint arXiv:1807.02874, 2018.
  • [11] Y. Tang, Y. Yehezkeally, M. Schwartz, and F. F. Hassanzadeh, “Single-error detection and correction for duplication and substitution channels,” in 2019 IEEE International Symposium on Information Theory (ISIT).   IEEE, 2019, pp. 300–304.
  • [12] Y. Yehezkeally and M. Schwartz, “Reconstruction codes for DNA sequences with uniform tandem-duplication errors,” IEEE Transactions on Information Theory, pp. 1–1, 2019.
  • [13] R. Graham and N. Sloane, “Lower bounds for constant weight codes,” IEEE Transactions on Information Theory, vol. 26, no. 1, pp. 37–43, 1980.
  • [14] A. Brouwer, J. Shearer, N. Sloane, and W. Smith, “A new table of constant weight codes,” IEEE Transactions on Information Theory, vol. 36, no. 6, pp. 1334–1380, 1990.
  • [15] E. Agrell, A. Vardy, and K. Zeger, “Upper bounds for constant-weight codes,” IEEE Transactions on Information Theory, vol. 46, no. 7, pp. 2373–2395, 2000.
  • [16] H. Zhang, X. Zhang, and G. Ge, “Optimal ternary constant-weight codes with weight 4 and distance 5,” IEEE Transactions on Information Theory, vol. 58, no. 5, pp. 2706–2718, 2012.
  • [17] Y. M. Chee, H. Zhang, and X. Zhang, “Complexity of dependences in bounded domains, Armstrong codes, and generalizations,” IEEE Transactions on Information Theory, vol. 61, no. 2, pp. 812–819, 2014.
  • [18] Y. M. Chee, G. Ge, H. Zhang, and X. Zhang, “Hanani triple packings and optimal qq-ary codes of constant weight three,” Designs, Codes and Cryptography, vol. 75, no. 3, pp. 387–403, 2015.
  • [19] Y. M. Chee and X. Zhang, “Linear size constant-composition codes meeting the Johnson bound,” IEEE Transactions on Information Theory, vol. 64, no. 2, pp. 909–917, 2017.
  • [20] Y. M. Chee, H. M. Kiah, H. Zhang, and X. Zhang, “Constructions of optimal and near-optimal multiply constant-weight codes,” IEEE Transactions on Information Theory, vol. 63, no. 6, pp. 3621–3629, 2017.
  • [21] Y. M. Chee, F. Gao, H. M. Kiah, A. C. Hung Ling, H. Zhang, and X. Zhang, “Decompositions of edge-colored digraphs: A new technique in the construction of constant-weight codes and related families,” SIAM Journal on Discrete Mathematics, vol. 33, no. 1, pp. 209–229, 2019.
  • [22] H. Cao, L. Ji, and L. Zhu, “Constructions for generalized steiner systems GS(3, 4, v, 2),” Designs, Codes and Cryptography, vol. 45, pp. 185–197, 2007.
  • [23] H. Zhang and G. Ge, “Optimal ternary constant-weight codes of weight four and distance six,” IEEE Transactions on Information Theory, vol. 56, no. 5, pp. P.2188–2203, 2010.
  • [24] G. Bogdanova, “New bounds for the maximum size of ternary constant weight codes,” Serdica Math J, vol. 26, no. 1, pp. 5–12, 2000.
  • [25] D. J. Costello and G. D. Forney, “Channel coding: The road to channel capacity,” Proceedings of the IEEE, vol. 95, no. 6, pp. 1150–1177, 2007.
  • [26] O. D. King, “Bounds for DNA codes with constant GC-content,” The Electronic Journal of Combinatorics, vol. 10, no. 1, p. 33, 2003.
  • [27] O. Milenkovic and N. Kashyap, “On the design of codes for DNA computing,” in International Workshop on Coding and Cryptography.   Springer, 2005, pp. 100–119.
  • [28] M. Kovačević and V. Y. F. Tan, “Codes in the space of multisets-coding for permutation channels with impairments,” IEEE Transactions on Information Theory, vol. 64, no. 7, pp. 5156–5169, 2018.
  • [29] H. Jinushi and K. Sakaniwa, “A construction method for multilevel error-correcting codes based on absolute summation weight,” in Abst. 1990 IEEE Int. Symp. Inform. Theory, 1990, p. 87.
  • [30] T. Chen, Y. Ma, and X. Zhang, “Optimal codes with small constant weight in l1l_{1}-metric,” arXiv preprint arXiv:2003.00483v2, 2020.
  • [31] N. Alon, Y. Caro, and R. Yuster, “Packing and covering dense graphs,” Journal of Combinatorial Designs, vol. 6, no. 6, pp. 451–472, 1998.
  • [32] J. B. Shearer, “Difference triangle sets,” in Handbook of Combinatorial Designs.   Chapman and Hall/CRC, 2006, pp. 436–440.