Here is a [SageMath code](https://sagecell.sagemath.org/?z=eJxtUDFuwzAM3A34DxwlxDGQFuhQoFmFbp28GoJE20Is2qDlpP19xbZGmzQ3UbzD3VEeO-iRWmcT8hzG0fKiSD-XBWR0E0OEQMCWelSPFe0OG7fxjfCvlLBHbtClSQz2sYr7h79SQeggrfOIqtFw_BkZz8gL-ry7lQvcRCnQiteMgRfo2c7DUr_ZNBgZVdTXIil3qpzUQ1ojcj4xp9wJEWX7e6a7p_mKra33LfqsOe0O1fcz10_4rvRN-kfA0YMpi7IQeyP2_z76aUsy9TJMF6U_AY4mZzE=&lang=sage&interacts=eJyLjgUAARUAuQ==) generating caterpillar graphs on $n$ nodes based on enriching a path graph with leaves. As an example it shows all such graphs on 6 nodes.