code: public static boolean isConnected(IAtomContainer atomContainer) {
          // with one atom or less, we define it to be connected, as there is no
          // partitioning needed
          if (atomContainer.getAtomCount() < 2) return true;
  
          ConnectedComponents cc = new ConnectedComponents(GraphUtil.toAdjList(atomContainer));
          return cc.nComponents() == 1;
      }
docs: Check whether a set of atoms in an {@link IAtomContainer} is connected.
  
  @param   atomContainer  The {@link IAtomContainer} to be check for connectedness
  @return                 true if the {@link IAtomContainer} is connected