TOPICS
Search

Perfect Code


A perfect code is an error-correcting code whose error-correction balls partition the space of words. Let C be an error-correcting code consisting of N codewords, in which each codeword consists of n letters taken from an alphabet A of length q, and every two distinct codewords differ in at least d=2e+1 places. Then C is said to be perfect if for every possible word w_0 of length n with letters in A, there is a unique code word w in C in which at most e letters of w differ from the corresponding letters of w_0.

It is straightforward to show that C is perfect if

 sum_(i=0)^e(n; i)(q-1)^i=(q^n)/N.

If C is a binary linear code, then q=2 and N=2^k, where k is the number of generators of C, in which case C is perfect if

 sum_(i=0)^e(n; i)=2^(n-k).

Among nontrivial linear codes over finite fields, the perfect codes are the Hamming codes and Golay codes (MacWilliams and Sloane 1977).

In the Johnson graph metric, a nontrivial perfect code would instead partition the constant-weight words into equal-radius balls. Zhang and Zhong (2026) proved that no nontrivial e-perfect codes exist in the Johnson scheme for e=1, 2, 4, 9, 10, 12, or 16. Together with the previously settled radii, this proves the conjecture that the Johnson scheme has no nontrivial perfect codes.

The same partition principle applies to the graph distance in a graph. A perfect 1-code in this setting is an efficient dominating set, whose closed neighborhoods partition the vertex set (Biggs 1973).


See also

Covering Code, Error-Correcting Code, Golay Code, Hamming Code, Nearly Perfect Code, Quasi-Perfect Code

Portions of this entry contributed by David Terr

Explore with Wolfram|Alpha

References

Biggs, N. L. "Perfect Codes in Graphs." J. Combin. Th. Ser. B 15, 289-296, 1973. https://doi.org/10.1016/0095-8956(73)90042-7.MacWilliams, F. J. and Sloane, N. J. A. The Theory of Error-Correcting Codes. Amsterdam, Netherlands: North-Holland, 1977.Roman, S. Coding and Information Theory. New York: Springer-Verlag, 1992.van Lint, J. H. An Introduction to Coding Theory, 2nd ed. New York: Springer-Verlag, 1992.Zhang, X. and Zhong, W. "The Last Seven Open Radii for Perfect Codes in the Johnson Scheme." 20 Sep 2026. https://arxiv.org/abs/2609.23368.

Referenced on Wolfram|Alpha

Perfect Code

Cite this as:

Weisstein, Eric W., with contributions by David Terr. "Perfect Code." From MathWorld--A Wolfram Resource. https://mathworld.wolfram.com/PerfectCode.html

Subject classifications