io
io
¤
plot_region_graph(region_graph, out_path=None, orientation='vertical', region_node_shape='box', partition_node_shape='point', label_font='times italic bold', label_size='21pt', label_color='white', region_label=None, region_color='#607d8b', partition_label=None, partition_color='#ffbd2a')
¤
Plot the region graph using graphviz.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
region_graph
|
RegionGraph
|
The region graph to plot. |
required |
out_path
|
str | PathLike[str] | None
|
The output path where the plot is saved. If it is None, the plot is not saved to a file. Defaults to None. The Output file format is deduced from the path. Possible formats are: {'jp2', 'plain-ext', 'sgi', 'x11', 'pic', 'jpeg', 'imap', 'psd', 'pct', 'json', 'jpe', 'tif', 'tga', 'gif', 'tk', 'xlib', 'vmlz', 'json0', 'vrml', 'gd', 'xdot', 'plain', 'cmap', 'canon', 'cgimage', 'fig', 'svg', 'dot_json', 'bmp', 'png', 'cmapx', 'pdf', 'webp', 'ico', 'xdot_json', 'gtk', 'svgz', 'xdot1.4', 'cmapx_np', 'dot', 'tiff', 'ps2', 'gd2', 'gv', 'ps', 'jpg', 'imap_np', 'wbmp', 'vml', 'eps', 'xdot1.2', 'pov', 'pict', 'ismap', 'exr'}. See https://graphviz.org/docs/outputs/ for more. |
None
|
orientation
|
str
|
Orientation of the graph. "vertical" puts the root node at the top, "horizontal" at left. Defaults to "vertical". |
'vertical'
|
label_font
|
str
|
Font used to render labels. Defaults to "times italic bold". See https://graphviz.org/faq/font/ for the available fonts. |
'times italic bold'
|
label_size
|
str
|
Size of the font for labels in points. Defaults to "21pt". |
'21pt'
|
label_color
|
str
|
Color for the labels in the nodes. Defaults to "white". See https://graphviz.org/docs/attr-types/color/ for supported color. |
'white'
|
region_label
|
str | Callable[[RegionNode], str] | None
|
Either a string or a function. If a function is provided, then it must take as input a region node and returns a string that will be used as label. If None, it defaults to the string representation of the scope of the region node. |
None
|
region_color
|
str | Callable[[RegionNode], str]
|
Either a string or a function. If a function is provided, then it must take as input a region node and returns a string that will be used as color for the region node. Defaults to "#607d8b". |
'#607d8b'
|
partition_label
|
str | Callable[[PartitionNode], str] | None
|
Either a string or a function. If a function is provided, then it must take as input a partition node and returns a string that will be used as label. If None, it defaults to an empty string. |
None
|
partition_color
|
str | Callable[[PartitionNode], str]
|
Either a string or a function. If a function is provided, then it must take as input a partition node and returns a string that will be used as color for the partition node. Defaults to "#ffbd2a". |
'#ffbd2a'
|
Raises:
| Type | Description |
|---|---|
ValueError
|
The format is not among the supported ones. |
ValueError
|
The direction is not among the supported ones. |
Returns:
| Type | Description |
|---|---|
Digraph
|
graphviz.Digraph: The graphviz object representing the region graph. |
Source code in cirkit/templates/region_graph/io.py
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 | |