Syntactic vs Semantic validity of molecular graphs 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: 


Valency: Number of incident edges to an atom shall not exceed the valency of the atom on that node
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.
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.)