6
$\begingroup$

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?

$\endgroup$
  • 2
    $\begingroup$ the function MoleculeGraph calls Chemistry`Private`MoleculeGraphDump`iMoleculeGraph 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. $\endgroup$ – kglr Sep 18 at 18:52
  • $\begingroup$ @kglr if you write your comment as an answer, I will accept it. $\endgroup$ – Shredderroy Sep 18 at 19:14
  • $\begingroup$ Shredderroy, made the comment an answer. $\endgroup$ – kglr Sep 18 at 19:23
5
$\begingroup$

The two lists are aligned by construction.

The function MoleculeGraph calls Chemistry`Private`MoleculeGraphDump`iMoleculeGraph 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.

$\endgroup$
  • 1
    $\begingroup$ @b3m2a1 I can confirm that it is indeed Aromatic. I think kglr just mistyped the word. $\endgroup$ – Shredderroy Sep 18 at 23:01
  • $\begingroup$ @b3m2a1, thank you. Just fixed the typo. $\endgroup$ – kglr Sep 18 at 23:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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