# Are the lists from "BondList" and EdgeList for a molecule guaranteed to be aligned?

Consider the following:

ClearAll[mol1, bondList, edgeList];
mol1 = Molecule["COc1cc(C2Oc3cc(C4Oc5cc(O)cc(O)c5C(=O)C4O)ccc3OC2CO)ccc1O"];
bondList = MoleculeValue[mol1, "BondList"];
edgeList = mol1 // (MoleculeGraph /* EdgeList);
{bondList, edgeList} // (
Transpose /*
Cases[Except[{Bond[{s_, t_}, _], UndirectedEdge[s_, t_]}]]
)

(* {} *)


This always appears to work. But is it something that is guaranteed by Mathematica? In other words, is it safe to assume this alignment of ordering in other algorithms?

• the function MoleculeGraph calls ChemistryPrivateMoleculeGraphDumpiMoleculeGraph which, in turn, constructs the edge list from the BondList. So they are aligned by construction. Depending on the value of the option Method we might have multi edges. If the option value is Automatic|SimpleGraph|Simplegraph bond type (Single, Double, Triple,Auromatic) is attached as a property to the edge, if it is MultiGraph or Multigraph multi edges are constructed for Double and Triple and a single edge for Single and Auromatic.
– kglr
Sep 18, 2019 at 18:52
• @kglr if you write your comment as an answer, I will accept it. Sep 18, 2019 at 19:14

The function MoleculeGraph calls ChemistryPrivateMoleculeGraphDumpiMoleculeGraph which, in turn, constructs the edge list from the BondList.
Depending on the value of the option Method we might have multi edges. If the option value is Automatic|"SimpleGraph"|"Simplegraph" bond type ("Single", "Double", "Triple" or "Aromatic") is attached as the Property "BondOrder" to the edge; if it is "MultiGraph" or "Multigraph" multi edges are constructed for "Double" and "Triple" and a single edge for "Single" and "Aromatic" bond types.