Wheeled PROPs, graph complexes and the master equation