Number of k-cycles from an adjacency matrix of a graph

829 Views Asked by At

Let $G(V,E)$ be a finite undirected graph with an adjacency matrix $A$. As far as I know it holds that that $A^k_{ii}$ gives us the number of walks starting and ending at vertex $i$ and having length $k$ (note that $A^k$ is the $k$-th power of the adjacency matrix).

From this we can find a number of sub-graphs isomorphic to $C_3$ (cycle of length $3$) as $\frac{tr(A^3)}{6}$. My intuition is that each $C_3$ has 3 vertices and there are $2$ directions we can take to complete the cycle, thus we count each cycle $3 \cdot 2 = 6$ times.

Now I'm thinking if there is a general formula that would allow us to determine a number of $C_k$s in a graph given it's adjacency matrix?

And also a weaker version: What is the formula for $C_4$?

Thanks.