Two example implementations of my algorithm for finding strongly connected components in a directed graph. This algorithm improves the space requirements of Tarjan's by compressing two arrays into one. See the following paper for details of how the algorithm works:
- A Space Efficient Algorithm for Detecting Strongly Connected Components. David J. Pearce. In Information Processing Letters, 116(1):47--52, 2016. © Elsevier.
Both a recursive and imperative version of this algorithm are given for completeness. These algorithms are not intended to be specifically efficient, just to provide sample implementations. In particular, I've tried to keep them as close to the presentation in the paper as possible.