Given an undirected graph, how would one go about calculating the number of squares in the graph? That is, a square is a cycle of length 4.
I know that it is possible to count the number of triangles (cycles with length 3) in polynomial time. Is it possible to calculate the number of squares in polynomial time as well, and how would one go about doing this?