TypedGraphDrawer#
qualtran.drawing.graphviz.TypedGraphDrawer
View source on GitHub
|
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()
Args
Methods#
cxn_label
cxn_label(
cxn: qualtran.Connection
) -> str
Overridable method to return labels for connections.
cxn_edge
cxn_edge(
left_id: str,
right_id: str,
cxn: qualtran.Connection
) -> pydot.Edge
Overridable method to style a pydot.Edge for connecionts.
View source on GitHub