Skip to content

qref.experimental.rendering

qref.experimental.rendering

Experimental visualization capabilities for QREF.

Currently, the visualizations are done with graphviz, which does not suport hierarchical structures. Therefore, we have to use a somewhat hacky representation of our routines:

  • The leaf nodes are drawn as a single graphviz node (this is not surprising) with Mrecord shape. This allows to visually separate routine name from its ports.
  • The non-leaf nodes are represented as clusters.
  • Clusters can't use Mrecord shape, and so the ports are drawn as separate nodes.
  • Input and output ports are grouped into subgraphs with the same rank, which forces all inputs / all outputs to be placed in a single column.

Because of the above dichotomy, care has to be taken when constructing edges. - If addressing port of a leaf, it must be specified as graphviz port, e.g: "root.child:in_0" - If addressing port of a non-leaf, you use normal node reference, e.g: "root.child.in_0"

to_graphviz

to_graphviz(routine: RoutineV1) -> graphviz.Digraph

Convert routine encoded with v1 schema to a graphviz DAG.