Quantum optimization with arbitrary connectivity using Rydberg atom arrays