ruby-graphviz 1.0.2 → 1.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (53) hide show
  1. data/README.rdoc +9 -0
  2. data/examples/sample01.rb +17 -17
  3. data/examples/sample02.rb +18 -18
  4. data/examples/sample03.rb +8 -8
  5. data/examples/sample04.rb +5 -5
  6. data/examples/sample05.rb +17 -17
  7. data/examples/sample07.rb +5 -5
  8. data/examples/sample08.rb +15 -15
  9. data/examples/sample09.rb +25 -25
  10. data/examples/sample10.rb +25 -25
  11. data/examples/sample11.rb +21 -21
  12. data/examples/sample16.rb +2 -2
  13. data/examples/sample17.rb +5 -5
  14. data/examples/sample20.rb +18 -18
  15. data/examples/sample29.rb +2 -2
  16. data/examples/sample30.rb +4 -4
  17. data/examples/sample31.rb +3 -3
  18. data/examples/sample36.rb +5 -5
  19. data/examples/sample37.rb +8 -8
  20. data/examples/sample38.rb +2 -2
  21. data/examples/sample39.rb +6 -6
  22. data/examples/sample40.rb +4 -4
  23. data/examples/sample42.rb +14 -14
  24. data/examples/sample43.rb +7 -7
  25. data/examples/sample44.rb +3 -3
  26. data/examples/sample45.rb +1 -1
  27. data/examples/sample46.rb +18 -18
  28. data/examples/sample54.rb +2 -2
  29. data/examples/sample55.rb +4 -4
  30. data/examples/sample58.rb +7 -7
  31. data/examples/sample60.rb +3 -3
  32. data/examples/sample61.rb +3 -3
  33. data/examples/sample62.rb +3 -3
  34. data/examples/sample66.rb +4 -0
  35. data/examples/sample67.rb +10 -0
  36. data/examples/sample68.rb +27 -0
  37. data/lib/ext/gvpr/dot2ruby.g +2 -2
  38. data/lib/graphviz.rb +91 -27
  39. data/lib/graphviz/constants.rb +1 -1
  40. data/lib/graphviz/core_ext.rb +0 -9
  41. data/lib/graphviz/dsl.rb +3 -3
  42. data/lib/graphviz/edge.rb +6 -6
  43. data/lib/graphviz/family_tree/couple.rb +8 -8
  44. data/lib/graphviz/family_tree/person.rb +10 -10
  45. data/lib/graphviz/graphml.rb +3 -3
  46. data/lib/graphviz/node.rb +2 -2
  47. data/lib/graphviz/theory.rb +37 -2
  48. data/lib/graphviz/xml.rb +4 -4
  49. data/ruby-graphviz.gemspec +2 -13
  50. data/test/test_graph.rb +25 -25
  51. data/test/test_search.rb +32 -0
  52. data/test/test_theory.rb +1 -1
  53. metadata +11 -13
data/README.rdoc CHANGED
@@ -16,6 +16,15 @@ Interface to the GraphViz graphing tool
16
16
 
17
17
  == CHANGELOG
18
18
 
