ruby-graphviz_c 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (184) hide show
  1. checksums.yaml +7 -0
  2. data/.gemrc +0 -0
  3. data/.gitignore +9 -0
  4. data/.travis.yml +7 -0
  5. data/AUTHORS.rdoc +33 -0
  6. data/CHANGELOG.rdoc +287 -0
  7. data/COPYING.rdoc +133 -0
  8. data/Gemfile +4 -0
  9. data/README.rdoc +206 -0
  10. data/Rakefile +71 -0
  11. data/bin/dot2ruby +91 -0
  12. data/bin/gem2gv +165 -0
  13. data/bin/git2gv +167 -0
  14. data/bin/ruby2gv +234 -0
  15. data/bin/xml2gv +96 -0
  16. data/examples/dot/JSP.dot +52 -0
  17. data/examples/dot/balanced.dot +36 -0
  18. data/examples/dot/cluster.dot +30 -0
  19. data/examples/dot/dotgraph.dot +28 -0
  20. data/examples/dot/fsm.dot +20 -0
  21. data/examples/dot/genetic.dot +118 -0
  22. data/examples/dot/hello.dot +1 -0
  23. data/examples/dot/hello_test.rb +33 -0
  24. data/examples/dot/lion_share.dot +103 -0
  25. data/examples/dot/prof.dot +150 -0
  26. data/examples/dot/psg.dot +28 -0
  27. data/examples/dot/rank.dot +6 -0
  28. data/examples/dot/sdh.dot +284 -0
  29. data/examples/dot/siblings.dot +492 -0
  30. data/examples/dot/so-sample001.gv +30 -0
  31. data/examples/dot/so-sample002.gv +33 -0
  32. data/examples/dot/so-sample003.gv +45 -0
  33. data/examples/dot/test.dot +17 -0
  34. data/examples/dot/test_parse.rb +13 -0
  35. data/examples/dot/this_crach_with_dot_2.20.dot +24 -0
  36. data/examples/dot/unix.dot +104 -0
  37. data/examples/graphml/attributes.ext.graphml +12 -0
  38. data/examples/graphml/attributes.graphml +40 -0
  39. data/examples/graphml/cluster.graphml +75 -0
  40. data/examples/graphml/failed_graph.graphml +461 -0
  41. data/examples/graphml/hyper.graphml +29 -0
  42. data/examples/graphml/nested.graphml +54 -0
  43. data/examples/graphml/port.graphml +32 -0
  44. data/examples/graphml/simple.graphml +30 -0
  45. data/examples/hello.png +0 -0
  46. data/examples/rgv/rgv.ps +125 -0
  47. data/examples/rgv/test_rgv.rb +12 -0
  48. data/examples/sample01.rb +32 -0
  49. data/examples/sample02.rb +42 -0
  50. data/examples/sample03.rb +31 -0
  51. data/examples/sample04.rb +22 -0
  52. data/examples/sample05.rb +32 -0
  53. data/examples/sample06.rb +46 -0
  54. data/examples/sample07.rb +23 -0
  55. data/examples/sample08.rb +34 -0
  56. data/examples/sample09.rb +50 -0
  57. data/examples/sample10.rb +50 -0
  58. data/examples/sample11.rb +42 -0
  59. data/examples/sample12.rb +55 -0
  60. data/examples/sample13.rb +48 -0
  61. data/examples/sample14.rb +44 -0
  62. data/examples/sample15.rb +25 -0
  63. data/examples/sample16.rb +8 -0
  64. data/examples/sample17.rb +92 -0
  65. data/examples/sample18.rb +24 -0
  66. data/examples/sample19.rb +59 -0
  67. data/examples/sample20.rb +47 -0
  68. data/examples/sample21.rb +12 -0
  69. data/examples/sample22.rb +10 -0
  70. data/examples/sample23.rb +11 -0
  71. data/examples/sample24.rb +11 -0
  72. data/examples/sample25.rb +11 -0
  73. data/examples/sample26.rb +8 -0
  74. data/examples/sample27.rb +8 -0
  75. data/examples/sample28.rb +12 -0
  76. data/examples/sample29.rb +8 -0
  77. data/examples/sample30.rb +12 -0
  78. data/examples/sample31.rb +10 -0
  79. data/examples/sample32.rb +14 -0
  80. data/examples/sample33.rb +43 -0
  81. data/examples/sample34.rb +29 -0
  82. data/examples/sample35.rb +43 -0
  83. data/examples/sample36.rb +35 -0
  84. data/examples/sample37.rb +87 -0
  85. data/examples/sample38.rb +12 -0
  86. data/examples/sample39.rb +11 -0
  87. data/examples/sample40.rb +17 -0
  88. data/examples/sample41.rb +8 -0
  89. data/examples/sample42.rb +35 -0
  90. data/examples/sample43.rb +26 -0
  91. data/examples/sample44.rb +97 -0
  92. data/examples/sample45.rb +24 -0
  93. data/examples/sample46.rb +43 -0
  94. data/examples/sample47.rb +7 -0
  95. data/examples/sample48.rb +62 -0
  96. data/examples/sample49.rb +10 -0
  97. data/examples/sample50.rb +215 -0
  98. data/examples/sample51.rb +37 -0
  99. data/examples/sample52.rb +62 -0
  100. data/examples/sample53.rb +26 -0
  101. data/examples/sample54.rb +26 -0
  102. data/examples/sample55.rb +9 -0
  103. data/examples/sample56.rb +10 -0
  104. data/examples/sample57.rb +8 -0
  105. data/examples/sample58.rb +33 -0
  106. data/examples/sample59.rb +14 -0
  107. data/examples/sample60.rb +12 -0
  108. data/examples/sample61.rb +12 -0
  109. data/examples/sample62.rb +24 -0
  110. data/examples/sample63.rb +32 -0
  111. data/examples/sample64.rb +31 -0
  112. data/examples/sample65.rb +9 -0
  113. data/examples/sample66.rb +4 -0
  114. data/examples/sample67.rb +10 -0
  115. data/examples/sample68.rb +27 -0
  116. data/examples/sample69.rb +23 -0
  117. data/examples/sample70.rb +9 -0
  118. data/examples/sample99.rb +70 -0
  119. data/examples/sdlshapes/README +2 -0
  120. data/examples/sdlshapes/sdl.ps +655 -0
  121. data/examples/sdlshapes/sdlshapes.dot +78 -0
  122. data/examples/test.xml +26 -0
  123. data/examples/theory/pert.rb +47 -0
  124. data/examples/theory/tests.rb +87 -0
  125. data/lib/ext/gvpr/dot2ruby.g +185 -0
  126. data/lib/graphviz/attrs.rb +73 -0
  127. data/lib/graphviz/constants.rb +294 -0
  128. data/lib/graphviz/core_ext.rb +64 -0
  129. data/lib/graphviz/dot2ruby.rb +59 -0
  130. data/lib/graphviz/dot_script.rb +109 -0
  131. data/lib/graphviz/dsl.rb +67 -0
  132. data/lib/graphviz/edge.rb +197 -0
  133. data/lib/graphviz/elements.rb +39 -0
  134. data/lib/graphviz/ext.rb +17 -0
  135. data/lib/graphviz/family_tree/couple.rb +63 -0
  136. data/lib/graphviz/family_tree/generation.rb +39 -0
  137. data/lib/graphviz/family_tree/person.rb +120 -0
  138. data/lib/graphviz/family_tree/sibling.rb +13 -0
  139. data/lib/graphviz/family_tree.rb +118 -0
  140. data/lib/graphviz/graphml.rb +268 -0
  141. data/lib/graphviz/math/matrix.rb +221 -0
  142. data/lib/graphviz/node.rb +160 -0
  143. data/lib/graphviz/nothugly/nothugly.xsl +321 -0
  144. data/lib/graphviz/nothugly.rb +63 -0
  145. data/lib/graphviz/theory.rb +321 -0
  146. data/lib/graphviz/types/arrow_type.rb +32 -0
  147. data/lib/graphviz/types/color.rb +58 -0
  148. data/lib/graphviz/types/color_list.rb +24 -0
  149. data/lib/graphviz/types/esc_string.rb +20 -0
  150. data/lib/graphviz/types/gv_bool.rb +49 -0
  151. data/lib/graphviz/types/gv_double.rb +32 -0
  152. data/lib/graphviz/types/html_string.rb +18 -0
  153. data/lib/graphviz/types/lbl_string.rb +22 -0
  154. data/lib/graphviz/types/rect.rb +35 -0
  155. data/lib/graphviz/types/spline_type.rb +77 -0
  156. data/lib/graphviz/types.rb +22 -0
  157. data/lib/graphviz/utils/colors.rb +1018 -0
  158. data/lib/graphviz/utils.rb +70 -0
  159. data/lib/graphviz/xml.rb +119 -0
  160. data/lib/graphviz.rb +967 -0
  161. data/lib/ruby-graphviz.rb +1 -0
  162. data/man/dot2ruby.1 +66 -0
  163. data/man/dot2ruby.1.ronn +55 -0
  164. data/man/gem2gv.1 +60 -0
  165. data/man/gem2gv.1.ronn +47 -0
  166. data/man/git2gv.1 +48 -0
  167. data/man/git2gv.1.ronn +40 -0
  168. data/man/ruby2gv.1 +60 -0
  169. data/man/ruby2gv.1.ronn +47 -0
  170. data/man/xml2gv.1 +48 -0
  171. data/man/xml2gv.1.ronn +39 -0
  172. data/ruby-graphviz.gemspec +47 -0
  173. data/setup.rb +1585 -0
  174. data/test/helper.rb +13 -0
  175. data/test/support.rb +95 -0
  176. data/test/test_dot_script.rb +47 -0
  177. data/test/test_examples.rb +151 -0
  178. data/test/test_graph.rb +115 -0
  179. data/test/test_search.rb +29 -0
  180. data/test/test_subgraph.rb +27 -0
  181. data/test/test_theory.rb +98 -0
  182. data/test/test_types.rb +65 -0
  183. data/test/test_utils_colors.rb +52 -0
  184. metadata +301 -0
