I have been trying to calculate cycles cycles in undirected graphs and I have read this article which has really helped but I'm still seeking a shorter way to calculate matrix power traces(it is needed in the formula).
ON THE NUMBER OF CYCLES IN A GRAPH FRANK HARARY, BENNET MANVEL, Ann Arbor, Michigan, U.S.A
so for second power of the adjacency matrix the trace is equal to sum of all elements. but for other powers I haven't found anything special. this paper provides a method only for complete matrices. I think according to the fact that adjacency matrices are symmetric and the elements on the diagonal are all zero there should be some simpler way to find trace. Trace of Positive Integer Power of Adjacency Matrix
Jagdish Kumar Pahade1* and Manoj Jha2