working strongly connected components algorithm