Rings associated to coverings of finite $p$-groups

In general the endomorphisms of a nonabelian group do not form a ring under the operations of addition and composition of functions. Several papers have dealt with the ring of functions defined on a group, which are endomorphisms when restricted to the elements of a cover of the group by abelian subgroups. We give an algorithm that allows us to determine the elements of the ring of functions of a finite $p$-group that arises in this manner when the elements of the cover are required to be either cyclic or elementary abelian of rank $2$. This enables us to determine the actual structure of such a ring as a subdirect product. A key part of the argument is the construction of a graph whose vertices are the subgroups of order $p$ and whose edges are determined by the covering.