PrettyGraphDrawer#

qualtran.drawing.PrettyGraphDrawer

A class to encapsulate methods for displaying a CompositeBloq as a graph using graphviz.

Inherits From: GraphDrawer

Graphviz has nodes, edges, and ports. Nodes are HTML tables representing bloq instances. Each cell in the table has a graphviz port and represents a soquet. Edges connect node:port tuples representing connections between soquets.

Each node and port has a string identifier. We use the _IDBuilder helper class to assign unique, readable IDs to each object.

Users should call GraphDrawer.get_graph() as the primary entry point. Other methods can be overridden to customize the look of the resulting graph.

To display a graph in a jupyter notebook consider using the SVG utilities:

>>> dr = GraphDrawer(cbloq)
>>> dr.get_svg()
bloq

The bloq or composite bloq to draw.

Methods#

get_binst_table_attributes

View source

Overridable method to configure the desired table attributes for the bloq.

get_binst_header_text

View source

Overridable method returning the text used for the header cell of a bloq.

soq_label

View source

Overridable method for getting label text for a Soquet.

get_default_text

View source

cxn_edge

View source

Overridable method to style a pydot.Edge for connecionts.