I'm looking for an algorithm which just counts the number of simple and distinct 4-cycles in an undirected graph labelled with integer keys. I don't need it to be optimal because I only have to use it as a term of comparison.
Thank you in advance.
EDIT: I realize I only have to count true 4-cycles, which can be seen as empty squares. In other words, the two opposite vertices of the cycle have not to be connected. I think this constraint would achieve a higher research interest.