docs: def _graph_is_connected(graph):
      """
      Return whether the graph is connected (True) or Not (False)
  
      Parameters
      ----------
      graph : array-like or sparse matrix, shape: (n_samples, n_samples)
          adjacency matrix of the graph, non-zero weight means an edge
          between the nodes
  
      Returns
      -------
      is_connected : bool
          True means the graph is fully connected and False means not
      """
      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]