Graphviz

Graphviz 是一款由 AT&T Research 和 Lucent Bell 实验室开源的可视化图形工具,可以很方便的用来绘制结构化的图形网络,支持多种格式输出

使用dot作为脚本语言

官网 https://www.graphviz.org/

下载 https://www.graphviz.org/download/

安装graphviz并设置环境变量,eg:D:\Program Files\Graphviz 2.44.1\bin

检查是否安装成功

Graphviz

eg:

first.dot

digraph first2{
a;
b;
c;
d;
a->b;
b->d;
c->d;
}

运行

dot -Tpng first.dot -o first.png

Graphviz

添加顶点和边的新定义

digraph first2{
node [shape="record"];
edge [style="dashed"];
a;
b;
c;
d;
a->b;
b->d;
c->d;
}

Graphviz
digraph g {
  node[peripheries=2, style=filled, color="#eecc80"];
  a->b [color=red, style=dashed];
  b->c;
  b->d [arrowhead=box];
  b->e [dir=none];
  d->f [dir=both];
  f->h [label=go];
  f->k [arrowhead=diamond];
}

Graphviz
digraph g {
  node [shape = record,height=.1];
  node0[label = " | G| "];
  node1[label = " | E| "];
  node2[label = " | B| "];
  node3[label = " | F| "];
  node4[label = " | R| "];
  node5[label = " | H| "];
  node6[label = " | Y| "];
  node7[label = " | A| "];
  node8[label = " | C| "];
  "node0":f2 -> "node4":f1;
  "node0":f0 -> "node1":f1;
  "node1":f0 -> "node2":f1;
  "node1":f2 -> "node3":f1;
  "node2":f2 -> "node8":f1;
  "node2":f0 -> "node7":f1;
  "node4":f2 -> "node6":f1;
  "node4":f0 -> "node5":f1;
}

Graphviz

Original: https://www.cnblogs.com/baby123/p/14246829.html
Author: 慕尘
Title: Graphviz

原创文章受到原创版权保护。转载请注明出处:https://www.johngo689.com/551222/

转载文章受原作者版权保护。转载请注明原作者出处!

(0)

大家都在看

亲爱的 Coder【最近整理,可免费获取】👉 最新必读书单  | 👏 面试题下载  | 🌎 免费的AI知识星球