IT:AD:GraphViz/Examples
Summary
It's good to have handy an example or two of the syntax required…
Examples
<graphviz> digraph finitestatemachine {
rankdir=LR; size="9,5.5" node [shape = doublecircle]; LR_0 LR_3 LR_4 LR_8; node [shape = circle]; 1 -> 2;
2 → 3; 1 → 3; 2 → 4; 4 → 4; 4 → 2; }
</graphviz>
<graphviz>
digraph structs {
size = "5,5"; bgcolor="#F0EADB"; layers = "constr:design"; node [shape=box, width=.1, height=.1, layer=all]; edge [layer=all];
constraint = false; nodesep = .1; ranksep = .3;
{
node [style=invis];
inv1; inv2; inv3; inv4;
}
INET [shape=record,width=.1, height=.1, label="<0>InterNET |<1>|<2>|<3>|<4>|<5>|<6>|<7>|<8>|<9>|<10>|<11>|"]; DMZ [shape=record,width=.1, height=.1, label="<0>DMZ 192.168.72.0/24|<1>|<2>|<3>|<4>|<5>|<6>|<7>|<8>|<9>|<10>|<11>|"]; LAN [shape=record,width=.1, height=.1, label="<0>LAN 192.168.1.0/24|<1>|<2>|<3>|<4>|<5>|<6>|<7>|<8>|<9>|<10>|<11>|"];
INET:0 -> inv1 -> inv2 -> DMZ:0 -> inv3 -> inv4 -> LAN:0 [style=invis];
{ rank = same; inv1; Alpha; Gamma; }
{ rank = same; inv2; Beta; }
INET:2 -> Alpha [dir=back]; INET:5 -> Beta [dir=back]; INET:8 -> Gamma [dir=back]; Alpha -> DMZ:2; Beta -> DMZ:5; Gamma -> DMZ:8;
{ rank = same; inv3; Gold; }
{ rank = same; inv4; Silver; Platinum;}
DMZ:2 -> Silver [dir=back]; DMZ:5 -> Gold [dir=back]; DMZ:8 -> Platinum [dir=back]; Silver -> LAN:2; Gold -> LAN:5; Platinum -> LAN:8;
INET:10 -> Gold [dir=back, headport=e, tailport=s]; INET:11 -> Platinum [dir=back, headport=e, tailport=s];
}
</graphviz>
<graphviz> digraph automata_0 { size =“8.5, 11”; node [shape = circle]; 0 [ style = filled, color=lightgrey ]; 2 [ shape = doublecircle ]; 0 → 2 [ label = “a ” ]; 0 → 1 [ label = “other ” ]; 1 → 2 [ label = “a ” ]; 1 → 1 [ label = “other ” ]; 2 → 2 [ label = “a ” ]; 2 → 1 [ label = “other ” ]; “Machine: a” [ shape = plaintext ]; } </graphviz>
<graphviz dot right 500×200
>
d
igraph finitestatemachine {
rankdir=LR; size="9,5" node [shape = doublecircle]; LR_0 LR_3 LR_4 LR_8; node [shape = circle]; LR_0 -> LR_2 [ label = "SS(B)" ]; LR_0 -> LR_1 [ label = "SS(S)" ]; LR_1 -> LR_3 [ label = "S($end)" ]; LR_2 -> LR_6 [ label = "SS(b)" ]; LR_2 -> LR_5 [ label = "SS(a)" ]; LR_2 -> LR_4 [ label = "S(A)" ]; LR_5 -> LR_7 [ label = "S(b)" ]; LR_5 -> LR_5 [ label = "S(a)" ]; LR_6 -> LR_6 [ label = "S(b)" ]; LR_6 -> LR_5 [ label = "S(a)" ]; LR_7 -> LR_8 [ label = "S(b)" ]; LR_7 -> LR_5 [ label = "S(a)" ]; LR_8 -> LR_6 [ label = "S(b)" ]; LR_8 -> LR_5 [ label = "S(a)!" ];
} </graphviz>
If the above doesn't work, see Install Plugins