graphviz和dot绘制流程图

graphviz和dot绘制流程图

step1:下载graphviz,https://graphviz.org/download/

step2:安装,记得添加环境变量

step3:验证是否安装成功 dot --version

bash 复制代码
C:\Users\wangrusheng>dot --version
dot - graphviz version 12.2.1 (20241206.2353)

step4:开始写流程图代码,保存在本地

C:\Users\wangrusheng\Downloads\flow.dot

bash 复制代码
digraph {
    rankdir="LR";

    graph [fontname="helvetica", fontsize=12];
    node [fontname="helvetica", fontsize=10];
    edge [fontname="helvetica", fontsize=10];

    start [shape="plaintext", style="rounded", label="I want to extract\nmembers from a zip file."];
    
    fewlarge [shape="box", label="Do you have a few\nlarge files zip files\nwith tens\nof thousands\nof members?"];
    manysmall [shape="box", label="Do you have\nmany small files\nwith a few\ndozen members?"];
    extractsome [shape="box", label="Do you need\nto extract many\nmembers but\nnot all?"];

    end [shape="plaintext", style="rounded", label="Use vanilla unzip."];
    unzippa [shape="plaintext", style="rounded", label="Maybe unzippa is faster."];

    {
        rank=same; start; fewlarge; manysmall; end;
    }
    {
        rank=same; extractsome; unzippa;
    }

    start -> fewlarge;
    fewlarge -> manysmall[label="No"];
    fewlarge -> extractsome[label="Yes"];
    manysmall -> end[label="No"];
    manysmall -> extractsome[label="Yes"];
    extractsome -> end[label="No"];
    extractsome -> unzippa[label="Yes"];
}

step5:用命令行,生成图片

bash 复制代码
Microsoft Windows [版本 10.0.26100.3915]
(c) Microsoft Corporation。保留所有权利。

C:\Users\wangrusheng>dot --version
dot - graphviz version 12.2.1 (20241206.2353)

C:\Users\wangrusheng>dot -Tpng "C:\Users\wangrusheng\Downloads\flow.dot" -o "C:\Users\wangrusheng\Downloads\flow.png"

C:\Users\wangrusheng>

step6:去对应目录打开图片,就能看到效果

end

相关推荐
小飞将9 小时前
VS code流程图插件mermaid使用
流程图
爱好读书11 小时前
AI生成流程图
人工智能·流程图
中维ZWPD1 天前
打破工业软件分类桎梏:ZWPD的实践探索与创新突破
人工智能·3d·流程图
IT界的奇葩3 天前
OAuth2 单点登录流程图
java·流程图·oauth2·单点登录·sso
Jeking2173 天前
进阶流程图绘制工具 Unione Flow Editor-- 击破样式痛点:全维度自定义解决方案
前端·流程图·workflow·unione flow·flow editor·unione cloud
nell_lee3 天前
利用ai快速绘制流程图/流程图自动迁移/快速格式化流程图
流程图
Jeking2173 天前
进阶流程图绘制工具 Unione Flow Editor-- 直击行业痛点:高扩展性解决方案解析
vue·流程图·workflow·unione flow·flow editor·unione cloud
Jeking2173 天前
新一代 Workflow 编辑器Unione Flow Editor :OA 审批流程实现案例
流程图·workflow·oa·unione flow·flow editor·unione cloud
Jeking2173 天前
进阶流程图绘制工具 Unione Flow Editor-- 巧用Event事件机制,破解复杂业务交互难题
流程图·vue3·workflow·unione flow·flow editor·unione cloud
Jeking2173 天前
初探新一代workflow编辑器unione flow editor:企业级流程设计的高效解决方案
编辑器·流程图·workflow·工作流·flow editor·unione cloud