8
$\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
  • 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, 2019 at 18:52
  • $\begingroup$ @kglr if you write your comment as an answer, I will accept it. $\endgroup$ Sep 18, 2019 at 19:14

1 Answer 1

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$
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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