DotRenderer

class hugr.hugr.render.DotRenderer(config: RenderConfig | None = None)[source]

Bases: object

Render a HUGR to a graphviz dot file.

Parameters:

config – Render config

Methods

render

Render a HUGR to a graphviz dot object.

store

Render a HUGR and save it to a file.

Attributes

config

render(hugr: Hugr, root: Node | None = None) Digraph[source]

Render a HUGR to a graphviz dot object.

Parameters:
  • hugr – The HUGR to render.

  • root – Root node defining the set of nodes to render. By default this is the module root and all nodes are rendered. If this is a container node, all nodes under it are rendered. Every incoming edge to the rendered set and outgoing edge from it is also shown, with its other endpoint labelled with its node index.

store(hugr: Hugr, filename: str, format: str = 'svg', root: Node | None = None) None[source]

Render a HUGR and save it to a file.

Parameters:
  • hugr – The HUGR to render.

  • filename – Filename for saving the rendered graph.

  • format – The format used for rendering (‘pdf’, ‘png’, etc.). Defaults to SVG.

  • root – Root node defining the set of nodes to render. By default this is the module root and all nodes are rendered. If this is a container node, all nodes under it are rendered. Every incoming edge to the rendered set and outgoing edge from it is also shown, with its other endpoint labelled with its node index.