Efficiently compute connected components of a graph?

I wonder is there anything similar to the scipy.sparse.csgraph.connected_components for PyTorch? It can be either working with square matrix (not very sparse) or flatten representation (indices) .
Thank you very much!!