molfoundry.graphDFS#

molfoundry.graphDFS(dfs, name=None, graphType=GraphType.Default, add=True)#

Build a Graph from a GraphDFS line-notation string.

GraphDFS is a compact, SMILES-like depth-first encoding of a labeled graph. Bare organic-subset atoms (C, N, O, …) receive implicit hydrogens as in SMILES; a bracketed [...] vertex is an arbitrary label and gets none. Ring bonds use defRingId / back-edge numbers, and {...} is an arbitrary edge label.

Parameters:
  • dfs (str) – The GraphDFS string to parse, e.g. "CC(=O)C" or "[C]1[C][C][C]{-}1".

  • name (str | None) – Human-readable name for the resulting graph, or None.

  • graphType (GraphType) – Interpret as a default graph or (for a chemical input) an electron graph.

  • add (bool) – When True (the default), also register the graph in inputGraphs.

Returns:

The parsed graph.

Return type:

Graph