It sounds like you are trying to enumerate ribbon graphs, in which case you might want to look at:
Do, Norman; Manescu, David, Quantum curves for the enumeration of ribbon graphs and hypermaps, Commun. Number Theory Phys. 8, No. 4, 677-701 (2014). ZBL1366.14034.
There is an arxiv.org version: arXiv:1312.6869.