template for strongly connected components