With the following we set a modest goal, namely to
compute enough data for lookup in the OEIS. We have
using the cycle index of the symmetric group and an
ordinary GF $T(z)$
$$T(z) = z +
z \times (Z(S_3; T(z))+Z(S_2; T(z))+Z(S_1; T(z))).$$
where $[z^0] T(z) = 0.$ Here the blue vertex is the root
and the red vertices are the subnodes. We assume that
for a vertex of some degree less than four the bonds are
filled with hydrogen atoms to make a total of four
bonds. Using combinatorial classes as in Analytic
Combinatorics by Flajolet and Sedgewick the above
implements the specification
$$\def\textsc#1{\dosc#1\csod}
\def\dosc#1#2\csod{{\rm #1{\small #2}}}
\mathcal{T} = \mathcal{Z}
+ \mathcal{Z} \times \textsc{MSET}_{=3}(\mathcal{T})
+ \mathcal{Z} \times \textsc{MSET}_{=2}(\mathcal{T})
+ \mathcal{Z} \times \textsc{MSET}_{=1}(\mathcal{T}).$$
We get the sequence
$$1, 1, 1, 2, 4, 8, 17, 39, 89, 211, 507, 1238, 3057,
\\ 7639, 19241, 48865, 124906$$
This is sequence A000598
from the OEIS where a considerable variety of relevant
material awaits. In particular an alternative functional
equation is proposed where we include hydrogen atoms
with the specification in hydrogens and carbons being
$$\def\textsc#1{\dosc#1\csod}
\def\dosc#1#2\csod{{\rm #1{\small #2}}}
\mathcal{T} = \mathcal{H}
+ \mathcal{C} \times \textsc{MSET}_{=3}(\mathcal{T})$$
which gives the equation
$$T(z) = 1 + z \times Z(S_3; T(z))$$
The code below was used to compute this sequence, in two
ways, by solving a system of equations for the
coefficients of an initial segment of $T$ which gave
results fast and a recurrence that is considerably more
efficient. We use the second functional equation to
implement the recurrence so as to get the minimum number
of memoized recursive calls.
Thanks go to @ChrisGrossack for alerting me to a bug in
my code.
with(combinat);
with(numtheory);
pet_varinto_cind :=
proc(poly, ind, excl)
local subs1, subs2, polyvars, indvars, v, pv, pot, res;
res := ind;
polyvars := {};
for pv in indets(poly) do
if not member(op(0, pv), excl) then
polyvars := {op(polyvars), pv};
fi;
od;
indvars := indets(ind);
for v in indvars do
pot := op(1, v);
subs1 :=
[seq(polyvars[k]=polyvars[k]^pot,
k=1..nops(polyvars))];
subs2 := [v=subs(subs1, poly)];
res := subs(subs2, res);
od;
res;
end;
pet_cycleind_symm :=
proc(n)
option remember;
if n=0 then return 1; fi;
expand(1/n*add(a[l]*pet_cycleind_symm(n-l), l=1..n));
end;
CFS :=
proc(n)
option remember;
local T, R, k, sys;
T := add(q[k]*z^k, k=0..n);
R := z
+ z*pet_varinto_cind(T, pet_cycleind_symm(3), {q})
+ z*pet_varinto_cind(T, pet_cycleind_symm(2), {q})
+ z*pet_varinto_cind(T, pet_cycleind_symm(1), {q});
R := expand(R);
sys := {seq(q[k] = coeff(R, z, k), k=0..n)};
subs(solve(sys), [seq(q[k], k=0..n)]);
end;
REC :=
proc(n)
option remember;
local res, a, b, c;
if n=0 or n=1 then return 1 fi;
res := 0;
for a from 0 to n-1 do
for b from 0 to n-1-a do
c := n-1-a-b;
res := res + 1/6*REC(a)*REC(b)*REC(c);
od;
od;
for a from 0 to floor((n-1)/2) do
b := n-1-2*a;
res := res + 1/2*REC(a)*REC(b);
od;
if n-1 mod 3 = 0 then
a := (n-1)/3;
res := res + 1/3*REC(a);
fi;
res;
end;