Statistical mechanics of magnetic bubble arrays. I. Topology and thermalization.