I know only one, the cycle.js from Crockford's JSON-JS, but it is recursive and appears very slow, it take 2-5 seconds to JSON.stringify(JSON.decycle(random_graph_with_30_vertices)) and hit recursion depth limit for larger graphs. Are there better non-recursive alternatives?
1 Answer
Try Cereal
It is not recursive. The output format is less readable, but it's still actually JSON. I believe it's fairly fast, but I've not benchmarked it against cycle. It has been used in anger in a few projects. It also solves more than just cycle-detection which may or may not be to your liking.