This problem, for me, looks very interesting. It was about to find a simple cycle (i.e. cycle where are not repeat nodes) in a directed graph.
My solution is going like this, i.e, this graph is a case problem:
I know that there is a cycle in a graph, when you can find "back edges" in a depth-first-search (dashed in my picture in DFSTree), and for a moment I can sure for a few cycles, but not for all, simple cycles. Because, the directed egdes so important to from a cycle, i.e (0123) != (0321)
I'm thinking in make a dfs for each node with back-edges, but I'm not sure, and it's not clear. So, I ask you, if you guide me. Thanks!.
Here is my count of simple loops for my case problem.