2361e0d7f99df63f1ba1ff9c3ecef40e1f4eb7a9
1 # This file is part of NIT ( http://www.nitlanguage.org ).
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
7 # http://www.apache.org/licenses/LICENSE-2.0
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
15 # Example from http://www.graphviz.org/content/cluster
19 var graph
= new DotGraph("G", "digraph")
21 var cl0
= new DotGraph("cluster_0", "subgraph")
22 cl0
["label"] = "process #1"
23 cl0
["style"] = "filled"
24 cl0
["color"] = "lightgrey"
25 cl0
.nodes_attrs
["style"] = "filled"
26 cl0
.nodes_attrs
["color"] = "white"
28 var a0
= cl0
.add_node
("a0")
29 var a1
= cl0
.add_node
("a1")
30 var a2
= cl0
.add_node
("a2")
31 var a3
= cl0
.add_node
("a3")
38 var cl1
= new DotGraph("cluster_1", "subgraph")
39 cl1
["label"] = "process #2"
41 cl1
.nodes_attrs
["style"] = "filled"
43 var b0
= cl1
.add_node
("b0")
44 var b1
= cl1
.add_node
("b1")
45 var b2
= cl1
.add_node
("b2")
46 var b3
= cl1
.add_node
("b3")
53 var start
= graph
.add_node
("start")
54 start
["shape"] = "Mdiamond"
56 var nend
= graph
.add_node
("end")
57 nend
["shape"] = "Msquare"
59 graph
.add_edge
(start
, a0
)
60 graph
.add_edge
(start
, b0
)
61 graph
.add_edge
(a1
, b3
)
62 graph
.add_edge
(b2
, a3
)
63 graph
.add_edge
(a3
, a0
)
64 graph
.add_edge
(a3
, nend
)
65 graph
.add_edge
(b3
, nend
)
71 graph
.to_dot
.write_to_file args
.first