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.
- data/README.rdoc +9 -0
- data/examples/sample01.rb +17 -17
- data/examples/sample02.rb +18 -18
- data/examples/sample03.rb +8 -8
- data/examples/sample04.rb +5 -5
- data/examples/sample05.rb +17 -17
- data/examples/sample07.rb +5 -5
- data/examples/sample08.rb +15 -15
- data/examples/sample09.rb +25 -25
- data/examples/sample10.rb +25 -25
- data/examples/sample11.rb +21 -21
- data/examples/sample16.rb +2 -2
- data/examples/sample17.rb +5 -5
- data/examples/sample20.rb +18 -18
- data/examples/sample29.rb +2 -2
- data/examples/sample30.rb +4 -4
- data/examples/sample31.rb +3 -3
- data/examples/sample36.rb +5 -5
- data/examples/sample37.rb +8 -8
- data/examples/sample38.rb +2 -2
- data/examples/sample39.rb +6 -6
- data/examples/sample40.rb +4 -4
- data/examples/sample42.rb +14 -14
- data/examples/sample43.rb +7 -7
- data/examples/sample44.rb +3 -3
- data/examples/sample45.rb +1 -1
- data/examples/sample46.rb +18 -18
- data/examples/sample54.rb +2 -2
- data/examples/sample55.rb +4 -4
- data/examples/sample58.rb +7 -7
- data/examples/sample60.rb +3 -3
- data/examples/sample61.rb +3 -3
- data/examples/sample62.rb +3 -3
- data/examples/sample66.rb +4 -0
- data/examples/sample67.rb +10 -0
- data/examples/sample68.rb +27 -0
- data/lib/ext/gvpr/dot2ruby.g +2 -2
- data/lib/graphviz.rb +91 -27
- data/lib/graphviz/constants.rb +1 -1
- data/lib/graphviz/core_ext.rb +0 -9
- data/lib/graphviz/dsl.rb +3 -3
- data/lib/graphviz/edge.rb +6 -6
- data/lib/graphviz/family_tree/couple.rb +8 -8
- data/lib/graphviz/family_tree/person.rb +10 -10
- data/lib/graphviz/graphml.rb +3 -3
- data/lib/graphviz/node.rb +2 -2
- data/lib/graphviz/theory.rb +37 -2
- data/lib/graphviz/xml.rb +4 -4
- data/ruby-graphviz.gemspec +2 -13
- data/test/test_graph.rb +25 -25
- data/test/test_search.rb +32 -0
- data/test/test_theory.rb +1 -1
- metadata +11 -13
data/examples/sample20.rb
CHANGED
@@ -27,21 +27,21 @@ GraphViz::new( "g", :rankdir => "LR", :type => "digraph" ) { |g|
|
|
27
27
|
g.node11( :label => "<f0> (nil)| <f1> | <f2> |-1" )
|
28
28
|
g.node12( :label => "<f0> 0xf7fc43e0| | |1" )
|
29
29
|
|
30
|
-
g.
|
31
|
-
g.
|
32
|
-
g.
|
33
|
-
g.
|
34
|
-
g.
|
35
|
-
g.
|
36
|
-
g.
|
37
|
-
g.
|
38
|
-
g.
|
39
|
-
g.
|
40
|
-
g.
|
41
|
-
g.
|
42
|
-
g.
|
43
|
-
g.
|
44
|
-
g.
|
45
|
-
g.
|
46
|
-
g.
|
47
|
-
}.output( :png => "#{$0}.png" )
|
30
|
+
g.add_edges( g.node0(:f0), g.node1(:f0) )
|
31
|
+
g.add_edges( g.node0(:f1), g.node2(:f0) )
|
32
|
+
g.add_edges( g.node1(:f0), g.node3(:f0) )
|
33
|
+
g.add_edges( g.node1(:f1), g.node4(:f0) )
|
34
|
+
g.add_edges( g.node1(:f2), g.node5(:f0) )
|
35
|
+
g.add_edges( g.node4(:f0), g.node3(:f0) )
|
36
|
+
g.add_edges( g.node4(:f1), g.node6(:f0) )
|
37
|
+
g.add_edges( g.node4(:f2), g.node10(:f0) )
|
38
|
+
g.add_edges( g.node6(:f0), g.node3(:f0) )
|
39
|
+
g.add_edges( g.node6(:f1), g.node7(:f0) )
|
40
|
+
g.add_edges( g.node6(:f2), g.node9(:f0) )
|
41
|
+
g.add_edges( g.node7(:f0), g.node3(:f0) )
|
42
|
+
g.add_edges( g.node7(:f1), g.node1(:f0) )
|
43
|
+
g.add_edges( g.node7(:f2), g.node8(:f0) )
|
44
|
+
g.add_edges( g.node10(:f1), g.node11(:f0) )
|
45
|
+
g.add_edges( g.node10(:f2), g.node12(:f0) )
|
46
|
+
g.add_edges( g.node11(:f2), g.node1(:f0) )
|
47
|
+
}.output( :png => "#{$0}.png" )
|
data/examples/sample29.rb
CHANGED
@@ -4,5 +4,5 @@ $:.unshift( "../lib" );
|
|
4
4
|
require "graphviz"
|
5
5
|
|
6
6
|
GraphViz.new(:G){ |g|
|
7
|
-
g.
|
8
|
-
}.save( :svg => "#{$0}.svg" )
|
7
|
+
g.add_nodes("\"Hello.\"\nHow are you ?", :href => "http://www.website.com", :tooltip => "\"Hello.\"\nHow are you ?", :shape => "ellipse", :color => "#FF0000")
|
8
|
+
}.save( :svg => "#{$0}.svg" )
|
data/examples/sample30.rb
CHANGED
@@ -5,8 +5,8 @@ require "graphviz"
|
|
5
5
|
|
6
6
|
GraphViz.new(:g){ |g|
|
7
7
|
g[:center] = true
|
8
|
-
a = g.
|
9
|
-
b = g.
|
10
|
-
c = g.
|
8
|
+
a = g.add_nodes("A", :shape => "sdl_procedure_start", :peripheries => 0 )
|
9
|
+
b = g.add_nodes("B", :shape => "sdl_save", :peripheries => 0)
|
10
|
+
c = g.add_nodes("n", :shape => "box", :label => "\\G::\\N\\r")
|
11
11
|
a << b << c
|
12
|
-
}.save( :ps => "#{$0}.ps", :extlib => File.join( File.dirname(__FILE__), "sdlshapes", "sdl.ps" ) )
|
12
|
+
}.save( :ps => "#{$0}.ps", :extlib => File.join( File.dirname(__FILE__), "sdlshapes", "sdl.ps" ) )
|
data/examples/sample31.rb
CHANGED
@@ -4,7 +4,7 @@ $:.unshift( "../lib" );
|
|
4
4
|
require "graphviz"
|
5
5
|
|
6
6
|
GraphViz.new(:g){ |g|
|
7
|
-
a = g.
|
8
|
-
b = g.
|
7
|
+
a = g.add_nodes( "A:B:C", :shape => :record )
|
8
|
+
b = g.add_nodes( "D:E:F", :shape => :ellipse )
|
9
9
|
a << b
|
10
|
-
}.save( :png => "#{$0}.png" )
|
10
|
+
}.save( :png => "#{$0}.png" )
|
data/examples/sample36.rb
CHANGED
@@ -13,18 +13,18 @@ GraphViz.graph( :G ) { |g|
|
|
13
13
|
c = g.subgraph( :rank => "same" )
|
14
14
|
|
15
15
|
100.times do |i|
|
16
|
-
current_node = c.
|
16
|
+
current_node = c.add_nodes( "N#{node_number}", :shape => "point", :label => "" )
|
17
17
|
last_node = new_line[-1]
|
18
18
|
unless last_node.nil?
|
19
|
-
c.
|
19
|
+
c.add_edges( last_node, current_node )
|
20
20
|
end
|
21
21
|
new_line << current_node
|
22
22
|
top_first_node = last_line.shift
|
23
23
|
unless top_first_node.nil?
|
24
|
-
g.
|
24
|
+
g.add_edges( top_first_node, current_node )
|
25
25
|
top_second_node = last_line.shift
|
26
26
|
unless top_second_node.nil?
|
27
|
-
g.
|
27
|
+
g.add_edges( top_second_node, current_node )
|
28
28
|
last_line.unshift( top_second_node )
|
29
29
|
end
|
30
30
|
end
|
@@ -32,4 +32,4 @@ GraphViz.graph( :G ) { |g|
|
|
32
32
|
end
|
33
33
|
last_line = new_line
|
34
34
|
end
|
35
|
-
}.output( :png => "#{$0}.png" )
|
35
|
+
}.output( :png => "#{$0}.png" )
|
data/examples/sample37.rb
CHANGED
@@ -9,7 +9,7 @@ g = GraphViz::new( "Solarsys",
|
|
9
9
|
)
|
10
10
|
|
11
11
|
# the star
|
12
|
-
sun = g.
|
12
|
+
sun = g.add_nodes(
|
13
13
|
'Sun',
|
14
14
|
:shape => "circle",
|
15
15
|
:penwidth => 2,
|
@@ -24,7 +24,7 @@ planets = Hash.new
|
|
24
24
|
# The Earth and the Moon - in the same subgraph\rank
|
25
25
|
g.subgraph { |c|
|
26
26
|
c[:rank => 'same']
|
27
|
-
planets['Moon'] = c.
|
27
|
+
planets['Moon'] = c.add_nodes(
|
28
28
|
'Moon',
|
29
29
|
:shape => "circle",
|
30
30
|
:penwidth => 2,
|
@@ -33,7 +33,7 @@ g.subgraph { |c|
|
|
33
33
|
:fillcolor => "red",
|
34
34
|
:label => "Moon\n"
|
35
35
|
)
|
36
|
-
planets['Earth'] = c.
|
36
|
+
planets['Earth'] = c.add_nodes(
|
37
37
|
'Earth',
|
38
38
|
:shape => "circle",
|
39
39
|
:penwidth => 2,
|
@@ -42,7 +42,7 @@ g.subgraph { |c|
|
|
42
42
|
:fillcolor => "blue",
|
43
43
|
:label => "Earth\n"
|
44
44
|
)
|
45
|
-
c.
|
45
|
+
c.add_edges( planets['Moon'], planets['Earth'],
|
46
46
|
:penwidth => 2,
|
47
47
|
:labeltooltip => "distance",
|
48
48
|
:color => "black"
|
@@ -51,7 +51,7 @@ g.subgraph { |c|
|
|
51
51
|
|
52
52
|
}
|
53
53
|
|
54
|
-
g.
|
54
|
+
g.add_edges( sun, planets['Earth'],
|
55
55
|
:penwidth => 2,
|
56
56
|
:labeltooltip => "distance",
|
57
57
|
:color => "black"
|
@@ -65,7 +65,7 @@ i = 0
|
|
65
65
|
# that doesnt seem to work ...
|
66
66
|
g.subgraph { |c|
|
67
67
|
c[:rank => "same"]
|
68
|
-
planets[p] = c.
|
68
|
+
planets[p] = c.add_nodes(
|
69
69
|
p,
|
70
70
|
:shape => "circle",
|
71
71
|
:penwidth => 2,
|
@@ -74,7 +74,7 @@ i = 0
|
|
74
74
|
:style => :filled,
|
75
75
|
:label => "#{p}\n"
|
76
76
|
)
|
77
|
-
c.
|
77
|
+
c.add_edges( sun, planets[p],
|
78
78
|
:penwidth => 2,
|
79
79
|
:label => "distance",
|
80
80
|
:color => "black"
|
@@ -84,4 +84,4 @@ i = 0
|
|
84
84
|
}
|
85
85
|
|
86
86
|
g.output( :png => "#{$0}.png" )
|
87
|
-
g.output( :none => "#{$0}.dot" )
|
87
|
+
g.output( :none => "#{$0}.dot" )
|
data/examples/sample38.rb
CHANGED
@@ -4,9 +4,9 @@ require "graphviz"
|
|
4
4
|
|
5
5
|
g = GraphViz::new( :G ) { |g|
|
6
6
|
g.a[:label => "ε"]
|
7
|
-
g.
|
7
|
+
g.add_nodes( "b", :label => "ε" )
|
8
8
|
g.c[:label => 'ε']
|
9
|
-
g.
|
9
|
+
g.add_nodes( "d", :label => 'ε' )
|
10
10
|
}
|
11
11
|
|
12
12
|
puts g.output( :none => String, :png => "#{$0}.png", :path => "/usr/local/bin" )
|
data/examples/sample39.rb
CHANGED
@@ -2,10 +2,10 @@ $:.unshift( "../lib" );
|
|
2
2
|
require "graphviz"
|
3
3
|
|
4
4
|
g = GraphViz::new( "G", :type => "graph" )
|
5
|
-
n1 = g.
|
6
|
-
n2 = g.
|
7
|
-
n3 = g.
|
8
|
-
e1 = g.
|
5
|
+
n1 = g.add_nodes( "A" )
|
6
|
+
n2 = g.add_nodes( "B" )
|
7
|
+
n3 = g.add_nodes( "C" )
|
8
|
+
e1 = g.add_edges( n1, n2 )
|
9
9
|
e1[:dir] = 'forward'
|
10
|
-
e2 = g.
|
11
|
-
g.output( :png => "#{$0}.png" )
|
10
|
+
e2 = g.add_edges( n1, n3 )
|
11
|
+
g.output( :png => "#{$0}.png" )
|
data/examples/sample40.rb
CHANGED
@@ -3,15 +3,15 @@ require "graphviz"
|
|
3
3
|
|
4
4
|
graph = GraphViz.new( :G, :type => :digraph )
|
5
5
|
|
6
|
-
node1 = graph.
|
6
|
+
node1 = graph.add_nodes("hello:world",
|
7
7
|
"shape" => "record",
|
8
8
|
"label" => "<left>|<f1> 1|<right>" )
|
9
9
|
|
10
|
-
node2 = graph.
|
10
|
+
node2 = graph.add_nodes("2",
|
11
11
|
"shape" => "record",
|
12
12
|
"label" => "<left>|<f1> 2|<right>" )
|
13
13
|
|
14
|
-
graph.
|
15
|
-
graph.
|
14
|
+
graph.add_edges( {node1 => :left}, node2 )
|
15
|
+
graph.add_edges( {node2 => :right}, node1 )
|
16
16
|
|
17
17
|
puts graph.output( :none => String, :png => "#{$0}.png" )
|
data/examples/sample42.rb
CHANGED
@@ -15,21 +15,21 @@ c0["label"] = "Environnement de Brad !"
|
|
15
15
|
c0["style"] = "filled"
|
16
16
|
c0["color"] = "blue"
|
17
17
|
|
18
|
-
ja = c0.
|
19
|
-
bp = c0.
|
20
|
-
aj = c0.
|
18
|
+
ja = c0.add_nodes( "Jennifer_Aniston", :style => "filled", :color => "red" )
|
19
|
+
bp = c0.add_nodes( "Brad_Pitt", :style => "filled", :color => "white" )
|
20
|
+
aj = c0.add_nodes( "Angelina_Jolie", :style => "filled", :color => "green" )
|
21
21
|
|
22
|
-
c0.
|
23
|
-
c0.
|
22
|
+
c0.add_edges( ja, bp ) # On ete mariés
|
23
|
+
c0.add_edges( bp, aj ) # Sont ensemble
|
24
24
|
|
25
|
-
jv = g.
|
26
|
-
md = g.
|
27
|
-
gr = g.
|
25
|
+
jv = g.add_nodes( "John_Voight", :label => "John Voight", :shape => "rectangle" )
|
26
|
+
md = g.add_nodes( "Madonna" )
|
27
|
+
gr = g.add_nodes( "Guy_Ritchie" )
|
28
28
|
|
29
|
-
g.
|
30
|
-
g.
|
31
|
-
g.
|
32
|
-
g.
|
33
|
-
g.
|
29
|
+
g.add_edges( aj, jv ) # est la fille de
|
30
|
+
g.add_edges( jv, aj ) # est le pere de
|
31
|
+
g.add_edges( bp, jv, :color => "red", :label => "Est le beau fils de" ) # Beau fils
|
32
|
+
g.add_edges( bp, gr )
|
33
|
+
g.add_edges( gr, md )
|
34
34
|
|
35
|
-
g.output( :png => "#{$0}.png" )
|
35
|
+
g.output( :png => "#{$0}.png" )
|
data/examples/sample43.rb
CHANGED
@@ -5,9 +5,9 @@ g = GraphViz::new( "structs" )
|
|
5
5
|
|
6
6
|
g.node["shape"] = "plaintext"
|
7
7
|
|
8
|
-
g.
|
8
|
+
g.add_nodes( "HTML" )
|
9
9
|
|
10
|
-
g.
|
10
|
+
g.add_nodes( "struct1", "label" => '<<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0">
|
11
11
|
<TR>
|
12
12
|
<TD>left</TD>
|
13
13
|
<TD PORT="f1">mid dle</TD>
|
@@ -15,12 +15,12 @@ g.add_node( "struct1", "label" => '<<TABLE BORDER="0" CELLBORDER="1" CELLSPACING
|
|
15
15
|
</TR>
|
16
16
|
</TABLE>>' )
|
17
17
|
|
18
|
-
g.
|
19
|
-
g.
|
18
|
+
g.add_nodes( "struct2", "label" => '<<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0"> <TR><TD PORT="f0">one</TD><TD>two</TD></TR> </TABLE>>' )
|
19
|
+
g.add_nodes( "struct3", "label" => '<<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0" CELLPADDING="4"> <TR> <TD ROWSPAN="3">hello<BR/>world</TD> <TD COLSPAN="3">b</TD> <TD ROWSPAN="3">g</TD> <TD ROWSPAN="3">h</TD> </TR> <TR> <TD>c</TD><TD PORT="here">d</TD><TD>e</TD> </TR> <TR> <TD COLSPAN="3">f</TD> </TR> </TABLE>>' )
|
20
20
|
|
21
|
-
g.
|
22
|
-
g.
|
21
|
+
g.add_edges( {"struct1" => :f1}, {"struct2" => :f0} )
|
22
|
+
g.add_edges( {"struct1" => :f2}, {"struct3" => :here} )
|
23
23
|
|
24
|
-
g.
|
24
|
+
g.add_edges( "HTML", "struct1" )
|
25
25
|
|
26
26
|
g.output( :path => '/usr/local/bin/', :png => "#{$0}.png" )
|
data/examples/sample44.rb
CHANGED
@@ -89,9 +89,9 @@ g.edge["arrowhead"] = "normal"
|
|
89
89
|
"rveervee"
|
90
90
|
].each { |s|
|
91
91
|
p = "p_" << s
|
92
|
-
g.
|
93
|
-
g.
|
94
|
-
g.
|
92
|
+
g.add_nodes( p, "shape" => "point" )
|
93
|
+
g.add_nodes( s )
|
94
|
+
g.add_edges( p, s, "arrowhead" => s )
|
95
95
|
}
|
96
96
|
|
97
97
|
g.output( :png => "#{$0}.png" )
|
data/examples/sample45.rb
CHANGED
@@ -18,7 +18,7 @@ g.node["shape"] = "ellipse"
|
|
18
18
|
"doubleoctagon", "tripleoctagon", "invtriangle", "invtrapezium", "invhouse",
|
19
19
|
"Mdiamond", "Msquare", "Mcircle", "rect", "rectangle", "none", "note", "tab", "folder",
|
20
20
|
"box3d", "component" ].each { |s|
|
21
|
-
g.
|
21
|
+
g.add_nodes( s, "shape" => s )
|
22
22
|
}
|
23
23
|
|
24
24
|
g.output( :png => "#{$0}.png")
|
data/examples/sample46.rb
CHANGED
@@ -20,24 +20,24 @@ g.edge["label"] = ""
|
|
20
20
|
g["size"] = "4,4"
|
21
21
|
|
22
22
|
g.node["shape"] = "box"
|
23
|
-
main = g.
|
23
|
+
main = g.add_nodes( "main" )
|
24
24
|
g.node["shape"] = "ellipse"
|
25
|
-
parse = g.
|
26
|
-
execute = g.
|
27
|
-
init = g.
|
28
|
-
cleanup = g.
|
29
|
-
make_string = g.
|
30
|
-
printf = g.
|
31
|
-
compare = g.
|
32
|
-
|
33
|
-
g.
|
34
|
-
g.
|
35
|
-
g.
|
36
|
-
g.
|
37
|
-
g.
|
38
|
-
g.
|
39
|
-
g.
|
40
|
-
g.
|
41
|
-
g.
|
25
|
+
parse = g.add_nodes( "parse" )
|
26
|
+
execute = g.add_nodes( "execute" )
|
27
|
+
init = g.add_nodes( "init" )
|
28
|
+
cleanup = g.add_nodes( "cleanup" )
|
29
|
+
make_string = g.add_nodes( "make_string", "label" => 'make a\nstring' )
|
30
|
+
printf = g.add_nodes( "printf" )
|
31
|
+
compare = g.add_nodes( "compare", "shape" => "box", "style" => "filled", "color" => ".7 .3 1.0" )
|
32
|
+
|
33
|
+
g.add_edges( main, parse, "weight" => "8" )
|
34
|
+
g.add_edges( parse, execute )
|
35
|
+
g.add_edges( main, init, "style" => "dotted" )
|
36
|
+
g.add_edges( main, cleanup )
|
37
|
+
g.add_edges( execute, make_string )
|
38
|
+
g.add_edges( execute, printf )
|
39
|
+
g.add_edges( init, make_string )
|
40
|
+
g.add_edges( main, printf, "color" => "red", "style" => "bold", "label" => "100 times" )
|
41
|
+
g.add_edges( execute, compare, "color" => "red" )
|
42
42
|
|
43
43
|
g.output( :png => "#{$0}.png" )
|
data/examples/sample54.rb
CHANGED
@@ -20,7 +20,7 @@ type = ["box", "point"]
|
|
20
20
|
GraphViz.graph( :G, :use => :neato ) { |g|
|
21
21
|
(1..5).each do |x|
|
22
22
|
(1..5).each do |y|
|
23
|
-
g.
|
23
|
+
g.add_nodes( "n#{x}x#{y}", :pos => "#{x},#{y}!", :shape => type.rotate )
|
24
24
|
end
|
25
25
|
end
|
26
|
-
}.output( :png => "#{$0}.png" )
|
26
|
+
}.output( :png => "#{$0}.png" )
|
data/examples/sample55.rb
CHANGED
@@ -3,7 +3,7 @@ require 'graphviz'
|
|
3
3
|
|
4
4
|
puts GraphViz.graph( :G ) { |g|
|
5
5
|
g[:label] = "<<b>This</b> is <i>a</i> <b>test</b>>"
|
6
|
-
n1 = g.
|
7
|
-
n2 = g.
|
8
|
-
g.
|
9
|
-
}.output( :png => "#{$0}.png", :none => String )
|
6
|
+
n1 = g.add_nodes( "N1", :label => '<<b>node 1</b>>')
|
7
|
+
n2 = g.add_nodes( "N2", :label => '<<b>node 2</b>>')
|
8
|
+
g.add_edges( n1, n2, :label => '<<u>edge</u>>')
|
9
|
+
}.output( :png => "#{$0}.png", :none => String )
|
data/examples/sample58.rb
CHANGED
@@ -14,20 +14,20 @@ start_level=6
|
|
14
14
|
# or @g = GraphViz.digraph(:G, :strict => true)
|
15
15
|
# or @g = GraphViz.strict_digraph(:G)
|
16
16
|
|
17
|
-
def
|
17
|
+
def add_nodes(level, depth, parent)
|
18
18
|
if depth<@max_depth
|
19
19
|
current=[level, depth].join(",")
|
20
20
|
|
21
21
|
sub=level<=>@min_level
|
22
22
|
add=@max_level<=>level
|
23
|
-
|
24
|
-
|
23
|
+
add_nodes(level-sub, depth+1, current)
|
24
|
+
add_nodes(level+add, depth+1, current)
|
25
25
|
|
26
|
-
@g.
|
27
|
-
@g.
|
26
|
+
@g.add_nodes(current).label=level.to_s
|
27
|
+
@g.add_edges(parent, current) unless parent=="00"
|
28
28
|
end
|
29
29
|
end
|
30
30
|
|
31
|
-
|
31
|
+
add_nodes(start_level, 0, "00")
|
32
32
|
|
33
|
-
@g.output( :png => "#{$0}.png" )
|
33
|
+
@g.output( :png => "#{$0}.png" )
|
data/examples/sample60.rb
CHANGED
@@ -5,8 +5,8 @@ require "graphviz"
|
|
5
5
|
|
6
6
|
asm = GraphViz::new( "My ASM" )
|
7
7
|
|
8
|
-
my = asm.
|
9
|
-
asmn = asm.
|
10
|
-
asm.
|
8
|
+
my = asm.add_nodes("My")
|
9
|
+
asmn = asm.add_nodes("ASM")
|
10
|
+
asm.add_edges(my, asmn)
|
11
11
|
|
12
12
|
asm.output( :png => "#{$0}.png" )
|
data/examples/sample61.rb
CHANGED
data/examples/sample62.rb
CHANGED
@@ -5,9 +5,9 @@ require "graphviz"
|
|
5
5
|
|
6
6
|
hello_world = GraphViz::new( "" )
|
7
7
|
|
8
|
-
hello = hello_world.
|
9
|
-
world = hello_world.
|
10
|
-
hello_world.
|
8
|
+
hello = hello_world.add_nodes("Hello")
|
9
|
+
world = hello_world.add_nodes("World")
|
10
|
+
hello_world.add_edges(hello, world)
|
11
11
|
|
12
12
|
# final_graph = GraphViz.parse_string( hello_world.output( :dot => String ) )
|
13
13
|
# final_graph.each_node do |_, node|
|