Efficiently compute connected components of a undirected graph?

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) (n_points x 2).