graphviz 是贝尔实验室开发的一款开源绘图工具软件,使用
DSL(领域特定语言)dot语法作为脚本语言,通过布局引擎来解析此脚本,完成自动布局绘图
介绍
支持的类型:
digraph默认布局方式,主要用于有向图fdp缺乏方向性的图graph无向图neato缺乏方向性图,基于spring-model(又称force-based)算法twopi放射性布局、径向布局circo环型布局sfdp缺乏方向性的大型图
dot 语法说明:
->表示有向图中的边--表示无向图中的边
安装
apt install graphviz -y- 生成图片
dot digraph.dot -T png -o digraph.pngdigraph 有向图
digraph.dot
digraph demo{
a->b;
b->d;
c->d;
}graph 无向图
- graph.dot
graph demo1 {
a -- b
b -- c
c -- a
}负责的图
digraph action {
node [shape = record,height=.1];
node0 [label = "<head> head|<body> body|<foot> foot", height=.5]
node2 [shape = box label="mind"]
node0:head:n -> node2:n [label = "n"]
node0:head:ne -> node2:ne [label = "ne"]
node0:head:e -> node2:e [label = "e"]
node0:head:se -> node2:se [label = "se"]
node0:head:s -> node2:s [label = "s"]
node0:head:sw -> node2:sw [label = "sw"]
node0:head:w -> node2:w [label = "w"]
node0:head:nw -> node2:nw [label = "nw"]
node0:head:c -> node2:c [label = "c"]
node0:head:_ -> node2:_ [label = "_"]
node0:body[style=filled color=lightblue]
}扩展
- python 库
pip install pydotplus