Functional implementation of Tarjan's Strongly Connected Components algorithm

后端 未结 3 1487
粉色の甜心
粉色の甜心 2021-01-31 00:05

I went ahead and implemented the textbook version of Tarjan\'s SCC algorithm in Scala. However, I dislike the code - it is very imperative/procedural with lots of mutating state

3条回答
  •  感动是毒
    2021-01-31 00:26

    Have a look at https://github.com/jordanlewis/data.union-find, a Clojure implementation of the algorithm. It's sorta disguised as a data structure, but the algorithm is all there. And it's purely functional, of course.

提交回复
热议问题