code: public static boolean isSubgraph(IAtomContainer sourceGraph, IAtomContainer targetGraph, boolean shouldMatchBonds)
              throws CDKException {
          if (sourceGraph instanceof IQueryAtomContainer) {
              throw new CDKException("The first IAtomContainer must not be an IQueryAtomContainer");
          }
  
          if (targetGraph.getAtomCount() > sourceGraph.getAtomCount()) {
              return false;
          }
          // test for single atom case
          if (targetGraph.getAtomCount() == 1) {
              IAtom atom = targetGraph.getAtom(0);
              for (int i = 0; i < sourceGraph.getAtomCount(); i++) {
                  IAtom atom2 = sourceGraph.getAtom(i);
                  if (atom instanceof IQueryAtom) {
                      IQueryAtom qAtom = (IQueryAtom) atom;
                      if (qAtom.matches(atom2)) {
                          return true;
                      }
                  } else if (atom2 instanceof IQueryAtom) {
                      IQueryAtom qAtom = (IQueryAtom) atom2;
                      if (qAtom.matches(atom)) {
                          return true;
                      }
                  } else {
                      if (atom2.getSymbol().equals(atom.getSymbol())) {
                          return true;
                      }
                  }
              }
              return false;
          }
          if (!testSubgraphHeuristics(sourceGraph, targetGraph)) {
              return false;
          }
          return (getSubgraphMap(sourceGraph, targetGraph, shouldMatchBonds) != null);
      }
docs: Tests if targetGraph atom subgraph of sourceGraph.
  
  @param  sourceGraph  first molecule. Must not be an IQueryAtomContainer.
  @param  targetGraph  second molecule. May be an IQueryAtomContainer.
  @param shouldMatchBonds
  @return     true if targetGraph atom subgraph on sourceGraph
  @throws CDKException