19
+ === 1.0.3 :
20
+ * The GraphViz::Theory#moore_dijkstra return a path which contains GraphViz::Node instead of GraphViz::Node#id
21
+ * Add Breadth First Search algorithm (GraphViz::Theory#bfs)
22
+ * Add Depth First Search algorithm (GraphViz::Theory#dfs)
23
+ * Add GraphViz#add_edges (GraphViz#add_edge is deprecated)
24
+ * Add GraphViz#add_nodes (GraphViz#add_node is deprecated)
25
+ * Add GraphViz::generate
26
+ * Remove definition of Array#all?
27
+
19
28
  === 1.0.2 :
20
29
  * Add PageRank algorithm
21
30
  * Major bug corrections
data/examples/sample01.rb CHANGED
@@ -10,23 +10,23 @@ else
10
10
  g = GraphViz::new( "G" )
11
11
  end
12
12
 
13
- main = g.add_node( "main" )
14
- parse = g.add_node( "parse" )
15
- execute = g.add_node( "execute" )
16
- init = g.add_node( "init" )
17
- cleanup = g.add_node( "cleanup" )
18
- make_string = g.add_node( "make_string" )
19
- printf = g.add_node( "printf" )
20
- compare = g.add_node( "compare" )
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
21
 
22
- g.add_edge( main, parse )
23
- g.add_edge( parse, execute )
24
- g.add_edge( main, init )
25
- g.add_edge( main, cleanup )
26
- g.add_edge( execute, make_string )
27
- g.add_edge( execute, printf )
28
- g.add_edge( init, make_string )
29
- g.add_edge( main, printf )
30
- g.add_edge( execute, compare )
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
31
 
32
32
  g.output( :png => "#{$0}.png" )
data/examples/sample02.rb CHANGED
@@ -20,23 +20,23 @@ g.edge[:label] = ""
20
20
 
21
21
  g[:size] = "4,4"
22
22
 
23
- main = g.add_node( "main", :shape => "box" )
24
- parse = g.add_node( "parse" )
25
- execute = g.add_node( "execute" )
26
- init = g.add_node( "init" )
27
- cleanup = g.add_node( "cleanup" )
28
- make_string = g.add_node( "make_string", :label => 'make a\nstring' )
29
- printf = g.add_node( "printf" )
30
- compare = g.add_node( "compare", :shape => "box", :style => "filled", :color => ".7 .3 1.0" )
31
-
32
- g.add_edge( main, parse, :weight => "8" )
33
- g.add_edge( parse, execute )
34
- g.add_edge( main, init, :style => "dotted" )
35
- g.add_edge( main, cleanup )
36
- g.add_edge( execute, make_string )
37
- g.add_edge( execute, printf )
38
- g.add_edge( init, make_string )
39
- g.add_edge( main, printf, :color => "red", :style => "bold", :label => "100 times" )
40
- g.add_edge( execute, compare, :color => "red" )
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
41
 
42
42
  g.output( :png => "#{$0}.png" )
data/examples/sample03.rb CHANGED
@@ -18,14 +18,14 @@ g.node["style"] = ""
18
18
  g.node["skew"] = "0.0"
19
19
  g.node["distortion"] = "0.0"
20
20
 
21
- a = g.add_node( "a", "shape" => "polygon", "sides" => "5", "peripheries" => "3", "color" => "lightblue", "style" => "filled" )
22
- b = g.add_node( "b" )
23
- c = g.add_node( "c", "shape" => "polygon", "sides" => "4", "skew" => ".4", "label" => "hello world" )
24
- d = g.add_node( "d", "shape" => "invtriangle" )
25
- e = g.add_node( "e", "shape" => "polygon", "sides" => "4", "distortion" => ".7" )
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
26
 
27
- g.add_edge( a, b )
28
- g.add_edge( b, c )
29
- g.add_edge( b, d )
27
+ g.add_edges( a, b )
28
+ g.add_edges( b, c )
29
+ g.add_edges( b, d )
30
30
 
31
31
  g.output( :png => "#{$0}.png" )
data/examples/sample04.rb CHANGED
@@ -12,11 +12,11 @@ end
12
12
 
13
13
  g.node["shape"] = "record"
14
14
 
15
- struct1 = g.add_node( "struct1", "shape" => "record", "label" => "<f0> left|<f1> mid\ dle|<f2> right" )
16
- struct2 = g.add_node( "struct2", "shape" => "record", "label" => "<f0> one|<f1> two" )
17
- struct3 = g.add_node( "struct3", "shape" => "record", "label" => 'hello\nworld |{ b |{c|<here> d|e}| f}| g | h' )
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
18
 
19
- g.add_edge( struct1, struct2 )
20
- g.add_edge( struct1, struct3 )
19
+ g.add_edges( struct1, struct2 )
20
+ g.add_edges( struct1, struct3 )
21
21
 
22
22
  g.output( :png => "#{$0}.png" )
data/examples/sample05.rb CHANGED
@@ -10,23 +10,23 @@ else
10
10
  g = GraphViz::new( "structs", "type" => "graph" )
11
11
  end
12
12
 
13
- main = g.add_node( "main" )
14
- parse = g.add_node( "parse" )
15
- execute = g.add_node( "execute" )
16
- init = g.add_node( "init" )
17
- cleanup = g.add_node( "cleanup" )
18
- make_string = g.add_node( "make_string" )
19
- printf = g.add_node( "printf" )
20
- compare = g.add_node( "compare" )
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
21
 
22
- g.add_edge( main, parse )
23
- g.add_edge( parse, execute )
24
- g.add_edge( main, init )
25
- g.add_edge( main, cleanup )
26
- g.add_edge( execute, make_string )
27
- g.add_edge( execute, printf )
28
- g.add_edge( init, make_string )
29
- g.add_edge( main, printf )
30
- g.add_edge( execute, compare )
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
31
 
32
32
  g.output( :png => "#{$0}.png" )
data/examples/sample07.rb CHANGED
@@ -13,11 +13,11 @@ g = GraphViz::new( "structs" )
13
13
 
14
14
  g.node["shape"] = "record"
15
15
 
16
- g.add_node( "struct1", "shape" => "record", "label" => "<f0> left|<f1> middle|<f2> right" )
17
- g.add_node( "struct2", "shape" => "record", "label" => "<f0> one|<f1> two" )
18
- g.add_node( "struct3", "shape" => "record", "label" => 'hello\nworld |{ b |{c|<here> d|e}| f}| g | h' )
16
+ g.add_nodes( "struct1", "shape" => "record", "label" => "<f0> left|<f1> middle|<f2> right" )
17
+ g.add_nodes( "struct2", "shape" => "record", "label" => "<f0> one|<f1> two" )
18
+ g.add_nodes( "struct3", "shape" => "record", "label" => 'hello\nworld |{ b |{c|<here> d|e}| f}| g | h' )
19
19
 
20
- g.add_edge( { "struct1" => :f1}, {"struct2" => :f0} )
21
- g.add_edge( {"struct1" => :f2}, {"struct3" => :here} )
20
+ g.add_edges( { "struct1" => :f1}, {"struct2" => :f0} )
21
+ g.add_edges( {"struct1" => :f2}, {"struct3" => :here} )
22
22
 
23
23
  g.output( :png => "#{$0}.png", :canon => nil )
data/examples/sample08.rb CHANGED
@@ -14,21 +14,21 @@ g.node["shape"] = "record"
14
14
  g.node["width"] = ".1"
15
15
  g.node["height"] = ".1"
16
16
 
17
- g.add_node( "node0", "label" => "<f0> |<f1> |<f2> |<f3> |<f4> |<f5> |<f6> |<f7> | ", "height" => "2.5" )
18
- g.add_node( "node1", "label" => "{<n> n14 | 719 |<p> }", "width" => "1.5" )
19
- g.add_node( "node2", "label" => "{<n> a1 | 805 |<p> }", "width" => "1.5" )
20
- g.add_node( "node3", "label" => "{<n> i9 | 718 |<p> }", "width" => "1.5" )
21
- g.add_node( "node4", "label" => "{<n> e5 | 989 |<p> }", "width" => "1.5" )
22
- g.add_node( "node5", "label" => "{<n> t20 | 959 |<p> }", "width" => "1.5" )
23
- g.add_node( "node6", "label" => "{<n> o15 | 794 |<p> }", "width" => "1.5" )
24
- g.add_node( "node7", "label" => "{<n> s19 | 659 |<p> }", "width" => "1.5" )
17
+ g.add_nodes( "node0", "label" => "<f0> |<f1> |<f2> |<f3> |<f4> |<f5> |<f6> |<f7> | ", "height" => "2.5" )
18
+ g.add_nodes( "node1", "label" => "{<n> n14 | 719 |<p> }", "width" => "1.5" )
19
+ g.add_nodes( "node2", "label" => "{<n> a1 | 805 |<p> }", "width" => "1.5" )
20
+ g.add_nodes( "node3", "label" => "{<n> i9 | 718 |<p> }", "width" => "1.5" )
21
+ g.add_nodes( "node4", "label" => "{<n> e5 | 989 |<p> }", "width" => "1.5" )
22
+ g.add_nodes( "node5", "label" => "{<n> t20 | 959 |<p> }", "width" => "1.5" )
23
+ g.add_nodes( "node6", "label" => "{<n> o15 | 794 |<p> }", "width" => "1.5" )
24
+ g.add_nodes( "node7", "label" => "{<n> s19 | 659 |<p> }", "width" => "1.5" )
25
25
 
26
- g.add_edge( {"node0" => :f0}, {"node1" => :n} )
27
- g.add_edge( {"node0" => :f1}, {"node2" => :n} )
28
- g.add_edge( {"node0" => :f2}, {"node3" => :n} )
29
- g.add_edge( {"node0" => :f5}, {"node4" => :n} )
30
- g.add_edge( {"node0" => :f6}, {"node5" => :n} )
31
- g.add_edge( {"node2" => :p}, {"node6" => :n} )
32
- g.add_edge( {"node4" => :p}, {"node7" => :n} )
26
+ g.add_edges( {"node0" => :f0}, {"node1" => :n} )
27
+ g.add_edges( {"node0" => :f1}, {"node2" => :n} )
28
+ g.add_edges( {"node0" => :f2}, {"node3" => :n} )
29
+ g.add_edges( {"node0" => :f5}, {"node4" => :n} )
30
+ g.add_edges( {"node0" => :f6}, {"node5" => :n} )
31
+ g.add_edges( {"node2" => :p}, {"node6" => :n} )
32
+ g.add_edges( {"node4" => :p}, {"node7" => :n} )
33
33
 
34
34
  g.output( :png => "#{$0}.png" )
data/examples/sample09.rb CHANGED
@@ -19,32 +19,32 @@ c0 = g.add_graph( "cluster0" )
19
19
  c0["label"] = "process #1"
20
20
  c0["style"] = "filled"
21
21
  c0["color"] = "lightgrey"
22
- a0 = c0.add_node( "a0", "style" => "filled", "color" => "white" )
23
- a1 = c0.add_node( "a1", "style" => "filled", "color" => "white" )
24
- a2 = c0.add_node( "a2", "style" => "filled", "color" => "white" )
25
- a3 = c0.add_node( "a3", "style" => "filled", "color" => "white" )
26
- c0.add_edge( a0, a1 )
27
- c0.add_edge( a1, a2 )
28
- c0.add_edge( a2, a3 )
22
+ a0 = c0.add_nodes( "a0", "style" => "filled", "color" => "white" )
23
+ a1 = c0.add_nodes( "a1", "style" => "filled", "color" => "white" )
24
+ a2 = c0.add_nodes( "a2", "style" => "filled", "color" => "white" )
25
+ a3 = c0.add_nodes( "a3", "style" => "filled", "color" => "white" )
26
+ c0.add_edges( a0, a1 )
27
+ c0.add_edges( a1, a2 )
28
+ c0.add_edges( a2, a3 )
29
29
 
30
30
  c1 = g.add_graph( "cluster1", "label" => "process #2" )
31
- b0 = c1.add_node( "b0", "style" => "filled", "color" => "blue" )
32
- b1 = c1.add_node( "b1", "style" => "filled", "color" => "blue" )
33
- b2 = c1.add_node( "b2", "style" => "filled", "color" => "blue" )
34
- b3 = c1.add_node( "b3", "style" => "filled", "color" => "blue" )
35
- c1.add_edge( b0, b1 )
36
- c1.add_edge( b1, b2 )
37
- c1.add_edge( b2, b3 )
38
-
39
- start = g.add_node( "start", "shape" => "Mdiamond" )
40
- endn = g.add_node( "end", "shape" => "Msquare" )
41
-
42
- g.add_edge( start, a0 )
43
- g.add_edge( start, b0 )
44
- g.add_edge( a1, b3 )
45
- g.add_edge( b2, a3 )
46
- g.add_edge( a3, a0 )
47
- g.add_edge( a3, endn )
48
- g.add_edge( b3, endn )
31
+ b0 = c1.add_nodes( "b0", "style" => "filled", "color" => "blue" )
32
+ b1 = c1.add_nodes( "b1", "style" => "filled", "color" => "blue" )
33
+ b2 = c1.add_nodes( "b2", "style" => "filled", "color" => "blue" )
34
+ b3 = c1.add_nodes( "b3", "style" => "filled", "color" => "blue" )
35
+ c1.add_edges( b0, b1 )
36
+ c1.add_edges( b1, b2 )
37
+ c1.add_edges( b2, b3 )
38
+
39
+ start = g.add_nodes( "start", "shape" => "Mdiamond" )
40
+ endn = g.add_nodes( "end", "shape" => "Msquare" )
41
+
42
+ g.add_edges( start, a0 )
43
+ g.add_edges( start, b0 )
44
+ g.add_edges( a1, b3 )
45
+ g.add_edges( b2, a3 )
46
+ g.add_edges( a3, a0 )
47
+ g.add_edges( a3, endn )
48
+ g.add_edges( b3, endn )
49
49
 
50
50
  g.output( :png => "#{$0}.png" )
data/examples/sample10.rb CHANGED
@@ -19,32 +19,32 @@ c0 = g.add_graph( "cluster0" )
19
19
  c0["label"] = "process #1"
20
20
  c0["style"] = "filled"
21
21
  c0["color"] = "lightgrey"
22
- a0 = c0.add_node( "a0", "style" => "filled", "color" => "white" )
23
- a1 = c0.add_node( "a1", "style" => "filled", "color" => "white" )
24
- a2 = c0.add_node( "a2", "style" => "filled", "color" => "white" )
25
- a3 = c0.add_node( "a3", "style" => "filled", "color" => "white" )
26
- c0.add_edge( a0, a1 )
27
- c0.add_edge( a1, a2 )
28
- c0.add_edge( a2, a3 )
22
+ a0 = c0.add_nodes( "a0", "style" => "filled", "color" => "white" )
23
+ a1 = c0.add_nodes( "a1", "style" => "filled", "color" => "white" )
24
+ a2 = c0.add_nodes( "a2", "style" => "filled", "color" => "white" )
25
+ a3 = c0.add_nodes( "a3", "style" => "filled", "color" => "white" )
26
+ c0.add_edges( a0, a1 )
27
+ c0.add_edges( a1, a2 )
28
+ c0.add_edges( a2, a3 )
29
29
 
30
30
  c1 = g.add_graph( "cluster1", "label" => "process #2" )
31
- b0 = c1.add_node( "b0", "style" => "filled", "color" => "blue" )
32
- b1 = c1.add_node( "b1", "style" => "filled", "color" => "blue" )
33
- b2 = c1.add_node( "b2", "style" => "filled", "color" => "blue" )
34
- b3 = c1.add_node( "b3", "style" => "filled", "color" => "blue" )
35
- c1.add_edge( b0, b1 )
36
- c1.add_edge( b1, b2 )
37
- c1.add_edge( b2, b3 )
38
-
39
- start = g.add_node( "start", "shape" => "Mdiamond" )
40
- endn = g.add_node( "end", "shape" => "Msquare" )
41
-
42
- g.add_edge( start, a0 )
43
- g.add_edge( start, b0 )
44
- g.add_edge( a1, b3 )
45
- g.add_edge( b2, a3 )
46
- g.add_edge( a3, a0 )
47
- g.add_edge( a3, endn )
48
- g.add_edge( b3, endn )
31
+ b0 = c1.add_nodes( "b0", "style" => "filled", "color" => "blue" )
32
+ b1 = c1.add_nodes( "b1", "style" => "filled", "color" => "blue" )
33
+ b2 = c1.add_nodes( "b2", "style" => "filled", "color" => "blue" )
34
+ b3 = c1.add_nodes( "b3", "style" => "filled", "color" => "blue" )
35
+ c1.add_edges( b0, b1 )
36
+ c1.add_edges( b1, b2 )
37
+ c1.add_edges( b2, b3 )
38
+
39
+ start = g.add_nodes( "start", "shape" => "Mdiamond" )
40
+ endn = g.add_nodes( "end", "shape" => "Msquare" )
41
+
42
+ g.add_edges( start, a0 )
43
+ g.add_edges( start, b0 )
44
+ g.add_edges( a1, b3 )
45
+ g.add_edges( b2, a3 )
46
+ g.add_edges( a3, a0 )
47
+ g.add_edges( a3, endn )
48
+ g.add_edges( b3, endn )
49
49
 
50
50
  g.output( :png => "#{$0}.png" )
data/examples/sample11.rb CHANGED
@@ -15,28 +15,28 @@ graph.edge["lhead"] = ""
15
15
  graph.edge["ltail"] = ""
16
16
 
17
17
  c0 = graph.add_graph( "cluster0" )
18
- a = c0.add_node( "a" )
19
- b = c0.add_node( "b" )
20
- c = c0.add_node( "c" )
21
- d = c0.add_node( "d" )
22
- c0.add_edge( a, b )
23
- c0.add_edge( a, c )
24
- c0.add_edge( b, d )
25
- c0.add_edge( c, d )
18
+ a = c0.add_nodes( "a" )
19
+ b = c0.add_nodes( "b" )
20
+ c = c0.add_nodes( "c" )
21
+ d = c0.add_nodes( "d" )
22
+ c0.add_edges( a, b )
23
+ c0.add_edges( a, c )
24
+ c0.add_edges( b, d )
25
+ c0.add_edges( c, d )
26
26
 
27
27
  c1 = graph.add_graph( "cluster1" )
28
- e = c1.add_node( "e" )
29
- f = c1.add_node( "f" )
30
- g = c1.add_node( "g" )
31
- c1.add_edge( e, g )
32
- c1.add_edge( e, f )
33
-
34
- h = graph.add_node( "h" )
35
-
36
- graph.add_edge( b, f, "lhead" => "cluster1" )
37
- graph.add_edge( d, e )
38
- graph.add_edge( c, g, "ltail" => "cluster0", "lhead" => "cluster1" )
39
- graph.add_edge( c, e, "ltail" => "cluster0" )
40
- graph.add_edge( d, h )
28
+ e = c1.add_nodes( "e" )
29
+ f = c1.add_nodes( "f" )
30
+ g = c1.add_nodes( "g" )
31
+ c1.add_edges( e, g )
32
+ c1.add_edges( e, f )
33
+
34
+ h = graph.add_nodes( "h" )
35
+
36
+ graph.add_edges( b, f, "lhead" => "cluster1" )
37
+ graph.add_edges( d, e )
38
+ graph.add_edges( c, g, "ltail" => "cluster0", "lhead" => "cluster1" )
39
+ graph.add_edges( c, e, "ltail" => "cluster0" )
40
+ graph.add_edges( d, h )
41
41
 
42
42
  graph.output( :png => "#{$0}.png" )
data/examples/sample16.rb CHANGED
@@ -4,5 +4,5 @@ $:.unshift( "../lib" );
4
4
  require "graphviz"
5
5
 
6
6
  GraphViz::new( "G", :type => "graph", :rankdir => "LR" ) { |graph|
7
- graph.add_edge( [graph.a, graph.b, graph.c], [ graph.d, graph.e, graph.f ] )
8
- }.output( :path => '/usr/local/bin/', :png => "#{$0}.png" )
7
+ graph.add_edges( [graph.a, graph.b, graph.c], [ graph.d, graph.e, graph.f ] )
8
+ }.output( :path => '/usr/local/bin/', :png => "#{$0}.png" )
data/examples/sample17.rb CHANGED
@@ -13,18 +13,18 @@ GraphViz::new( "G", :type => "graph", :rankdir => "LR", :bgcolor => "#808080" )
13
13
  _ = {}
14
14
 
15
15
  ("1".."8").each do |v|
16
- _[v] = graph.add_node( v, :shape => "circle", :style => "invis")
16
+ _[v] = graph.add_nodes( v, :shape => "circle", :style => "invis")
17
17
  end
18
18
  ["10","20","30","40","50","60","70","80"].each do |v|
19
- _[v] = graph.add_node( v, :shape => "circle", :style => "invis")
19
+ _[v] = graph.add_nodes( v, :shape => "circle", :style => "invis")
20
20
  end
21
21
 
22
22
  ("a".."x").each do |v|
23
- _[v] = graph.add_node( v, :shape => "circle")
23
+ _[v] = graph.add_nodes( v, :shape => "circle")
24
24
  end
25
25
 
26
26
  ("A".."X").each do |v|
27
- _[v] = graph.add_node( v, :shape => "diamond")
27
+ _[v] = graph.add_nodes( v, :shape => "diamond")
28
28
  end
29
29
 
30
30
  (_["1"] << _["a"])[:color]="#0000ff"
@@ -89,4 +89,4 @@ GraphViz::new( "G", :type => "graph", :rankdir => "LR", :bgcolor => "#808080" )
89
89
  _["V"] << _["60"]
90
90
  _["W"] << _["70"]
91
91
  _["X"] << _["80"]
92
- }.output( :path => '/usr/local/bin/', :png => "#{$0}.png" )
92
+ }.output( :path => '/usr/local/bin/', :png => "#{$0}.png" )