docs: def isconnected(mask):
      """ Checks that all nodes are reachable from the first node - i.e. that the
      graph is fully connected. """
  
      nodes_to_check = list((np.where(mask[0, :])[0])[1:])
      seen = [True] + [False] * (len(mask) - 1)
      while nodes_to_check and not all(seen):
          node = nodes_to_check.pop()
          reachable = np.where(mask[node, :])[0]
          for i in reachable:
              if not seen[i]:
                  nodes_to_check.append(i)
                  seen[i] = True
      return all(seen)