EN
The power graph of a finite group is the graph whose vertex set is the group, two distinct elements being adjacent if one is a power of the other. The enhanced power graph of a finite group is the graph whose vertex set consists of all elements of the group, in which two vertices are adjacent if they generate a cyclic subgroup. In this paper, we give a complete description of finite groups with enhanced power graphs admitting a perfect code. In addition, we describe all groups in the following two classes of finite groups: the class of groups with power graphs admitting a total perfect code, and the class of groups with enhanced power graphs admitting a total perfect code. Furthermore, we characterize several families of finite groups with power graphs admitting a perfect code, and several other families of finite groups with power graphs which do not admit perfect codes.