GraphViz DOT有向图 - 复杂案例分析(1)

it2025-05-16  28

目录

案例案例分析

案例

digraph G { node [shape = circle]; 0 [label = "start", shape = none]; 1 [label = "q1"]; 2 [label = "q2"]; 3 [label = "q3"]; 4 [label = "q4"]; 5 [label = "q5"]; 6 [label = "q6", shape = doublecircle]; edge [label = "ε"]; {rank = same; 0 -> 1; } {rank = same; 2 -> 3 [label = "test"]; } 1 -> 2 [label = "0"]; 4 -> 5 [label = "1"]; 3 -> 4; 5 -> 6; 5 -> 4 [constraint = false]; 6 -> 3 [constraint = false]; }

案例分析

node [shape = circle]; 默认所有节点都是圆形 0 [label = “start”, shape = none]; 节点无边框 图默认randdir=TB, 所以从上往下走。 {rank = same; 0 -> 1; } 设定节点0和1同级, 同时设定节点关系 {rank = same; 2 -> 3 [label = “test”]; } 设定节点2和3同级,设定节点关系,设置线条的说明文字 edge [label = “ε”]; 默认所有的线条都加注释ε 5 -> 4 [constraint = false]; 画线条,但不约束节点关系

最新回复(0)