Kosaraju's algorithm for finding strongly-connected components of a directed graph