Implement strong connected components for directed graph