I do not know very much about quantum field theory, but I have seen, in my reading, that stable graphs can appear in QFT in the form of, I think, Feynman diagrams. By stable graph I mean a "graph with tails", whose vertices are labelled by nonnegative integers, and such that each vertex with labeling 0 has valence at least 3, and each vertex with labeling 1 has valence at least 1.

Algebraic geometers of course know that stable graphs also give a stratification of the Deligne-Mumford spaces $\overline{M}_{g,n}$: Vertices with label $g$ correspond to genus $g$ curves; edges correspond to nodes; tails correspond to marked points. Valency conditions correspond to finitude of automorphism group of the nodal curve.

Is there an explanation for this coincidence?

I guess there is probably some kind of explanation via Gromov-Witten theory. But I get the impression that stable graphs show up in QFTs more generally, and beyond Gromov-Witten theory. Do they? If so, how? And where?