def _graph_is_connected(graph):
    if sparse.isspmatrix(graph):
        # sparse graph, find all the connected components
        n_connected_components, _ = connected_components(graph)
        return n_connected_components == 1
    else:
        # dense graph, find all connected components start from node 0
        return _graph_connected_component(graph, 0).sum() == graph.shape[0]
Return whether the graph is connected (True) or Not (False)
dataset/ETHPy150Open mmp2/megaman/megaman/embedding/spectral_embedding.py/_graph_is_connected