import graphviz
# 定义流程图的节点和连线
node_data = {
'Start': {'label': 'Start'},
'Process 1': {'label': 'Process 1'},
'Process 2': {'label': 'Process 2'},
'End': {'label': 'End'}
}
edge_data = {
'Start': ['Process 1'],
'Process 1': ['Process 2'],
'Process 2': ['End']
}
# 创建图形对象
graph = graphviz.Graph(comment='Process Flow')#,head_name="123")
for node_name, node_data in node_data.items():
node = graph.node(str(node_name), shape='box', style='filled', fillcolor='#999999')
for edge in edge_data[node_name]:
graph.edge(str(node_name) + '-' + edge, arrow='normal')
# 输出流程图到控制台
graph.view()
本文链接:https://my.lmcjl.com/post/1418.html
展开阅读全文
4 评论