Implementation of Johnson's algorithm to find elementary circuits (cycles) in a graph
Does anyone have source code implementing this algorithm for finding cycles, preferably in a mo开发者_运维知识库dern statically-typed language like SML, OCaml, Haskell, F#, Scala?
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.
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.
You can find it here as part of jgrapht
implementation.
Will C++ and Boost Graph Library work for you?
精彩评论