code: private boolean isTerminal(IAtom atom, Map<IAtom, Integer> atomToIndex) {
          return graph[atomToIndex.get(atom)].length == 1;
      }
docs: Is the atom terminal having only one connection.
  
  @param atom        an atom
  @param atomToIndex a map of atoms to index
  @return the atom is terminal