graphviz 学习笔记

py文件名不要使用根包一样的,不然import时候是把workplace中的py文件import进去了


# -*- coding: utf-8 -*-

import csv
import pandas as pd
from datetime import *
import datetime
import numpy as np
import matplotlib.pyplot as plt
from graphviz import Digraph

grap_g = Digraph("G",format="pdf")
sub_g0 = Digraph(comment="process1",graph_attr={"style":'filled',"color":'lightgrey'},node_attr={"style":"filled","color":"red"})
sub_g0.node("a0","a0")
sub_g0.node("a1","a1")
sub_g0.node("a2","a2")
sub_g0.node("a3","a3")
sub_g0.edge("a0","a1")
sub_g0.edge("a1","a2")
sub_g0.edge("a2","a3")
sub_g0.edge("a3", "a0")
sub_g1 = Digraph(comment="process1",graph_attr={"style":'filled'})
sub_g1.node("B","b0")
sub_g1.node("C","b1")
sub_g1.node("D","b2")
sub_g1.node("E","b3")
sub_g1.edges(["BC","CD","DE"])
grap_g.node(
"start", label="start",shape="Mdiamond")
grap_g.node(
"end", label="end", shape="Mdiamond")
grap_g.subgraph(sub_g0)
grap_g.subgraph(sub_g1)
grap_g.edge("start","a0")
grap_g.edge("start","B")
grap_g.edge("a1","E")
grap_g.edge("D","a3")
grap_g.edge("a3","end")
grap_g.edge("E","end")


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值