An unrooted binary tree is an unrooted tree (a graph that has single connected component and contains no cycles) where each vertex has exactly one or three neighbors. It is used in bioinformatics to show evolutionary relationships between species.
If such a tree has \$n\$ internal nodes, it necessarily has \$n+2\$ leaves. Therefore it always has an even number of vertices.
Given a positive integer \$n\$, compute the number of distinct unrooted, unlabeled binary trees having \$2n\$ vertices. This is OEIS A000672. You may take \$2n\$ as input instead, and in that case, you may assume the input is always even.
The shortest code in bytes wins.
n=1 (2 nodes, 1 possible) O-O n=2 (4 nodes, 1 possible) O \ O-O / O n=3 (6 nodes, 1 possible) O O \ / O-O / \ O O n=4 (8 nodes, 1 possible) O O \ / O-O / \ O O-O / O n=5 (10 nodes, 2 possible) C \ A B C O-C \ / \ / O-O A O-O / \ / / \ A O-O C O-C / \ / B A C n=6 (12 nodes, 2 possible) (branching from A) (branching from B or C) O O / \ O-O O O O-O \ / \ / O-O O O-O O / \ / / \ / O O-O O O-O / \ / \ O O O O
The values for first 20 terms (for \$n=1\dots 20\$) are as follows:
1, 1, 1, 1, 2, 2, 4, 6, 11, 18, 37, 66, 135, 265, 552, 1132, 2410, 5098, 11020, 23846