  We investigate a strongly correlated system of light and matter in
two-dimensional cavity arrays. We formulate a Jaynes-Cummings Hamiltonian for
two-level atoms coupled to cavity modes and driven by an external laser field
which reduces to an effective spin Hamiltonian in the dispersive regime. In one
dimension we provide exact analytical solution. In two dimensions, we perform
mean-field study and large scale quantum Monte Carlo simulations of both the
Jaynes-Cummings and the effective spin models. We discuss the phase diagram and
the parameter regime which gives rise to frustrated interactions between the
spins. We provide quantitative description of the phase transitions and
correlation properties featured by the system and we discuss graph-theoretical
properties of the ground states in terms of graph colorings using P\'{o}lya's
enumeration theorem.
