Stable forms of two-dimensional crystals and graphene