first implementation of Tarjan strongly connected components algorithm