All simple cycles algorithm
emperorz opened this issue · comments
Depends on SCC algorithm (see issue 38).
Useful for AML/fraud ring detection, feedback mechanism finding.
I suggest Johnson's algorithm, though there is a more general version, but it is behind a paywall (grrr).
Neo4j doesn't seem to do this (no idea why).
Description here: https://www.cs.tufts.edu/comp/150GA/homeworks/hw1/Johnson%2075.PDF
Example code here, it isn't particularly great, but it probably works: https://github.com/mission-peace/interview/blob/master/src/com/interview/graph/AllCyclesInDirectedGraphJohnson.java
There are distributed cycle detection algo's too, but they look tricky. Here's one: https://www.researchgate.net/publication/283642998_Distributed_cycle_detection_in_large-scale_sparse_graphs
Interestingly, we can work backwards from this to strongly connected components.