Gotzmann Ideals and applications to graphs