There are at least two problems with your algorithm:
isCyclicDirected
just detects whether there is any cycle in the graph. You can't use it directly to count cycles. For instance, your algorithm will count two cycles in (A B) (B A) (C A) because (C A) connects to a visited node.If you want to detect two cycles in your example, your detection needs to be edge based instead of vertex based. (B E) forms a cycle but both B and E are marked visited from previous runs.