Generalising the adjustments to the Trace of the Adjacency matrix to find the number of genuine loops of a particular size in an undirected network?
It’s relatively easy to see that, for a network with Adjacency matrix A, the number of 3-loops is (1/6)Tr(A^3).