Reputation: 48697
Does anyone have source code implementing this algorithm for finding cycles, preferably in a modern statically-typed language like SML, OCaml, Haskell, F#, Scala?
Upvotes: 4
Views: 6659
Reputation: 1043
I struggled on this too, I came up with this page that lists some implementations for Johnson algorithm (the one looking for elementary circuits) in Java and OCaml. The author of the blog post fixed some issues in the original implementations, on the same page I linked before there are also the fixed versions of both implementations.
Upvotes: 1
Reputation: 3242
The following is a Java implementation of the algorithm you need: https://github.com/1123/johnson. Java running on the JVM, you can also use it from Scala.
Upvotes: 2