TypedGraphDrawer#

qualtran.drawing.graphviz.TypedGraphDrawer

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

Inherits From: PrettyGraphDrawer, 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#

cxn_label

View source

Overridable method to return labels for connections.

cxn_edge

View source

Overridable method to style a pydot.Edge for connecionts.