@@ -0,0 +1,29 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <graphml xmlns="http://graphml.graphdrawing.org/xmlns" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3
+ xsi:schemaLocation="http://graphml.graphdrawing.org/xmlns http://graphml.graphdrawing.org/xmlns/1.0/graphml.xsd">
4
+ <graph id="G" edgedefault="directed">
5
+ <node id="n0"/>
6
+ <node id="n1"/>
7
+ <node id="n2"/>
8
+ <node id="n3"/>
9
+ <node id="n4"/>
10
+ <node id="n5"/>
11
+ <node id="n6"/>
12
+ <hyperedge>
13
+ <endpoint node="n0"/>
14
+ <endpoint node="n1"/>
15
+ <endpoint node="n2"/>
16
+ </hyperedge>
17
+ <hyperedge>
18
+ <endpoint node="n3"/>
19
+ <endpoint node="n4"/>
20
+ <endpoint node="n5"/>
21
+ <endpoint node="n6"/>
22
+ </hyperedge>
23
+ <hyperedge>
24
+ <endpoint node="n1"/>
25
+ <endpoint node="n3"/>
26
+ </hyperedge>
27
+ <edge source="n0" target="n4"/>
28
+ </graph>
29
+ </graphml>
@@ -0,0 +1,54 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!-- This file was written by the JAVA GraphML Library.-->
3
+ <graphml xmlns="http://graphml.graphdrawing.org/xmlns" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4
+ xsi:schemaLocation="http://graphml.graphdrawing.org/xmlns http://graphml.graphdrawing.org/xmlns/1.0/graphml.xsd">
5
+ <key id="color" for="all" attr.name="color" attr.type="string"/>
6
+ <key id="style" for="graph" attr.name="style" attr.type="string"/>
7
+ <key id="label" for="all" attr.name="label" attr.type="string"/>
8
+ <graph id="G" edgedefault="directed">
9
+ <node id="n0"/>
10
+ <node id="n1"/>
11
+ <node id="n2"/>
12
+ <node id="n3"/>
13
+ <node id="n4"/>
14
+ <node id="n5">
15
+ <graph id="n5:" edgedefault="directed">
16
+ <data key="color">black</data>
17
+ <data key="style">filled</data>
18
+ <data key="label">SUB n5</data>
19
+ <node id="n5::n0"/>
20
+ <node id="n5::n1"/>
21
+ <node id="n5::n2"/>
22
+ <edge id="e0" source="n5::n0" target="n5::n2"/>
23
+ <edge id="e1" source="n5::n1" target="n5::n2"/>
24
+ </graph>
25
+ </node>
26
+ <node id="n6">
27
+ <graph id="n6:" edgedefault="directed">
28
+ <data key="color">red</data>
29
+ <data key="style">filled</data>
30
+ <data key="label">SUB n6</data>
31
+ <node id="n6::n0">
32
+ <graph id="n6::n0:" edgedefault="directed">
33
+ <data key="label">SUB n6::n0</data>
34
+ <data key="color">blue</data>
35
+ <data key="style">filled</data>
36
+ <node id="n6::n0::n0"/>
37
+ </graph>
38
+ </node>
39
+ <node id="n6::n1"/>
40
+ <node id="n6::n2"/>
41
+ <edge id="e10" source="n6::n1" target="n6::n0::n0"/>
42
+ <edge id="e11" source="n6::n1" target="n6::n2"/>
43
+ </graph>
44
+ </node>
45
+ <edge id="e2" source="n5::n2" target="n0"/>
46
+ <edge id="e3" source="n0" target="n2"/>
47
+ <edge id="e4" source="n0" target="n1"/>
48
+ <edge id="e5" source="n1" target="n3"/>
49
+ <edge id="e6" source="n3" target="n2"/>
50
+ <edge id="e7" source="n2" target="n4"/>
51
+ <edge id="e8" source="n3" target="n6::n1"/>
52
+ <edge id="e9" source="n6::n1" target="n4"/>
53
+ </graph>
54
+ </graphml>
@@ -0,0 +1,32 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <graphml xmlns="http://graphml.graphdrawing.org/xmlns" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3
+ xsi:schemaLocation="http://graphml.graphdrawing.org/xmlns http://graphml.graphdrawing.org/xmlns/1.0/graphml.xsd">
4
+ <graph id="G" edgedefault="directed">
5
+ <node id="n0">
6
+ <port name="North"/>
7
+ <port name="South"/>
8
+ <port name="East"/>
9
+ <port name="West"/>
10
+ </node>
11
+ <node id="n1">
12
+ <port name="North"/>
13
+ <port name="South"/>
14
+ <port name="East"/>
15
+ <port name="West"/>
16
+ </node>
17
+ <node id="n2">
18
+ <port name="NorthWest"/>
19
+ <port name="SouthEast"/>
20
+ </node>
21
+ <node id="n3">
22
+ <port name="NorthEast"/>
23
+ <port name="SouthWest"/>
24
+ </node>
25
+ <edge source="n0" target="n3" sourceport="North" targetport="NorthEast"/>
26
+ <hyperedge>
27
+ <endpoint node="n0" port="North"/>
28
+ <endpoint node="n1" port="East"/>
29
+ <endpoint node="n2" port="SouthEast"/>
30
+ </hyperedge>
31
+ </graph>
32
+ </graphml>
@@ -0,0 +1,30 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!-- This file was written by the JAVA GraphML Library.-->
3
+ <graphml xmlns="http://graphml.graphdrawing.org/xmlns" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4
+ xsi:schemaLocation="http://graphml.graphdrawing.org/xmlns http://graphml.graphdrawing.org/xmlns/1.0/graphml.xsd">
5
+ <graph id="G" edgedefault="directed">
6
+ <node id="n0"/>
7
+ <node id="n1"/>
8
+ <node id="n2"/>
9
+ <node id="n3"/>
10
+ <node id="n4"/>
11
+ <node id="n5"/>
12
+ <node id="n6"/>
13
+ <node id="n7"/>
14
+ <node id="n8"/>
15
+ <node id="n9"/>
16
+ <node id="n10"/>
17
+ <edge source="n0" target="n2"/>
18
+ <edge source="n1" target="n2"/>
19
+ <edge source="n2" target="n3"/>
20
+ <edge source="n3" target="n5"/>
21
+ <edge source="n3" target="n4"/>
22
+ <edge source="n4" target="n6"/>
23
+ <edge source="n6" target="n5"/>
24
+ <edge source="n5" target="n7"/>
25
+ <edge source="n6" target="n8"/>
26
+ <edge source="n8" target="n7"/>
27
+ <edge source="n8" target="n9"/>
28
+ <edge source="n8" target="n10"/>
29
+ </graph>
30
+ </graphml>
Binary file
@@ -0,0 +1,125 @@
1
+ %! Greg shapes for GraphViz/DOT
2
+
3
+ % input format :
4
+ % [ 54 36 0 36 0 0 54 0 54 36 ] 4 false yourshape
5
+ % or
6
+ % [ 54 36 0 36 0 0 54 0 54 36 ] 4 true yourshape
7
+ % [ 150 150 100 150 100 100 150 100 150 150 ] 4 true yourshape
8
+ %
9
+ % [upper right (y, x), lower right (y, x), lower left (y, x), upper left (y, x), upper right (y, x)]
10
+
11
+ /xdef {exch def} bind def
12
+
13
+ /rgv_box {
14
+ 10 dict begin
15
+ /fflag xdef
16
+ /sides xdef
17
+
18
+ 4 sides ne { stop } if
19
+
20
+ aload pop
21
+
22
+ newpath
23
+ moveto
24
+ lineto
25
+ lineto
26
+ lineto
27
+ closepath
28
+
29
+ pop pop
30
+
31
+ fflag { fill } { stroke } ifelse
32
+ end
33
+ } bind def
34
+
35
+ /rgv_cloud {
36
+ 10 dict begin
37
+ /fflag xdef
38
+ /sides xdef
39
+
40
+ % Check if we have 4 sides. Else stop
41
+ 4 sides ne { stop } if
42
+
43
+ % (aload) takes an array as its argument and places the individual elements
44
+ % of that array, and then the array itself, on the stack. Then (pop) remove
45
+ % the top element from the stack (the array)
46
+ aload pop
47
+
48
+ /ury xdef /urx xdef
49
+ /lry xdef /lrx xdef
50
+ /lly xdef /llx xdef
51
+ /uly xdef /ulx xdef
52
+ pop pop
53
+
54
+ /mx lrx llx neg add 2 div def
55
+ /my uly lly neg add 2 div def
56
+
57
+ % empty the current path and declares we are starting a new path
58
+ newpath
59
+
60
+ urx ury my neg add my 270 90 arc
61
+ ulx mx add uly mx 0 180 arc
62
+ llx lly my add my 90 270 arc
63
+ lrx lry lineto
64
+
65
+ closepath
66
+
67
+ % The stroke operator on line four causes the path we have constructed to be
68
+ % painted onto the current page.
69
+ % The fill operator fills the current path with ink.
70
+ fflag { fill } { stroke } ifelse
71
+ end
72
+ } bind def
73
+
74
+ /rgv_flower {
75
+ 10 dict begin
76
+ /fflag xdef
77
+ /sides xdef
78
+
79
+ % Check if we have 4 sides. Else stop
80
+ 4 sides ne { stop } if
81
+
82
+ % (aload) takes an array as its argument and places the individual elements
83
+ % of that array, and then the array itself, on the stack. Then (pop) remove
84
+ % the top element from the stack (the array)
85
+ aload pop
86
+
87
+ /ury xdef /urx xdef
88
+ /lry xdef /lrx xdef
89
+ /lly xdef /llx xdef
90
+ /uly xdef /ulx xdef
91
+ pop pop
92
+
93
+ /mx lrx llx neg add 2 div def
94
+ /my uly lly neg add 2 div def
95
+
96
+ % empty the current path and declares we are starting a new path
97
+ newpath
98
+
99
+ % Arcs
100
+ urx ury my neg add my 270 90 arc
101
+ ulx mx add uly mx 0 180 arc
102
+ llx lly my add my 90 270 arc
103
+ lrx mx neg add lry mx 180 0 arc
104
+
105
+ closepath
106
+
107
+ % The stroke operator on line four causes the path we have constructed to be
108
+ % painted onto the current page.
109
+ % The fill operator fills the current path with ink.
110
+ fflag { fill } { stroke } ifelse
111
+ end
112
+ } bind def
113
+
114
+ %[ 150 150 50 150 50 100 150 100 150 150 ] 4 false rgv_box
115
+ %[ 250 250 150 250 150 200 250 200 250 250 ] 4 false rgv_flower
116
+ %[ 350 350 250 350 250 300 350 300 350 350 ] 4 false rgv_cloud
117
+ %
118
+ %.5 setgray
119
+ %[ 150 450 50 450 50 400 150 400 150 450 ] 4 true rgv_box
120
+ %.5 setgray
121
+ %[ 250 550 150 550 150 500 250 500 250 550 ] 4 true rgv_flower
122
+ %.5 setgray
123
+ %[ 350 650 250 650 250 600 350 600 350 650 ] 4 true rgv_cloud
124
+ %
125
+ %showpage
@@ -0,0 +1,12 @@
1
+ #!/usr/bin/ruby
2
+
3
+ $:.unshift( "../../lib" );
4
+ require "graphviz"
5
+
6
+ GraphViz.new(:g){ |g|
7
+ g[:center] = true
8
+ a = g.add_nodes("A", :shape => "rgv_box", :peripheries => 0)
9
+ b = g.add_nodes("Bonjour le monde\nComment va tu ?", :shape => "rgv_cloud", :peripheries => 0)
10
+ c = g.add_nodes("C", :shape => "rgv_flower", :peripheries => 0)
11
+ a << b << c
12
+ }.save( :ps => "#{$0}.ps", :extlib => "rgv.ps" )
@@ -0,0 +1,32 @@
1
+ #!/usr/bin/ruby
2
+
3
+ $:.unshift( "../lib" )
4
+ require "graphviz"
5
+
6
+ g = nil
7
+ if ARGV[0]
8
+ g = GraphViz::new( "G", :path => ARGV[0] )
9
+ else
10
+ g = GraphViz::new( "G" )
11
+ end
12
+
13
+ main = g.add_nodes( "main" )
14
+ parse = g.add_nodes( "parse" )
15
+ execute = g.add_nodes( "execute" )
16
+ init = g.add_nodes( "init" )
17
+ cleanup = g.add_nodes( "cleanup" )
18
+ make_string = g.add_nodes( "make_string" )
19
+ printf = g.add_nodes( "printf" )
20
+ compare = g.add_nodes( "compare" )
21
+
22
+ g.add_edges( main, parse )
23
+ g.add_edges( parse, execute )
24
+ g.add_edges( main, init )
25
+ g.add_edges( main, cleanup )
26
+ g.add_edges( execute, make_string )
27
+ g.add_edges( execute, printf )
28
+ g.add_edges( init, make_string )
29
+ g.add_edges( main, printf )
30
+ g.add_edges( execute, compare )
31
+
32
+ g.output( :png => "#{$0}.png" )
@@ -0,0 +1,42 @@
1
+ #!/usr/bin/ruby
2
+
3
+ $:.unshift( "../lib" );
4
+ require "graphviz"
5
+
6
+ g = nil
7
+ if ARGV[0]
8
+ g = GraphViz::new( "G", :path => ARGV[0] )
9
+ else
10
+ g = GraphViz::new( "G" )
11
+ end
12
+
13
+ g.node[:shape] = "ellipse"
14
+ g.node[:color] = "black"
15
+
16
+ g.edge[:color] = "black"
17
+ g.edge[:weight] = "1"
18
+ g.edge[:style] = "filled"
19
+ g.edge[:label] = ""
20
+
21
+ g[:size] = "4,4"
22
+
23
+ main = g.add_nodes( "main", :shape => "box" )
24
+ parse = g.add_nodes( "parse" )
25
+ execute = g.add_nodes( "execute" )
26
+ init = g.add_nodes( "init" )
27
+ cleanup = g.add_nodes( "cleanup" )
28
+ make_string = g.add_nodes( "make_string", :label => 'make a\nstring' )
29
+ printf = g.add_nodes( "printf" )
30
+ compare = g.add_nodes( "compare", :shape => "box", :style => "filled", :color => ".7 .3 1.0" )
31
+
32
+ g.add_edges( main, parse, :weight => "8" )
33
+ g.add_edges( parse, execute )
34
+ g.add_edges( main, init, :style => "dotted" )
35
+ g.add_edges( main, cleanup )
36
+ g.add_edges( execute, make_string )
37
+ g.add_edges( execute, printf )
38
+ g.add_edges( init, make_string )
39
+ g.add_edges( main, printf, :color => "red", :style => "bold", :label => "100 times" )
40
+ g.add_edges( execute, compare, :color => "red" )
41
+
42
+ g.output( :png => "#{$0}.png" )
@@ -0,0 +1,31 @@
1
+ #!/usr/bin/ruby
2
+
3
+ $:.unshift( "../lib" );
4
+ require "graphviz"
5
+
6
+ g = nil
7
+ if ARGV[0]
8
+ g = GraphViz::new( "G", "path" => ARGV[0] )
9
+ else
10
+ g = GraphViz::new( "G" )
11
+ end
12
+
13
+ g.node["shape"] = "ellipse"
14
+ g.node["sides"] = "4"
15
+ g.node["peripheries"] = ""
16
+ g.node["color"] = "black"
17
+ g.node["style"] = ""
18
+ g.node["skew"] = "0.0"
19
+ g.node["distortion"] = "0.0"
20
+
21
+ a = g.add_nodes( "a", "shape" => "polygon", "sides" => "5", "peripheries" => "3", "color" => "lightblue", "style" => "filled" )
22
+ b = g.add_nodes( "b" )
23
+ c = g.add_nodes( "c", "shape" => "polygon", "sides" => "4", "skew" => ".4", "label" => "hello world" )
24
+ d = g.add_nodes( "d", "shape" => "invtriangle" )
25
+ e = g.add_nodes( "e", "shape" => "polygon", "sides" => "4", "distortion" => ".7" )
26
+
27
+ g.add_edges( a, b )
28
+ g.add_edges( b, c )
29
+ g.add_edges( b, d )
30
+
31
+ g.output( :png => "#{$0}.png" )
@@ -0,0 +1,22 @@
1
+ #!/usr/bin/ruby
2
+
3
+ $:.unshift( "../lib" );
4
+ require "graphviz"
5
+
6
+ g = nil
7
+ if ARGV[0]
8
+ g = GraphViz::new( "structs", "path" => ARGV[0] )
9
+ else
10
+ g = GraphViz::new( "structs" )
11
+ end
12
+
13
+ g.node["shape"] = "record"
14
+
15
+ struct1 = g.add_nodes( "struct1", "shape" => "record", "label" => "<f0> left|<f1> mid\ dle|<f2> right" )
16
+ struct2 = g.add_nodes( "struct2", "shape" => "record", "label" => "<f0> one|<f1> two" )
17
+ struct3 = g.add_nodes( "struct3", "shape" => "record", "label" => 'hello\nworld |{ b |{c|<here> d|e}| f}| g | h' )
18
+
19
+ g.add_edges( struct1, struct2 )
20
+ g.add_edges( struct1, struct3 )
21
+
22
+ g.output( :png => "#{$0}.png" )
@@ -0,0 +1,32 @@
1
+ #!/usr/bin/ruby
2
+
3
+ $:.unshift( "../lib" );
4
+ require "graphviz"
5
+
6
+ g = nil
7
+ if ARGV[0]
8
+ g = GraphViz::new( "structs", "type" => "graph", "path" => ARGV[0] )
9
+ else
10
+ g = GraphViz::new( "structs", "type" => "graph" )
11
+ end
12
+
13
+ main = g.add_nodes( "main" )
14
+ parse = g.add_nodes( "parse" )
15
+ execute = g.add_nodes( "execute" )
16
+ init = g.add_nodes( "init" )
17
+ cleanup = g.add_nodes( "cleanup" )
18
+ make_string = g.add_nodes( "make_string" )
19
+ printf = g.add_nodes( "printf" )
20
+ compare = g.add_nodes( "compare" )
21
+
22
+ g.add_edges( main, parse )
23
+ g.add_edges( parse, execute )
24
+ g.add_edges( main, init )
25
+ g.add_edges( main, cleanup )
26
+ g.add_edges( execute, make_string )
27
+ g.add_edges( execute, printf )
28
+ g.add_edges( init, make_string )
29
+ g.add_edges( main, printf )
30
+ g.add_edges( execute, compare )
31
+
32
+ g.output( :png => "#{$0}.png" )