Generate GraphViz from CBD Models

Useful drawing function to easily draw a CBD model in Graphviz.

CBD.converters.CBDDraw.gvDraw(cbd, filename, rankdir='LR', colors=None)[source]

Outputs a CBD as a GraphViz script to filename.

For instance, drawing the CBD given in the Hierarchical Even Number Generator example, the following figure can be obtained:

_images/EvenNumberGV.svg

Note

The resulting Graphviz file might look “clunky” and messy when rendering with the standard dot engine. The neato, twopi and circo engines might provide a cleaner and more readable result.

Parameters
  • cbd (CBD) – The CBD to draw.

  • filename (str) – The name of the dot-file.

  • rankdir (str) – The GraphViz rankdir of the plot. Must be either TB or LR.

  • colors (dict) – An optional dictionary of blockname -> color.