It sounds like you are trying to enumerate ribbon graphs, in which case you might want to look at:

<cite authors="Do, Norman; Manescu, David">_Do, Norman; Manescu, David_, [**Quantum curves for the enumeration of ribbon graphs and hypermaps**](http://dx.doi.org/10.4310/CNTP.2014.v8.n4.a2), Commun. Number Theory Phys. 8, No. 4, 677-701 (2014). [ZBL1366.14034](https://zbmath.org/?q=an:1366.14034).</cite>

There is an arxiv.org version: [arXiv:1312.6869](https://arxiv.org/abs/1312.6869).