molfoundry.DGPrinter#
- class molfoundry.DGPrinter#
Configures how a derivation graph is rendered by
DG.print(): which vertices and hyperedges are visible, their captions/labels and colors, and how hyperedges and their rules are labeled.- property graphPrinter: GraphPrinter#
The graph printer used for the molecule depictions embedded in the derivation graph. Returns a live handle, so configure it directly, e.g.
dgPrinter.graphPrinter.drawStyle = DrawStyle.xkcdfor the hand-drawn style.
- property withShortcutEdges: bool#
Whether a single-source/single-target hyperedge is drawn as a plain arrow rather than through a rectangle junction (default
True).
- property withShortcutEdgesAfterVisibility: bool#
Whether the shortcut test counts only the visible connectors (
True) or the full hyperedge (False, the default).
- property layout: Layout#
Layout.Stress(SMACOF / neato-like force layout, the default) orLayout.Dot(a layered / hierarchical layout that ranks educts above their products, like Graphvizdot).- Type:
Which layout positions the derivation graph
- property layoutRankDir: str#
'TB'(top→bottom, the default),'BT','LR'(left→right), or'RL'. Ignored by the'stress'layout.- Type:
Flow direction for the
'dot'layout
- pushVertexColor(f, extendToEdges=True)#
Push a vertex color function. A vertex’s color is the first non-empty result, trying the most recently pushed function first. When
extendToEdgesis set (the default), a single-source/single-target edge whose endpoints share a color inherits it (below an explicit edge color).
- popVertexColor()#
Pop the most recently pushed vertex color function.
- Return type:
None
- pushVertexVisible(f)#
Push a vertex visibility predicate. A vertex is drawn only if every pushed predicate accepts it (and hyperedges then keep only their visible connectors).
- popVertexVisible()#
Pop the most recently pushed vertex visibility predicate.
- Return type:
None
- pushVertexLabel(f)#
Push a vertex label function; its result is appended to the caption.
- popVertexLabel()#
Pop the most recently pushed vertex label function.
- Return type:
None
- pushEdgeColor(f)#
Push a hyperedge color function. An edge’s color is the first non-empty result (most recently pushed first); it takes precedence over a color inherited from same-colored endpoints.
- Parameters:
f (Callable[[DG.HyperEdge], str])
- Return type:
None
- popEdgeColor()#
Pop the most recently pushed hyperedge color function.
- Return type:
None
- pushEdgeVisible(f)#
Push a hyperedge visibility predicate. An edge is drawn only if every pushed predicate accepts it.
- Parameters:
f (Callable[[DG.HyperEdge], bool])
- Return type:
None
- popEdgeVisible()#
Pop the most recently pushed hyperedge visibility predicate.
- Return type:
None
- pushEdgeLabel(f)#
Push a hyperedge label function; its result is appended to the label.
- Parameters:
f (Callable[[DG.HyperEdge], str])
- Return type:
None
- popEdgeLabel()#
Pop the most recently pushed hyperedge label function.
- Return type:
None