3
$\begingroup$

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,

[1] https://ctr.fandom.com/wiki/Find_the_graph_diameter

$\endgroup$
2
  • 2
    $\begingroup$ 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". $\endgroup$
    – Szabolcs
    May 25 at 10:24
  • $\begingroup$ I apologize for using the bugs tag. I will not do that in the future. Thanks for your answer and comment. $\endgroup$
    – bhopshang
    May 25 at 11:22

1 Answer 1

5
$\begingroup$

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

$\endgroup$
2
  • 3
    $\begingroup$ 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. $\endgroup$
    – Szabolcs
    May 25 at 11:01
  • 1
    $\begingroup$ You are right that is definitely an omission on my part. $\endgroup$
    – Jason B.
    May 25 at 11:31

Not the answer you're looking for? Browse other questions tagged or ask your own question.