def graphviz(gr): gdraw.graphviz_draw(gr, pos=None, size=(15, 15), pin=False, layout=None, maxiter=None, ratio='fill', overlap=True, sep=None, splines=False, vsize=0.105, penwidth=1.0, elen=None, gprops={}, vprops={}, eprops={}, vcolor='#a40000', ecolor='#2e3436', vcmap=None, vnorm=True, ecmap=None, enorm=True, vorder=None, eorder=None, output='', output_format='auto', fork=False, return_string=False)
def export(tree, filename, struct_only=False): SIZE = (200, 150) FONT_SIZE = 40.0 labels = tree.graph.new_vertex_property("string") colors = tree.graph.new_vertex_property("string") speed = tree.graph.new_edge_property("string") for i in tree.stages: labels[i] = pretty_stage(tree.stages[i]) colors[i] = "deepskyblue1" if (i in tree.leaves) else "azure2" for e in tree.graph.edges(): _, j = e speed[e] = " " + pretty_speed(tree.stages[j].speed) if not struct_only: graphviz_draw(tree.graph, layout="dot", vprops={"label": labels, "fillcolor": colors, "fontsize": FONT_SIZE}, eprops={"label": speed, "fontsize": FONT_SIZE}, output=filename, size=SIZE, ratio="auto") else: graphviz_draw(tree.graph, layout="dot", vprops={"fillcolor": colors}, output=filename, size=SIZE, ratio="auto")
def draw_graph_template(g, out='cfg.pdf'): """Draws the graph g with some predefined settings""" g = g.copy() v = g.add_vertex() # g.vertex_properties['fillcolor'][v] = COL_DISPATCH # g.vertex_properties['vertex_name'][v] = 'dispatcher' # v = g.add_vertex() g.vertex_properties['fillcolor'][v] = COL_LEAF g.vertex_properties['vertex_name'][v] = 'leaves' v = g.add_vertex() g.vertex_properties['fillcolor'][v] = COL_OTHER g.vertex_properties['vertex_name'][v] = 'other' gd.graphviz_draw( g, gprops={ 'fontsize': 12, 'fontname': 'Courier', 'splines': 'polyline', # 'bgcolor' : 'azure' }, vprops={ # 'headport' : 'n', # 'tailport' : 's', # 'headport' : g.vertex_properties['headport'], # 'tailport' : g.vertex_properties['tailport'], # 'fillcolor' : 'gray', 'fillcolor': g.vertex_properties['fillcolor'], 'color': g.vertex_properties['color'], 'style': 'filled', 'shape': 'box', 'height': 0.1, 'width': 0.3, 'fontsize': 32, 'label': g.vertex_properties['vertex_name'] }, eprops={ 'headport': 'n', # 'tailport' : 's', 'color': g.edge_properties['color'], 'penwidth': 3, 'arrowhead': 'normal', 'arrowsize': 1.5, }, # size=(1000, 1000), ratio='auto', vsize=0.5, layout='dot', output=out) print('created {}'.format(out))
def export(tree, filename, struct_only=False): SIZE = (200, 150) FONT_SIZE = 40.0 labels = tree.graph.new_vertex_property("string") colors = tree.graph.new_vertex_property("string") for i in tree.stages: labels[i] = pretty_stage(tree.stages[i]) colors[i] = "gold" if (i in tree.failed_stages) else \ "darkorchid1" if (i in tree.failed_witness_stages) else \ "deepskyblue1" if (i in tree.true_stages) else \ "firebrick2" if (i in tree.false_stages) else "azure2" if not struct_only: graphviz_draw(tree.graph, layout="dot", vprops={"label": labels, "fillcolor": colors, "fontsize": FONT_SIZE}, output=filename, size=SIZE, ratio="auto") else: graphviz_draw(tree.graph, layout="dot", vprops={"fillcolor": colors}, output=filename, size=SIZE, ratio="auto")