docs: def has_connection(graph, A, B):
      r"""Check if the given graph contains a path connecting A and B.
  
      Parameters
      ----------
      graph : scipy.sparse matrix
          Adjacency matrix of the graph
      A : array_like
          The set of starting states
      B : array_like
          The set of end states
  
      Returns
      -------
      hc : bool
         True if the graph contains a path connecting A and B, otherwise
         False.
  
      """
      for istart in A:
          nodes = csgraph.breadth_first_order(graph, istart, directed=True, return_predecessors=False)
          if has_path(nodes, A, B):
              return True
      return False