Disclaimer: OP problem is more specific than the problem solved here. This solution has been posted primarily to draw some attention and to give some ideas. For a possibly more efficient solution of OP problem I would suggest looking into algorithms searching for strongly connected components (e.g. Tarjan's algorithm).
All simple paths in a (directed) graph
Below is an explicit implementation from this paper. Claimed to perform $\mathcal{O}(n^3)$ operations - whatever it means, i.e. I think there is ca. $\sum_{k=2}^n \binom{n}{k} \frac{k!}{2} = \Omega(2^n)$ simple paths to generate in a $n$-clique. Nevertheless, this algorithm looks interesting e.g. for its bit descriptors. There is plenty of room for improvement, including not Mathematica specific improvements (e.g. Section IV remarks on efficient implementation are not implemented).
The algorithm w/ auxiliary functions:
pairs[l1_, l2_] := Transpose[{l1, l2}]
initializePathDescriptorMatrix[g_] := Module[{a, e, m, n},
a = Normal[System`AdjacencyMatrix[g]];
e = Position[a, 1];
(* e == Sort[(EdgeList[g] /. Rule@@@pairs[System`VertexList[g], Range[n]]) /. DirectedEdge -> List] *)
m = Length[e];
n = Length[a];
(a[[#1[[1]], #1[[2]]]] = {{Plus @@ (2^(n - #) & /@ #1), 2^(m - #2)}}) & @@@
pairs[e,Range[m]];
a = a /. {0 -> {}};
a
]
generatePathDescriptorMatrix[g_] := Module[{dm, n, j, k, i},
dm = initializePathDescriptorMatrix[g];
n = Length[dm]; (* VertexCount[g] *)
For[j = 1, j <= n, j++,
For[i = 1, i <= n, i++,
For[k = 1, k <= n, k++,
Function[{v, e},
Function[{w, f},
If[BitAnd[v, w] == 2^(n - j),
dm[[i, k]] = Append[dm[[i, k]], BitOr @@@ {{v, w}, {e, f}}]
]
] @@@ dm[[j, k]]
] @@@ dm[[i, j]]
]]];
dm
]
And examples w/ some more auxiliary functions:
descriptorToEdgePath[g_, {}] := {}
descriptorToEdgePath[g_, d_] := Part[(* w/ crude solution for edges/vectices reordering *)
Sort[System`EdgeList[g] /. (Rule @@@ pairs[System`VertexList[g], Range[System`VertexCount[g]]])],
Flatten[Position[IntegerDigits[d[[2]], 2, System`EdgeCount[g]], 1]]
] /. (Rule @@@ pairs[Range[System`VertexCount[g]], System`VertexList[g]])
partg[g_] := Function[{m, v, w}, m[[ VertexIndex[g, v], VertexIndex[g, w]] ]]
(* paper example graph w/ 3 paths from 1 to 5 *)
e = {1 -> 2, 1 -> 3, 1 -> 4, 2 -> 4, 2 -> 5, 4 -> 5} ;
g = System`Graph[e, VertexLabels -> "Name"];
dm = generatePathDescriptorMatrix[g];
(* paths from 1 to 5 *)
(* Note: paths are sorted by vertex (in VertexList order), length, vertex etc. key *)
descriptorToEdgePath[g, #] & /@ partg[g][dm, 1, 5];
GraphicsRow[HighlightGraph[g, #] & /@ %, ImageSize -> 600]
(* cycle example *)
e = {x -> y, y -> z, z -> x, y -> v};
g = System`Graph[e, VertexLabels -> "Name"];
dm = generatePathDescriptorMatrix[g];
Length[Flatten[dm, 2]] == 9
(* 1 path of length 3 (z -> v) + 4 paths of length 2 (3 within cycle) + 4 edges *)
(* paths of length 2 *)
descriptorToEdgePath[g, #] & /@
Cases[Flatten[dm, 2], {_, ed_} /; Length[Position[IntegerDigits[ed, 2], 1]] == 2];
GraphicsGrid[Partition[HighlightGraph[g, #] & /@ %, 2], ImageSize -> 600]