# GraphDiameter for molecule graphs error [closed]

I was looking into GraphDiameter for molecules and ended up on this [page][1], which gives examples in various modalities to calculate the graph diameter for this molecule.'CC(C)C(C(=O)NC(=O)C1CCCN1C(=O)C(C)NC(=O)C(C)NC(=O)CCC(=O)OC)NC2=CC=C(C=C2)N+[O-]', with PubChem CID 5487286. The reported graph diameter is 24.

However, when I try the same molecule in Mathematica, the graph diameter is reported as 25.

mx = Molecule[ExternalIdentifier["PubChemCompoundID", 5487286]];
GraphDiameter[MoleculeGraph[mx]]
%Out = 25


The same result is reported if SMILES string is used to create the molecule.

GraphDiameter[MoleculeGraph[Molecule["CC(C)C(C(=O)NC(=O)C1CCCN1C(=O)C(C)NC(=O)C(C)NC(=O)CCC(=O)OC)NC2=CC=C(C=C2)[N+](=O)[O-]"]]]


I wonder if this is a bug and if there's a workaround.

Thank you,

• Please do not use the bugs tag when posting new questions, as stated in the tag description. This is not a bug, just a difference in what the article described and what you are doing. The article does not consider hydrogen atoms, and states this at the beginning. MoleculeGraph does. Voting to close as "simple mistake". May 25 at 10:24
• I apologize for using the bugs tag. I will not do that in the future. Thanks for your answer and comment. May 25 at 11:22

## 1 Answer

Look at the options for MoleculeGraph and you will see:

In[39]:= Options[MoleculeGraph, IncludeHydrogens]

Out[39]= {IncludeHydrogens -> All}


I believe this explains the discrepancy

• Could this be documented? I looked at Options[MoleculeGraph], but after it output all standard graph options, I gave up on trying to see if there's anything else. May 25 at 11:01
• You are right that is definitely an omission on my part. May 25 at 11:31