Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Counting isomeric n-carbon aliphatic alkanes

An n-carbon aliphatic alkane is an unrooted tree consisting of n nodes where the degree of each node is atmost 4. As an example, see this for a list of the enumeration of some low values of n.

I am looking for an algorithm to compute the number of such n-carbon aliphatic alkanes, given an n.

I have seen this in chemistry stackexchange already. I have also thought of dynamic programming, i.e, building larger graphs from smaller components, but I cannot deal with overcounting the same isomers.

Clarification: The Carbons are just a metaphor. I do not wish to take into account the instability of C16 and C17, nor do I care about stereoisomers

like image 986
Agnishom Chattopadhyay Avatar asked Oct 19 '22 10:10

Agnishom Chattopadhyay


1 Answers

So the standard approach is to use the Redfield–Pólya Theorem also known as the Pólya enumeration theorem. However it is not very 'algorithmic' - you have code like this (the Mathematica, Haskell, or one of the Python versions).

The rosettacode page also describes a more direct approach using canonical checking to avoid duplicates. The algorithm is a specialised form of orderly generation (I think) that only works for trees without vertex of edge colors and a maximum valence of 4.

like image 70
gilleain Avatar answered Oct 21 '22 01:10

gilleain