graphviz: node[ -> [node etc. it can go back with the new parser.
parent
43fb73fae6
commit
fa9643dd60
|
@ -48,8 +48,8 @@ IN: compiler.cfg.graphviz
|
||||||
|
|
||||||
: cfgviz ( cfg -- graph )
|
: cfgviz ( cfg -- graph )
|
||||||
<digraph>
|
<digraph>
|
||||||
graph[ "t" =labelloc ];
|
[graph "t" =labelloc ];
|
||||||
node[ "box" =shape "Courier" =fontname 10 =fontsize ];
|
[node "box" =shape "Courier" =fontname 10 =fontsize ];
|
||||||
swap [
|
swap [
|
||||||
[ add-cfg-vertex ] [ add-cfg-edges ] bi
|
[ add-cfg-vertex ] [ add-cfg-edges ] bi
|
||||||
] each-basic-block ;
|
] each-basic-block ;
|
||||||
|
|
|
@ -48,12 +48,12 @@ M: object expr>str unparse ;
|
||||||
basic-block get number>> ;
|
basic-block get number>> ;
|
||||||
|
|
||||||
: add-gvns ( graph -- graph' )
|
: add-gvns ( graph -- graph' )
|
||||||
"gvns" add-node[
|
"gvns" [add-node
|
||||||
congruence-classes =label
|
congruence-classes =label
|
||||||
"plaintext" =shape
|
"plaintext" =shape
|
||||||
];
|
];
|
||||||
"gvns" 0 add-edge[ "invis" =style ];
|
"gvns" 0 [add-edge "invis" =style ];
|
||||||
basic-block# add-node[ "bold" =style ];
|
basic-block# [add-node "bold" =style ];
|
||||||
;
|
;
|
||||||
|
|
||||||
SYMBOL: iteration
|
SYMBOL: iteration
|
||||||
|
|
|
@ -607,8 +607,8 @@ $nl
|
||||||
""
|
""
|
||||||
": K_n ( n -- )"
|
": K_n ( n -- )"
|
||||||
" <graph>"
|
" <graph>"
|
||||||
" node[ \"point\" =shape ]; "
|
" [node \"point\" =shape ]; "
|
||||||
" graph[ \"t\" =labelloc \"circo\" =layout ];"
|
" [graph \"t\" =labelloc \"circo\" =layout ];"
|
||||||
""
|
""
|
||||||
" over number>string \"K \" prepend =label"
|
" over number>string \"K \" prepend =label"
|
||||||
""
|
""
|
||||||
|
@ -636,15 +636,15 @@ $nl
|
||||||
":: partite-set ( n color -- cluster )"
|
":: partite-set ( n color -- cluster )"
|
||||||
" color <cluster>"
|
" color <cluster>"
|
||||||
" color =color"
|
" color =color"
|
||||||
" node[ color =color ];"
|
" [node color =color ];"
|
||||||
" n iota ["
|
" n iota ["
|
||||||
" number>string color prepend add-node"
|
" number>string color prepend add-node"
|
||||||
" ] each ;"
|
" ] each ;"
|
||||||
""
|
""
|
||||||
":: K_n,m ( n m -- )"
|
":: K_n,m ( n m -- )"
|
||||||
" <graph>"
|
" <graph>"
|
||||||
" node[ \"point\" =shape ];"
|
" [node \"point\" =shape ];"
|
||||||
" graph[ \"t\" =labelloc \"dot\" =layout \"LR\" =rankdir ];"
|
" [graph \"t\" =labelloc \"dot\" =layout \"LR\" =rankdir ];"
|
||||||
""
|
""
|
||||||
" n \"#FF0000\" partite-set"
|
" n \"#FF0000\" partite-set"
|
||||||
" m \"#0000FF\" partite-set"
|
" m \"#0000FF\" partite-set"
|
||||||
|
@ -678,8 +678,8 @@ $nl
|
||||||
""
|
""
|
||||||
": C_n ( n -- )"
|
": C_n ( n -- )"
|
||||||
" <graph>"
|
" <graph>"
|
||||||
" graph[ \"t\" =labelloc \"circo\" =layout ];"
|
" [graph \"t\" =labelloc \"circo\" =layout ];"
|
||||||
" node[ \"point\" =shape ];"
|
" [node \"point\" =shape ];"
|
||||||
" over number>string \"C \" prepend =label"
|
" over number>string \"C \" prepend =label"
|
||||||
" swap add-cycle"
|
" swap add-cycle"
|
||||||
" preview ;"
|
" preview ;"
|
||||||
|
@ -707,8 +707,8 @@ $nl
|
||||||
""
|
""
|
||||||
": W_n ( n -- )"
|
": W_n ( n -- )"
|
||||||
" <graph>"
|
" <graph>"
|
||||||
" graph[ \"t\" =labelloc \"twopi\" =layout ];"
|
" [graph \"t\" =labelloc \"twopi\" =layout ];"
|
||||||
" node[ \"point\" =shape ];"
|
" [node \"point\" =shape ];"
|
||||||
" over number>string \"W \" prepend =label"
|
" over number>string \"W \" prepend =label"
|
||||||
" over add-node"
|
" over add-node"
|
||||||
" over 1 - add-cycle"
|
" over 1 - add-cycle"
|
||||||
|
@ -736,13 +736,13 @@ $nl
|
||||||
" 0 <cluster>"
|
" 0 <cluster>"
|
||||||
" \"filled\" =style"
|
" \"filled\" =style"
|
||||||
" \"lightgrey\" =color"
|
" \"lightgrey\" =color"
|
||||||
" node[ \"filled\" =style \"white\" =color ];"
|
" [node \"filled\" =style \"white\" =color ];"
|
||||||
" { \"a0\" \"a1\" \"a2\" \"a3\" } ~->"
|
" { \"a0\" \"a1\" \"a2\" \"a3\" } ~->"
|
||||||
" \"process #1\" =label"
|
" \"process #1\" =label"
|
||||||
" add"
|
" add"
|
||||||
""
|
""
|
||||||
" 1 <cluster>"
|
" 1 <cluster>"
|
||||||
" node[ \"filled\" =style ];"
|
" [node \"filled\" =style ];"
|
||||||
" { \"b0\" \"b1\" \"b2\" \"b3\" } ~->"
|
" { \"b0\" \"b1\" \"b2\" \"b3\" } ~->"
|
||||||
" \"process #2\" =label"
|
" \"process #2\" =label"
|
||||||
" \"blue\" =color"
|
" \"blue\" =color"
|
||||||
|
@ -756,8 +756,8 @@ $nl
|
||||||
" \"a3\" \"end\" ->"
|
" \"a3\" \"end\" ->"
|
||||||
" \"b3\" \"end\" ->"
|
" \"b3\" \"end\" ->"
|
||||||
""
|
""
|
||||||
" \"start\" add-node[ \"Mdiamond\" =shape ];"
|
" \"start\" [add-node \"Mdiamond\" =shape ];"
|
||||||
" \"end\" add-node[ \"Msquare\" =shape ];"
|
" \"end\" [add-node \"Msquare\" =shape ];"
|
||||||
"preview"
|
"preview"
|
||||||
}
|
}
|
||||||
{ $image "resource:extra/graphviz/gallery/cluster.png" }
|
{ $image "resource:extra/graphviz/gallery/cluster.png" }
|
||||||
|
@ -777,16 +777,16 @@ $nl
|
||||||
" [ 16 * \"#%2x0000\" sprintf =fillcolor ] tri ;"
|
" [ 16 * \"#%2x0000\" sprintf =fillcolor ] tri ;"
|
||||||
""
|
""
|
||||||
"<graph>"
|
"<graph>"
|
||||||
" graph[ \"3,3\" =size \"circo\" =layout ];"
|
" [graph \"3,3\" =size \"circo\" =layout ];"
|
||||||
""
|
""
|
||||||
" node[ \"filled\" =style"
|
" [node \"filled\" =style"
|
||||||
" \"circle\" =shape"
|
" \"circle\" =shape"
|
||||||
" \"true\" =fixedsize"
|
" \"true\" =fixedsize"
|
||||||
" \"\" =label ];"
|
" \"\" =label ];"
|
||||||
""
|
""
|
||||||
" edge[ \"invis\" =style ];"
|
" [edge \"invis\" =style ];"
|
||||||
""
|
""
|
||||||
" 0 add-node[ \"invis\" =style \"none\" =shape ];"
|
" 0 [add-node \"invis\" =style \"none\" =shape ];"
|
||||||
""
|
""
|
||||||
" 16 iota ["
|
" 16 iota ["
|
||||||
" [ 0 -- ] [ colored-circle add ] bi"
|
" [ 0 -- ] [ colored-circle add ] bi"
|
||||||
|
@ -805,23 +805,23 @@ $nl
|
||||||
"<digraph>"
|
"<digraph>"
|
||||||
" \"LR\" =rankdir"
|
" \"LR\" =rankdir"
|
||||||
" \"8,5\" =size"
|
" \"8,5\" =size"
|
||||||
" node[ \"doublecircle\" =shape ];"
|
" [node \"doublecircle\" =shape ];"
|
||||||
" { \"LR_0\" \"LR_3\" \"LR_4\" \"LR_8\" } add-nodes"
|
" { \"LR_0\" \"LR_3\" \"LR_4\" \"LR_8\" } add-nodes"
|
||||||
" node[ \"circle\" =shape ];"
|
" [node \"circle\" =shape ];"
|
||||||
" \"LR_0\" \"LR_2\" ->[ \"SS(B)\" =label ];"
|
" \"LR_0\" \"LR_2\" [-> \"SS(B)\" =label ];"
|
||||||
" \"LR_0\" \"LR_1\" ->[ \"SS(S)\" =label ];"
|
" \"LR_0\" \"LR_1\" [-> \"SS(S)\" =label ];"
|
||||||
" \"LR_1\" \"LR_3\" ->[ \"S($end)\" =label ];"
|
" \"LR_1\" \"LR_3\" [-> \"S($end)\" =label ];"
|
||||||
" \"LR_2\" \"LR_6\" ->[ \"SS(b)\" =label ];"
|
" \"LR_2\" \"LR_6\" [-> \"SS(b)\" =label ];"
|
||||||
" \"LR_2\" \"LR_5\" ->[ \"SS(a)\" =label ];"
|
" \"LR_2\" \"LR_5\" [-> \"SS(a)\" =label ];"
|
||||||
" \"LR_2\" \"LR_4\" ->[ \"S(A)\" =label ];"
|
" \"LR_2\" \"LR_4\" [-> \"S(A)\" =label ];"
|
||||||
" \"LR_5\" \"LR_7\" ->[ \"S(b)\" =label ];"
|
" \"LR_5\" \"LR_7\" [-> \"S(b)\" =label ];"
|
||||||
" \"LR_5\" \"LR_5\" ->[ \"S(a)\" =label ];"
|
" \"LR_5\" \"LR_5\" [-> \"S(a)\" =label ];"
|
||||||
" \"LR_6\" \"LR_6\" ->[ \"S(b)\" =label ];"
|
" \"LR_6\" \"LR_6\" [-> \"S(b)\" =label ];"
|
||||||
" \"LR_6\" \"LR_5\" ->[ \"S(a)\" =label ];"
|
" \"LR_6\" \"LR_5\" [-> \"S(a)\" =label ];"
|
||||||
" \"LR_7\" \"LR_8\" ->[ \"S(b)\" =label ];"
|
" \"LR_7\" \"LR_8\" [-> \"S(b)\" =label ];"
|
||||||
" \"LR_7\" \"LR_5\" ->[ \"S(a)\" =label ];"
|
" \"LR_7\" \"LR_5\" [-> \"S(a)\" =label ];"
|
||||||
" \"LR_8\" \"LR_6\" ->[ \"S(b)\" =label ];"
|
" \"LR_8\" \"LR_6\" [-> \"S(b)\" =label ];"
|
||||||
" \"LR_8\" \"LR_5\" ->[ \"S(a)\" =label ];"
|
" \"LR_8\" \"LR_5\" [-> \"S(a)\" =label ];"
|
||||||
"preview"
|
"preview"
|
||||||
}
|
}
|
||||||
{ $image "resource:extra/graphviz/gallery/fsm.png" }
|
{ $image "resource:extra/graphviz/gallery/fsm.png" }
|
||||||
|
@ -836,66 +836,66 @@ $nl
|
||||||
"USING: graphviz graphviz.notation graphviz.render ;"
|
"USING: graphviz graphviz.notation graphviz.render ;"
|
||||||
""
|
""
|
||||||
"<digraph>"
|
"<digraph>"
|
||||||
" graph[ \"LR\" =rankdir \"8,8\" =size ];"
|
" [graph \"LR\" =rankdir \"8,8\" =size ];"
|
||||||
" node[ 8 =fontsize \"record\" =shape ];"
|
" [node 8 =fontsize \"record\" =shape ];"
|
||||||
""
|
""
|
||||||
" \"node0\" add-node["
|
" \"node0\" [add-node"
|
||||||
" \"<f0> 0x10ba8| <f1>\" =label"
|
" \"<f0> 0x10ba8| <f1>\" =label"
|
||||||
" ];"
|
" ];"
|
||||||
" \"node1\" add-node["
|
" \"node1\" [add-node"
|
||||||
" \"<f0> 0xf7fc4380| <f1> | <f2> |-1\" =label"
|
" \"<f0> 0xf7fc4380| <f1> | <f2> |-1\" =label"
|
||||||
" ];"
|
" ];"
|
||||||
" \"node2\" add-node["
|
" \"node2\" [add-node"
|
||||||
" \"<f0> 0xf7fc44b8| | |2\" =label"
|
" \"<f0> 0xf7fc44b8| | |2\" =label"
|
||||||
" ];"
|
" ];"
|
||||||
" \"node3\" add-node["
|
" \"node3\" [add-node"
|
||||||
" \"<f0> 3.43322790286038071e-06|44.79998779296875|0\" =label"
|
" \"<f0> 3.43322790286038071e-06|44.79998779296875|0\" =label"
|
||||||
" ];"
|
" ];"
|
||||||
" \"node4\" add-node["
|
" \"node4\" [add-node"
|
||||||
" \"<f0> 0xf7fc4380| <f1> | <f2> |2\" =label"
|
" \"<f0> 0xf7fc4380| <f1> | <f2> |2\" =label"
|
||||||
" ];"
|
" ];"
|
||||||
" \"node5\" add-node["
|
" \"node5\" [add-node"
|
||||||
" \"<f0> (nil)| | |-1\" =label"
|
" \"<f0> (nil)| | |-1\" =label"
|
||||||
" ];"
|
" ];"
|
||||||
" \"node6\" add-node["
|
" \"node6\" [add-node"
|
||||||
" \"<f0> 0xf7fc4380| <f1> | <f2> |1\" =label"
|
" \"<f0> 0xf7fc4380| <f1> | <f2> |1\" =label"
|
||||||
" ];"
|
" ];"
|
||||||
" \"node7\" add-node["
|
" \"node7\" [add-node"
|
||||||
" \"<f0> 0xf7fc4380| <f1> | <f2> |2\" =label"
|
" \"<f0> 0xf7fc4380| <f1> | <f2> |2\" =label"
|
||||||
" ];"
|
" ];"
|
||||||
" \"node8\" add-node["
|
" \"node8\" [add-node"
|
||||||
" \"<f0> (nil)| | |-1\" =label"
|
" \"<f0> (nil)| | |-1\" =label"
|
||||||
" ];"
|
" ];"
|
||||||
" \"node9\" add-node["
|
" \"node9\" [add-node"
|
||||||
" \"<f0> (nil)| | |-1\" =label"
|
" \"<f0> (nil)| | |-1\" =label"
|
||||||
" ];"
|
" ];"
|
||||||
" \"node10\" add-node["
|
" \"node10\" [add-node"
|
||||||
" \"<f0> (nil)| <f1> | <f2> |-1\" =label"
|
" \"<f0> (nil)| <f1> | <f2> |-1\" =label"
|
||||||
" ];"
|
" ];"
|
||||||
" \"node11\" add-node["
|
" \"node11\" [add-node"
|
||||||
" \"<f0> (nil)| <f1> | <f2> |-1\" =label"
|
" \"<f0> (nil)| <f1> | <f2> |-1\" =label"
|
||||||
" ];"
|
" ];"
|
||||||
" \"node12\" add-node["
|
" \"node12\" [add-node"
|
||||||
" \"<f0> 0xf7fc43e0| | |1\" =label"
|
" \"<f0> 0xf7fc43e0| | |1\" =label"
|
||||||
" ];"
|
" ];"
|
||||||
""
|
""
|
||||||
" \"node0\" \"node1\" ->[ \"f0\" =tailport \"f0\" =headport ];"
|
" \"node0\" \"node1\" [-> \"f0\" =tailport \"f0\" =headport ];"
|
||||||
" \"node0\" \"node2\" ->[ \"f1\" =tailport \"f0\" =headport ];"
|
" \"node0\" \"node2\" [-> \"f1\" =tailport \"f0\" =headport ];"
|
||||||
" \"node1\" \"node3\" ->[ \"f0\" =tailport \"f0\" =headport ];"
|
" \"node1\" \"node3\" [-> \"f0\" =tailport \"f0\" =headport ];"
|
||||||
" \"node1\" \"node4\" ->[ \"f1\" =tailport \"f0\" =headport ];"
|
" \"node1\" \"node4\" [-> \"f1\" =tailport \"f0\" =headport ];"
|
||||||
" \"node1\" \"node5\" ->[ \"f2\" =tailport \"f0\" =headport ];"
|
" \"node1\" \"node5\" [-> \"f2\" =tailport \"f0\" =headport ];"
|
||||||
" \"node4\" \"node3\" ->[ \"f0\" =tailport \"f0\" =headport ];"
|
" \"node4\" \"node3\" [-> \"f0\" =tailport \"f0\" =headport ];"
|
||||||
" \"node4\" \"node6\" ->[ \"f1\" =tailport \"f0\" =headport ];"
|
" \"node4\" \"node6\" [-> \"f1\" =tailport \"f0\" =headport ];"
|
||||||
" \"node4\" \"node10\" ->[ \"f2\" =tailport \"f0\" =headport ];"
|
" \"node4\" \"node10\" [-> \"f2\" =tailport \"f0\" =headport ];"
|
||||||
" \"node6\" \"node3\" ->[ \"f0\" =tailport \"f0\" =headport ];"
|
" \"node6\" \"node3\" [-> \"f0\" =tailport \"f0\" =headport ];"
|
||||||
" \"node6\" \"node7\" ->[ \"f1\" =tailport \"f0\" =headport ];"
|
" \"node6\" \"node7\" [-> \"f1\" =tailport \"f0\" =headport ];"
|
||||||
" \"node6\" \"node9\" ->[ \"f2\" =tailport \"f0\" =headport ];"
|
" \"node6\" \"node9\" [-> \"f2\" =tailport \"f0\" =headport ];"
|
||||||
" \"node7\" \"node3\" ->[ \"f0\" =tailport \"f0\" =headport ];"
|
" \"node7\" \"node3\" [-> \"f0\" =tailport \"f0\" =headport ];"
|
||||||
" \"node7\" \"node1\" ->[ \"f1\" =tailport \"f0\" =headport ];"
|
" \"node7\" \"node1\" [-> \"f1\" =tailport \"f0\" =headport ];"
|
||||||
" \"node7\" \"node8\" ->[ \"f2\" =tailport \"f0\" =headport ];"
|
" \"node7\" \"node8\" [-> \"f2\" =tailport \"f0\" =headport ];"
|
||||||
" \"node10\" \"node11\" ->[ \"f1\" =tailport \"f0\" =headport ];"
|
" \"node10\" \"node11\" [-> \"f1\" =tailport \"f0\" =headport ];"
|
||||||
" \"node10\" \"node12\" ->[ \"f2\" =tailport \"f0\" =headport ];"
|
" \"node10\" \"node12\" [-> \"f2\" =tailport \"f0\" =headport ];"
|
||||||
" \"node11\" \"node1\" ->[ \"f2\" =tailport \"f0\" =headport ];"
|
" \"node11\" \"node1\" [-> \"f2\" =tailport \"f0\" =headport ];"
|
||||||
"preview"
|
"preview"
|
||||||
}
|
}
|
||||||
{ $image "resource:extra/graphviz/gallery/record.png" }
|
{ $image "resource:extra/graphviz/gallery/record.png" }
|
||||||
|
|
|
@ -69,23 +69,23 @@ SYMBOLS: supported-layouts supported-formats ;
|
||||||
|
|
||||||
: K_n ( n -- graph )
|
: K_n ( n -- graph )
|
||||||
<graph>
|
<graph>
|
||||||
node[ "point" =shape ];
|
[node "point" =shape ];
|
||||||
graph[ "t" =labelloc "circo" =layout ];
|
[graph "t" =labelloc "circo" =layout ];
|
||||||
over number>string "K " prepend =label
|
over number>string "K " prepend =label
|
||||||
swap iota 2 [ first2 add-edge ] each-combination ;
|
swap iota 2 [ first2 add-edge ] each-combination ;
|
||||||
|
|
||||||
:: partite-set ( n color -- cluster )
|
:: partite-set ( n color -- cluster )
|
||||||
color <cluster>
|
color <cluster>
|
||||||
color =color
|
color =color
|
||||||
node[ color =color ];
|
[node color =color ];
|
||||||
n iota [
|
n iota [
|
||||||
number>string color prepend add-node
|
number>string color prepend add-node
|
||||||
] each ;
|
] each ;
|
||||||
|
|
||||||
:: K_n,m ( n m -- graph )
|
:: K_n,m ( n m -- graph )
|
||||||
<graph>
|
<graph>
|
||||||
node[ "point" =shape ];
|
[node "point" =shape ];
|
||||||
graph[ "t" =labelloc "dot" =layout "LR" =rankdir ];
|
[graph "t" =labelloc "dot" =layout "LR" =rankdir ];
|
||||||
n "#FF0000" partite-set
|
n "#FF0000" partite-set
|
||||||
m "#0000FF" partite-set
|
m "#0000FF" partite-set
|
||||||
add-edge
|
add-edge
|
||||||
|
@ -96,15 +96,15 @@ SYMBOLS: supported-layouts supported-formats ;
|
||||||
|
|
||||||
: C_n ( n -- graph )
|
: C_n ( n -- graph )
|
||||||
<graph>
|
<graph>
|
||||||
graph[ "t" =labelloc "circo" =layout ];
|
[graph "t" =labelloc "circo" =layout ];
|
||||||
node[ "point" =shape ];
|
[node "point" =shape ];
|
||||||
over number>string "C " prepend =label
|
over number>string "C " prepend =label
|
||||||
swap add-cycle ;
|
swap add-cycle ;
|
||||||
|
|
||||||
: W_n ( n -- graph )
|
: W_n ( n -- graph )
|
||||||
<graph>
|
<graph>
|
||||||
graph[ "t" =labelloc "twopi" =layout ];
|
[graph "t" =labelloc "twopi" =layout ];
|
||||||
node[ "point" =shape ];
|
[node "point" =shape ];
|
||||||
over number>string "W " prepend =label
|
over number>string "W " prepend =label
|
||||||
over add-node
|
over add-node
|
||||||
over 1 - add-cycle
|
over 1 - add-cycle
|
||||||
|
@ -116,12 +116,12 @@ SYMBOLS: supported-layouts supported-formats ;
|
||||||
0 <cluster>
|
0 <cluster>
|
||||||
"filled" =style
|
"filled" =style
|
||||||
"lightgrey" =color
|
"lightgrey" =color
|
||||||
node[ "filled" =style "white" =color ];
|
[node "filled" =style "white" =color ];
|
||||||
{ "a0" "a1" "a2" "a3" } ~->
|
{ "a0" "a1" "a2" "a3" } ~->
|
||||||
"process #1" =label
|
"process #1" =label
|
||||||
add
|
add
|
||||||
1 <cluster>
|
1 <cluster>
|
||||||
node[ "filled" =style ];
|
[node "filled" =style ];
|
||||||
{ "b0" "b1" "b2" "b3" } ~->
|
{ "b0" "b1" "b2" "b3" } ~->
|
||||||
"process #2" =label
|
"process #2" =label
|
||||||
"blue" =color
|
"blue" =color
|
||||||
|
@ -133,8 +133,8 @@ SYMBOLS: supported-layouts supported-formats ;
|
||||||
"a3" "a0" ->
|
"a3" "a0" ->
|
||||||
"a3" "end" ->
|
"a3" "end" ->
|
||||||
"b3" "end" ->
|
"b3" "end" ->
|
||||||
"start" add-node[ "Mdiamond" =shape ];
|
"start" [add-node "Mdiamond" =shape ];
|
||||||
"end" add-node[ "Msquare" =shape ];
|
"end" [add-node "Msquare" =shape ];
|
||||||
;
|
;
|
||||||
|
|
||||||
: colored-circle ( i -- node )
|
: colored-circle ( i -- node )
|
||||||
|
@ -145,13 +145,13 @@ SYMBOLS: supported-layouts supported-formats ;
|
||||||
|
|
||||||
: colored-circles-example ( -- graph )
|
: colored-circles-example ( -- graph )
|
||||||
<graph>
|
<graph>
|
||||||
graph[ "3,3" =size "circo" =layout ];
|
[graph "3,3" =size "circo" =layout ];
|
||||||
node[ "filled" =style
|
[node "filled" =style
|
||||||
"circle" =shape
|
"circle" =shape
|
||||||
"true" =fixedsize
|
"true" =fixedsize
|
||||||
"" =label ];
|
"" =label ];
|
||||||
edge[ "invis" =style ];
|
[edge "invis" =style ];
|
||||||
0 add-node[ "invis" =style "none" =shape ];
|
0 [add-node "invis" =style "none" =shape ];
|
||||||
16 iota [
|
16 iota [
|
||||||
[ 0 -- ] [ colored-circle add ] bi
|
[ 0 -- ] [ colored-circle add ] bi
|
||||||
] each ;
|
] each ;
|
||||||
|
@ -160,87 +160,87 @@ SYMBOLS: supported-layouts supported-formats ;
|
||||||
<digraph>
|
<digraph>
|
||||||
"LR" =rankdir
|
"LR" =rankdir
|
||||||
"8,5" =size
|
"8,5" =size
|
||||||
node[ "doublecircle" =shape ];
|
[node "doublecircle" =shape ];
|
||||||
{ "LR_0" "LR_3" "LR_4" "LR_8" } add-nodes
|
{ "LR_0" "LR_3" "LR_4" "LR_8" } add-nodes
|
||||||
node[ "circle" =shape ];
|
[node "circle" =shape ];
|
||||||
"LR_0" "LR_2" ->[ "SS(B)" =label ];
|
"LR_0" "LR_2" [-> "SS(B)" =label ];
|
||||||
"LR_0" "LR_1" ->[ "SS(S)" =label ];
|
"LR_0" "LR_1" [-> "SS(S)" =label ];
|
||||||
"LR_1" "LR_3" ->[ "S($end)" =label ];
|
"LR_1" "LR_3" [-> "S($end)" =label ];
|
||||||
"LR_2" "LR_6" ->[ "SS(b)" =label ];
|
"LR_2" "LR_6" [-> "SS(b)" =label ];
|
||||||
"LR_2" "LR_5" ->[ "SS(a)" =label ];
|
"LR_2" "LR_5" [-> "SS(a)" =label ];
|
||||||
"LR_2" "LR_4" ->[ "S(A)" =label ];
|
"LR_2" "LR_4" [-> "S(A)" =label ];
|
||||||
"LR_5" "LR_7" ->[ "S(b)" =label ];
|
"LR_5" "LR_7" [-> "S(b)" =label ];
|
||||||
"LR_5" "LR_5" ->[ "S(a)" =label ];
|
"LR_5" "LR_5" [-> "S(a)" =label ];
|
||||||
"LR_6" "LR_6" ->[ "S(b)" =label ];
|
"LR_6" "LR_6" [-> "S(b)" =label ];
|
||||||
"LR_6" "LR_5" ->[ "S(a)" =label ];
|
"LR_6" "LR_5" [-> "S(a)" =label ];
|
||||||
"LR_7" "LR_8" ->[ "S(b)" =label ];
|
"LR_7" "LR_8" [-> "S(b)" =label ];
|
||||||
"LR_7" "LR_5" ->[ "S(a)" =label ];
|
"LR_7" "LR_5" [-> "S(a)" =label ];
|
||||||
"LR_8" "LR_6" ->[ "S(b)" =label ];
|
"LR_8" "LR_6" [-> "S(b)" =label ];
|
||||||
"LR_8" "LR_5" ->[ "S(a)" =label ];
|
"LR_8" "LR_5" [-> "S(a)" =label ];
|
||||||
;
|
;
|
||||||
|
|
||||||
: record-example ( -- graph )
|
: record-example ( -- graph )
|
||||||
<digraph>
|
<digraph>
|
||||||
graph[ "LR" =rankdir "8,8" =size ];
|
[graph "LR" =rankdir "8,8" =size ];
|
||||||
node[ 8 =fontsize "record" =shape ];
|
[node 8 =fontsize "record" =shape ];
|
||||||
|
|
||||||
"node0" add-node[
|
"node0" [add-node
|
||||||
"<f0> 0x10ba8| <f1>" =label
|
"<f0> 0x10ba8| <f1>" =label
|
||||||
];
|
];
|
||||||
"node1" add-node[
|
"node1" [add-node
|
||||||
"<f0> 0xf7fc4380| <f1> | <f2> |-1" =label
|
"<f0> 0xf7fc4380| <f1> | <f2> |-1" =label
|
||||||
];
|
];
|
||||||
"node2" add-node[
|
"node2" [add-node
|
||||||
"<f0> 0xf7fc44b8| | |2" =label
|
"<f0> 0xf7fc44b8| | |2" =label
|
||||||
];
|
];
|
||||||
"node3" add-node[
|
"node3" [add-node
|
||||||
"<f0> 3.43322790286038071e-06|44.79998779296875|0" =label
|
"<f0> 3.43322790286038071e-06|44.79998779296875|0" =label
|
||||||
];
|
];
|
||||||
"node4" add-node[
|
"node4" [add-node
|
||||||
"<f0> 0xf7fc4380| <f1> | <f2> |2" =label
|
"<f0> 0xf7fc4380| <f1> | <f2> |2" =label
|
||||||
];
|
];
|
||||||
"node5" add-node[
|
"node5" [add-node
|
||||||
"<f0> (nil)| | |-1" =label
|
"<f0> (nil)| | |-1" =label
|
||||||
];
|
];
|
||||||
"node6" add-node[
|
"node6" [add-node
|
||||||
"<f0> 0xf7fc4380| <f1> | <f2> |1" =label
|
"<f0> 0xf7fc4380| <f1> | <f2> |1" =label
|
||||||
];
|
];
|
||||||
"node7" add-node[
|
"node7" [add-node
|
||||||
"<f0> 0xf7fc4380| <f1> | <f2> |2" =label
|
"<f0> 0xf7fc4380| <f1> | <f2> |2" =label
|
||||||
];
|
];
|
||||||
"node8" add-node[
|
"node8" [add-node
|
||||||
"<f0> (nil)| | |-1" =label
|
"<f0> (nil)| | |-1" =label
|
||||||
];
|
];
|
||||||
"node9" add-node[
|
"node9" [add-node
|
||||||
"<f0> (nil)| | |-1" =label
|
"<f0> (nil)| | |-1" =label
|
||||||
];
|
];
|
||||||
"node10" add-node[
|
"node10" [add-node
|
||||||
"<f0> (nil)| <f1> | <f2> |-1" =label
|
"<f0> (nil)| <f1> | <f2> |-1" =label
|
||||||
];
|
];
|
||||||
"node11" add-node[
|
"node11" [add-node
|
||||||
"<f0> (nil)| <f1> | <f2> |-1" =label
|
"<f0> (nil)| <f1> | <f2> |-1" =label
|
||||||
];
|
];
|
||||||
"node12" add-node[
|
"node12" [add-node
|
||||||
"<f0> 0xf7fc43e0| | |1" =label
|
"<f0> 0xf7fc43e0| | |1" =label
|
||||||
];
|
];
|
||||||
|
|
||||||
"node0" "node1" ->[ "f0" =tailport "f0" =headport ];
|
"node0" "node1" [-> "f0" =tailport "f0" =headport ];
|
||||||
"node0" "node2" ->[ "f1" =tailport "f0" =headport ];
|
"node0" "node2" [-> "f1" =tailport "f0" =headport ];
|
||||||
"node1" "node3" ->[ "f0" =tailport "f0" =headport ];
|
"node1" "node3" [-> "f0" =tailport "f0" =headport ];
|
||||||
"node1" "node4" ->[ "f1" =tailport "f0" =headport ];
|
"node1" "node4" [-> "f1" =tailport "f0" =headport ];
|
||||||
"node1" "node5" ->[ "f2" =tailport "f0" =headport ];
|
"node1" "node5" [-> "f2" =tailport "f0" =headport ];
|
||||||
"node4" "node3" ->[ "f0" =tailport "f0" =headport ];
|
"node4" "node3" [-> "f0" =tailport "f0" =headport ];
|
||||||
"node4" "node6" ->[ "f1" =tailport "f0" =headport ];
|
"node4" "node6" [-> "f1" =tailport "f0" =headport ];
|
||||||
"node4" "node10" ->[ "f2" =tailport "f0" =headport ];
|
"node4" "node10" [-> "f2" =tailport "f0" =headport ];
|
||||||
"node6" "node3" ->[ "f0" =tailport "f0" =headport ];
|
"node6" "node3" [-> "f0" =tailport "f0" =headport ];
|
||||||
"node6" "node7" ->[ "f1" =tailport "f0" =headport ];
|
"node6" "node7" [-> "f1" =tailport "f0" =headport ];
|
||||||
"node6" "node9" ->[ "f2" =tailport "f0" =headport ];
|
"node6" "node9" [-> "f2" =tailport "f0" =headport ];
|
||||||
"node7" "node3" ->[ "f0" =tailport "f0" =headport ];
|
"node7" "node3" [-> "f0" =tailport "f0" =headport ];
|
||||||
"node7" "node1" ->[ "f1" =tailport "f0" =headport ];
|
"node7" "node1" [-> "f1" =tailport "f0" =headport ];
|
||||||
"node7" "node8" ->[ "f2" =tailport "f0" =headport ];
|
"node7" "node8" [-> "f2" =tailport "f0" =headport ];
|
||||||
"node10" "node11" ->[ "f1" =tailport "f0" =headport ];
|
"node10" "node11" [-> "f1" =tailport "f0" =headport ];
|
||||||
"node10" "node12" ->[ "f2" =tailport "f0" =headport ];
|
"node10" "node12" [-> "f2" =tailport "f0" =headport ];
|
||||||
"node11" "node1" ->[ "f2" =tailport "f0" =headport ];
|
"node11" "node1" [-> "f2" =tailport "f0" =headport ];
|
||||||
;
|
;
|
||||||
|
|
||||||
:: with-global-value ( value variable quot -- )
|
:: with-global-value ( value variable quot -- )
|
||||||
|
|
|
@ -4,10 +4,10 @@ USING: graphviz graphviz.attributes help.markup help.syntax
|
||||||
kernel present sequences ;
|
kernel present sequences ;
|
||||||
IN: graphviz.notation
|
IN: graphviz.notation
|
||||||
|
|
||||||
{ add-edge add-edge[ -- ~-- --[ } related-words
|
{ add-edge [add-edge -- ~-- [-- } related-words
|
||||||
{ add-edge add-edge[ -> ~-> ->[ } related-words
|
{ add-edge [add-edge -> ~-> [-> } related-words
|
||||||
{
|
{
|
||||||
add-node[ add-edge[ --[ ->[ node[ edge[ graph[ ];
|
[add-node [add-edge [-- [-> [node [edge [graph ];
|
||||||
} related-words
|
} related-words
|
||||||
|
|
||||||
HELP: --
|
HELP: --
|
||||||
|
@ -78,7 +78,7 @@ HELP: ->
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
HELP: --[
|
HELP: [--
|
||||||
{ $values
|
{ $values
|
||||||
{ "tail" object }
|
{ "tail" object }
|
||||||
{ "head" object }
|
{ "head" object }
|
||||||
|
@ -94,7 +94,7 @@ HELP: --[
|
||||||
"it looks better to write"
|
"it looks better to write"
|
||||||
{ $code
|
{ $code
|
||||||
"<graph>"
|
"<graph>"
|
||||||
" 1 2 --[ \"red\" =color ];"
|
" 1 2 [-- \"red\" =color ];"
|
||||||
}
|
}
|
||||||
"Compare this with the DOT language, where you'd write"
|
"Compare this with the DOT language, where you'd write"
|
||||||
{ $code
|
{ $code
|
||||||
|
@ -105,7 +105,7 @@ HELP: --[
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
HELP: ->[
|
HELP: [->
|
||||||
{ $values
|
{ $values
|
||||||
{ "tail" object }
|
{ "tail" object }
|
||||||
{ "head" object }
|
{ "head" object }
|
||||||
|
@ -121,7 +121,7 @@ HELP: ->[
|
||||||
"it looks better to write"
|
"it looks better to write"
|
||||||
{ $code
|
{ $code
|
||||||
"<digraph>"
|
"<digraph>"
|
||||||
" 1 2 ->[ \"red\" =color ];"
|
" 1 2 [-> \"red\" =color ];"
|
||||||
}
|
}
|
||||||
"Compare this with the DOT language, where you'd write"
|
"Compare this with the DOT language, where you'd write"
|
||||||
{ $code
|
{ $code
|
||||||
|
@ -138,11 +138,11 @@ HELP: ];
|
||||||
{ "statement" object }
|
{ "statement" object }
|
||||||
{ "graph'" { $or graph subgraph } }
|
{ "graph'" { $or graph subgraph } }
|
||||||
}
|
}
|
||||||
{ $description "Synonym for " { $link add } " meant to be the \"other half\" of various " { $vocab-link "graphviz.notation" } " words like " { $links add-edge[ add-node[ graph[ } ", etc." }
|
{ $description "Synonym for " { $link add } " meant to be the \"other half\" of various " { $vocab-link "graphviz.notation" } " words like " { $links [add-edge [add-node [graph } ", etc." }
|
||||||
{ $examples "Refer to the documentation for the complementary words listed below." }
|
{ $examples "Refer to the documentation for the complementary words listed below." }
|
||||||
;
|
;
|
||||||
|
|
||||||
HELP: add-edge[
|
HELP: [add-edge
|
||||||
{ $values
|
{ $values
|
||||||
{ "tail" object }
|
{ "tail" object }
|
||||||
{ "head" object }
|
{ "head" object }
|
||||||
|
@ -158,7 +158,7 @@ HELP: add-edge[
|
||||||
"it looks better to write"
|
"it looks better to write"
|
||||||
{ $code
|
{ $code
|
||||||
"<graph>"
|
"<graph>"
|
||||||
" 1 2 add-edge[ \"red\" =color ];"
|
" 1 2 [add-edge \"red\" =color ];"
|
||||||
}
|
}
|
||||||
"Compare this with the DOT language, where you'd write"
|
"Compare this with the DOT language, where you'd write"
|
||||||
{ $code
|
{ $code
|
||||||
|
@ -167,11 +167,11 @@ HELP: add-edge[
|
||||||
"}"
|
"}"
|
||||||
}
|
}
|
||||||
$nl
|
$nl
|
||||||
"This has the advantage over " { $link --[ } " and " { $link ->[ } " of reading nicely for both directed " { $emphasis "and" } " undirected " { $link graph } "s."
|
"This has the advantage over " { $link [-- } " and " { $link [-> } " of reading nicely for both directed " { $emphasis "and" } " undirected " { $link graph } "s."
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
HELP: add-node[
|
HELP: [add-node
|
||||||
{ $values
|
{ $values
|
||||||
{ "id" object }
|
{ "id" object }
|
||||||
{ "node" node }
|
{ "node" node }
|
||||||
|
@ -186,7 +186,7 @@ HELP: add-node[
|
||||||
"it looks better to write"
|
"it looks better to write"
|
||||||
{ $code
|
{ $code
|
||||||
"<graph>"
|
"<graph>"
|
||||||
" \"foo\" add-node[ \"red\" =color ];"
|
" \"foo\" [add-node \"red\" =color ];"
|
||||||
}
|
}
|
||||||
"Compare this with the DOT language, where you'd write"
|
"Compare this with the DOT language, where you'd write"
|
||||||
{ $code
|
{ $code
|
||||||
|
@ -197,7 +197,7 @@ HELP: add-node[
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
HELP: edge[
|
HELP: [edge
|
||||||
{ $values
|
{ $values
|
||||||
{ "attrs" edge-attributes }
|
{ "attrs" edge-attributes }
|
||||||
}
|
}
|
||||||
|
@ -211,18 +211,18 @@ HELP: edge[
|
||||||
"it looks better to write"
|
"it looks better to write"
|
||||||
{ $code
|
{ $code
|
||||||
"<graph>"
|
"<graph>"
|
||||||
" edge[ \"red\" =color ];"
|
" [edge \"red\" =color ];"
|
||||||
}
|
}
|
||||||
"Compare this with the DOT language, where you'd write"
|
"Compare this with the DOT language, where you'd write"
|
||||||
{ $code
|
{ $code
|
||||||
"graph {"
|
"graph {"
|
||||||
" edge[ color=\"red\" ];"
|
" [edge color=\"red\" ];"
|
||||||
"}"
|
"}"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
HELP: graph[
|
HELP: [graph
|
||||||
{ $values
|
{ $values
|
||||||
{ "attrs" graph-attributes }
|
{ "attrs" graph-attributes }
|
||||||
}
|
}
|
||||||
|
@ -237,12 +237,12 @@ HELP: graph[
|
||||||
"it looks better to write"
|
"it looks better to write"
|
||||||
{ $code
|
{ $code
|
||||||
"<graph>"
|
"<graph>"
|
||||||
" graph[ \"LR\" =rankdir \"blah\" =label ];"
|
" [graph \"LR\" =rankdir \"blah\" =label ];"
|
||||||
}
|
}
|
||||||
"Compare this with the DOT language, where you'd write"
|
"Compare this with the DOT language, where you'd write"
|
||||||
{ $code
|
{ $code
|
||||||
"graph {"
|
"graph {"
|
||||||
" graph[ rankdir=\"LR\" label=\"blah\" ];"
|
" [graph rankdir=\"LR\" label=\"blah\" ];"
|
||||||
"}"
|
"}"
|
||||||
}
|
}
|
||||||
$nl
|
$nl
|
||||||
|
@ -262,7 +262,7 @@ HELP: graph[
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
HELP: node[
|
HELP: [node
|
||||||
{ $values
|
{ $values
|
||||||
{ "attrs" node-attributes }
|
{ "attrs" node-attributes }
|
||||||
}
|
}
|
||||||
|
@ -276,12 +276,12 @@ HELP: node[
|
||||||
"it looks better to write"
|
"it looks better to write"
|
||||||
{ $code
|
{ $code
|
||||||
"<graph>"
|
"<graph>"
|
||||||
" node[ \"red\" =color ];"
|
" [node \"red\" =color ];"
|
||||||
}
|
}
|
||||||
"Compare this with the DOT language, where you'd write"
|
"Compare this with the DOT language, where you'd write"
|
||||||
{ $code
|
{ $code
|
||||||
"graph {"
|
"graph {"
|
||||||
" node[ color=\"red\" ];"
|
" [node color=\"red\" ];"
|
||||||
"}"
|
"}"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -425,16 +425,16 @@ $nl
|
||||||
}
|
}
|
||||||
"Notation for nodes/edges with local attributes:"
|
"Notation for nodes/edges with local attributes:"
|
||||||
{ $subsections
|
{ $subsections
|
||||||
add-node[
|
[add-node
|
||||||
add-edge[
|
[add-edge
|
||||||
--[
|
[--
|
||||||
->[
|
[->
|
||||||
}
|
}
|
||||||
"Notation for global attributes:"
|
"Notation for global attributes:"
|
||||||
{ $subsections
|
{ $subsections
|
||||||
node[
|
[node
|
||||||
edge[
|
[edge
|
||||||
graph[
|
[graph
|
||||||
}
|
}
|
||||||
"Word to \"close off\" notation for attributes:"
|
"Word to \"close off\" notation for attributes:"
|
||||||
{ $subsections
|
{ $subsections
|
||||||
|
|
|
@ -74,14 +74,14 @@ ALIAS: -- add-edge
|
||||||
ALIAS: ~-> add-path
|
ALIAS: ~-> add-path
|
||||||
ALIAS: ~-- add-path
|
ALIAS: ~-- add-path
|
||||||
|
|
||||||
ALIAS: graph[ <graph-attributes>
|
ALIAS: [graph <graph-attributes>
|
||||||
ALIAS: node[ <node-attributes>
|
ALIAS: [node <node-attributes>
|
||||||
ALIAS: edge[ <edge-attributes>
|
ALIAS: [edge <edge-attributes>
|
||||||
|
|
||||||
ALIAS: add-node[ <node>
|
ALIAS: [add-node <node>
|
||||||
ALIAS: add-edge[ <edge>
|
ALIAS: [add-edge <edge>
|
||||||
ALIAS: ->[ <edge>
|
ALIAS: [-> <edge>
|
||||||
ALIAS: --[ <edge>
|
ALIAS: [-- <edge>
|
||||||
|
|
||||||
ALIAS: ]; add
|
ALIAS: ]; add
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue