def dict_to_dot(dict_G, name=''):
dict_G = dict(dict_G)
name = str(name)
nodes = dict_G.keys()
G = pgv.AGraph(name=name, label=name, strict=False, directed=True, rankdir="LR")
x_dim, y_dim = 0.1, 0.1
tail,adir,ahlen = 'dot','both',0.62
arc_descriptor_shape = 'plain'
node_shape = 'egg'
arc_shape = 'plain'
arc_arrow_head = 'normal'
arc_arrow_tail = 'dot'
arc_mid = 'none'
arc_dir = 'both'
for node in nodes:
G.add_node(node.uid,label=node_to_label(node))
arcs = dict_G[node]
for arc in arcs:
arc_id = arc_to_id(arc)
G.add_node(arc_id,shape=arc_descriptor_shape,label=arc_to_label(arc),width=x_dim,height=y_dim)
G.add_edge(node.uid,arc_id,len=ahlen,dir=arc_dir,arrowtail=arc_arrow_tail,arrowhead=arc_mid)
G.add_edge(arc_id,arc.toNode.uid,shape=arc_shape,arrowtail=arc_mid,arrowhead=arc_arrow_head)
return G
learning_graph_assign.py 文件源码
python
阅读 17
收藏 0
点赞 0
评论 0
评论列表
文章目录