While reading this paper on molecular graph generators using deep learning algorithms, I encountered the terms syntactically and semantically valid molecular graphs:

$\dots$ to ensure the generation of syntactically and semantically valid graphs.

The output molecular graph should at least satisfy the following constraints:

  1. Valency: Number of incident edges to an atom shall not exceed the valency of the atom on that node

  2. Connectivity: The output graph should be a single connected graph.

I was wondering what semantic and syntactic validity means in this context? Which type are each of these constraints?

Some concepts from computer science:

Syntax is the structure or form of expressions, statements, and program units but Semantics is the meaning of those expressions, statements, and program units.

But I can't make an exact connection to molecular graph's case. Also,

In computer science, the syntax of a computer language is the set of rules that defines the combinations of symbols that are considered to be a correctly structured document or fragment in that language

Then, valency and connectivity, unlike the linked paper in the answer below, should be syntactic constraints.

  • $\begingroup$ It would be good to add human readable references. $\endgroup$ – Martin - マーチン Feb 21 at 20:08
  • $\begingroup$ It is not sarcastic. Are we supposed to know what is syntax-directed VAE or QM9 ? $\endgroup$ – Maurice Feb 21 at 21:18
  • $\begingroup$ These are not relevant to the question in hand. $\endgroup$ – Blade Feb 22 at 1:28

Generative machine learning methods in chemistry are typically tasked with generating new molecular structures. Think of it as 'dreaming up molecules.'

We see these kinds of ML models with predictive text programs.. if I'm typing, my phone attempts to guess the word or complete my sentence. (NB this doesn't work so well with molecule names or scientific terms.)

There are a wide variety of ways to represent a molecule for such a generative ML method. One of the common ways is via SMILES in which the molecular graph is encoded as a text string:

c1ccccc1  benzene
CC(=O)O   acetic acid

In this case, syntax can be a problem. SMILES uses parenthesis to represent branching, and they must match. Numbers are used to represent ring closures, which must match as well.

Consequently, many generative ML method generate syntactically incorrect molecules (ignoring questions of chemical valence, etc.)

c1ccccc2 error
CC(=OO)) error

There are solutions. Noel O'Boyle and Andrew Dalke suggested DeepSMILES which encodes a new syntax that's resistant to such issues.

As you mention in your answer errors in connectivity and/or valence represent semantics - that is what makes a chemically viable molecule (i.e., carbon does not take 5 bonds, isolated oxygen atoms aren't stable, etc.)

| improve this answer | |
  • $\begingroup$ I'm having trouble imagining how a molecular graph could be syntactically invalid, but I've done enough programming to never be surprised. It would depend a lot on how the graph is represented internally. $\endgroup$ – Geoff Hutchison Feb 23 at 1:07
  • $\begingroup$ The only thing that I can think of is when an empty node is connected to edges. In other words, out of node classes, we select null, and out of bond classes, we select a non-null bond type for the edges incident to that atom. This means bonds that are not connected to any atoms. But in the same aper that I mentioned in my answer, this is again grouped with semantic validity. $\endgroup$ – Blade Feb 23 at 21:57
  • $\begingroup$ So, for SMILES, do these statements look correct?: 1. Syntactic validity is the set of rules that define a correct combination of symbols, regardless of its chemical validity 2. Semantic validity is a syntactically valid representation that also follows the chemical constraints. 3. Syntactic validity is representation validity, while Semantic validity is chemical validity of a syntactically valid representation. $\endgroup$ – Blade Feb 23 at 22:08

For the second part of question, according to this paper, both valency and connectivity constraints are categorized as semantic validity.

| improve this answer | |
  • 2
    $\begingroup$ IS this intended as an answer or as a comment to your question? If the latter please delete this answer and add the text as en edit to your question. $\endgroup$ – Buck Thorn Feb 21 at 20:27
  • $\begingroup$ I think this is an answer. but you can have your answer as well $\endgroup$ – Blade Feb 21 at 20:30
  • 1
    $\begingroup$ That's ok- I don't have an answer, but I thought yours so short that I was confused. I suggest you elaborate? $\endgroup$ – Buck Thorn Feb 21 at 20:49
  • $\begingroup$ Sure, I'll elaborate as I find answers online $\endgroup$ – Blade Feb 21 at 21:35

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.