Abstract
We present a novel technique for encoding and decoding constant weight binary codes that uses a geometric interpretation of the codebook. Our technique is based on embedding the codebook in a Euclidean space of dimension equal to the weight of the code. The encoder and decoder mappings are then interpreted as a bijection between a certain hyper-rectangle and a polytope in this Euclidean space. An inductive dissection algorithm is developed for constructing such a bijection. We prove that the algorithm is correct and then analyze its complexity. The complexity depends on the weight of the code, rather than on the block length as in other algorithms. This approach is advantageous when the weight is smaller than the square root of the block length.
Introduction
Constant-weight codes—where every codeword of length $n$ contains exactly $w$ ones—are essential for applications like fault-tolerant circuit design, optical networks, and pattern generation for testing. The primary challenge in utilizing these codes lies in "ranking" and "unranking": efficiently mapping a block of information bits to a specific constant-weight codeword and back again.
Existing techniques, such as enumerative coding or Knuth’s complementation method, typically have a computational complexity of $O(n)$. While effective for balanced codes (where $w \approx n/2$), these methods become computationally expensive for very long codewords with low weights. This paper introduces a novel geometric method for encoding and decoding constant-weight binary codes by treating the problem as a polyhedral dissection, aiming for an algorithm whose complexity scales with the weight $w$ rather than the total length $n$.
Methodology
The proposed technique represents codewords as points in a $w$-dimensional Euclidean space. The process involves two primary steps:
- Geometric Embedding: Codeword indices are normalized to fit within a specific polytope called a unit orthoscheme ($T_w$). The input information is represented as a point within a $w$-dimensional hyper-rectangle, or "brick" ($B_w$).
- Polyhedral Dissection: The core of the technique is an inductive algorithm that "dissects" the brick and reassembles it into the orthoscheme. This is a discrete application of Hilbert’s third problem, which concerns the equidecomposability of polyhedra. The authors leverage the Dehn-Sydler theorem to show that because the "brick" and the "orthoscheme" have zero Dehn invariants, a dissection is always possible.
The mapping is built recursively. To solve for weight $w$, the algorithm uses the solution for weight $w-1$ and applies a specific "cut-and-paste" operation to handle the $w$-th dimension. Despite the high-dimensional geometry, the actual implementation involves simple coordinate shifts and comparisons.
Results and Discussion
The geometric approach yields several significant advantages over traditional methods:
- Computational Complexity: The algorithm achieves a complexity of $O(w^2)$. This makes it significantly more efficient than standard $O(n)$ methods whenever the weight $w$ is smaller than the square root of the block length ($w < \sqrt{n}$). By focusing on weight as the primary complexity driver, the algorithm becomes effectively "length-independent."
- Rate Efficiency: The method is nearly fully efficient. For example, with a block length $n=529$ and weight $w=23$, the rate loss is only about 2 bits per block compared to the theoretical maximum. As shown in the efficiency plot below, the asymptotic efficiency ($\bar{\eta}$) converges toward 1 as the block length increases.
However, the $O(w^2)$ complexity means this approach is less competitive for "balanced" codes where $w \approx n/2$, where $O(n)$ methods like Knuth's remain superior. Additionally, implementing the algorithm with discrete integers leads to a small rounding loss in the information rate, typically between 1 and 3 bits per block.
Conclusion
This paper presents a paradigm shift in constant-weight coding by moving from combinatorial to geometric interpretations. By leveraging polyhedral dissections, the authors provide an efficient $O(w^2)$ solution for low-weight codes. Future work may explore the recursive structure of the algorithm for parallel processing, which could further reduce computation time in hardware implementations.
Summary updated