Groups of graphs on given surfaces