ruby-graphviz_c 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gemrc +0 -0
- data/.gitignore +9 -0
- data/.travis.yml +7 -0
- data/AUTHORS.rdoc +33 -0
- data/CHANGELOG.rdoc +287 -0
- data/COPYING.rdoc +133 -0
- data/Gemfile +4 -0
- data/README.rdoc +206 -0
- data/Rakefile +71 -0
- data/bin/dot2ruby +91 -0
- data/bin/gem2gv +165 -0
- data/bin/git2gv +167 -0
- data/bin/ruby2gv +234 -0
- data/bin/xml2gv +96 -0
- data/examples/dot/JSP.dot +52 -0
- data/examples/dot/balanced.dot +36 -0
- data/examples/dot/cluster.dot +30 -0
- data/examples/dot/dotgraph.dot +28 -0
- data/examples/dot/fsm.dot +20 -0
- data/examples/dot/genetic.dot +118 -0
- data/examples/dot/hello.dot +1 -0
- data/examples/dot/hello_test.rb +33 -0
- data/examples/dot/lion_share.dot +103 -0
- data/examples/dot/prof.dot +150 -0
- data/examples/dot/psg.dot +28 -0
- data/examples/dot/rank.dot +6 -0
- data/examples/dot/sdh.dot +284 -0
- data/examples/dot/siblings.dot +492 -0
- data/examples/dot/so-sample001.gv +30 -0
- data/examples/dot/so-sample002.gv +33 -0
- data/examples/dot/so-sample003.gv +45 -0
- data/examples/dot/test.dot +17 -0
- data/examples/dot/test_parse.rb +13 -0
- data/examples/dot/this_crach_with_dot_2.20.dot +24 -0
- data/examples/dot/unix.dot +104 -0
- data/examples/graphml/attributes.ext.graphml +12 -0
- data/examples/graphml/attributes.graphml +40 -0
- data/examples/graphml/cluster.graphml +75 -0
- data/examples/graphml/failed_graph.graphml +461 -0
- data/examples/graphml/hyper.graphml +29 -0
- data/examples/graphml/nested.graphml +54 -0
- data/examples/graphml/port.graphml +32 -0
- data/examples/graphml/simple.graphml +30 -0
- data/examples/hello.png +0 -0
- data/examples/rgv/rgv.ps +125 -0
- data/examples/rgv/test_rgv.rb +12 -0
- data/examples/sample01.rb +32 -0
- data/examples/sample02.rb +42 -0
- data/examples/sample03.rb +31 -0
- data/examples/sample04.rb +22 -0
- data/examples/sample05.rb +32 -0
- data/examples/sample06.rb +46 -0
- data/examples/sample07.rb +23 -0
- data/examples/sample08.rb +34 -0
- data/examples/sample09.rb +50 -0
- data/examples/sample10.rb +50 -0
- data/examples/sample11.rb +42 -0
- data/examples/sample12.rb +55 -0
- data/examples/sample13.rb +48 -0
- data/examples/sample14.rb +44 -0
- data/examples/sample15.rb +25 -0
- data/examples/sample16.rb +8 -0
- data/examples/sample17.rb +92 -0
- data/examples/sample18.rb +24 -0
- data/examples/sample19.rb +59 -0
- data/examples/sample20.rb +47 -0
- data/examples/sample21.rb +12 -0
- data/examples/sample22.rb +10 -0
- data/examples/sample23.rb +11 -0
- data/examples/sample24.rb +11 -0
- data/examples/sample25.rb +11 -0
- data/examples/sample26.rb +8 -0
- data/examples/sample27.rb +8 -0
- data/examples/sample28.rb +12 -0
- data/examples/sample29.rb +8 -0
- data/examples/sample30.rb +12 -0
- data/examples/sample31.rb +10 -0
- data/examples/sample32.rb +14 -0
- data/examples/sample33.rb +43 -0
- data/examples/sample34.rb +29 -0
- data/examples/sample35.rb +43 -0
- data/examples/sample36.rb +35 -0
- data/examples/sample37.rb +87 -0
- data/examples/sample38.rb +12 -0
- data/examples/sample39.rb +11 -0
- data/examples/sample40.rb +17 -0
- data/examples/sample41.rb +8 -0
- data/examples/sample42.rb +35 -0
- data/examples/sample43.rb +26 -0
- data/examples/sample44.rb +97 -0
- data/examples/sample45.rb +24 -0
- data/examples/sample46.rb +43 -0
- data/examples/sample47.rb +7 -0
- data/examples/sample48.rb +62 -0
- data/examples/sample49.rb +10 -0
- data/examples/sample50.rb +215 -0
- data/examples/sample51.rb +37 -0
- data/examples/sample52.rb +62 -0
- data/examples/sample53.rb +26 -0
- data/examples/sample54.rb +26 -0
- data/examples/sample55.rb +9 -0
- data/examples/sample56.rb +10 -0
- data/examples/sample57.rb +8 -0
- data/examples/sample58.rb +33 -0
- data/examples/sample59.rb +14 -0
- data/examples/sample60.rb +12 -0
- data/examples/sample61.rb +12 -0
- data/examples/sample62.rb +24 -0
- data/examples/sample63.rb +32 -0
- data/examples/sample64.rb +31 -0
- data/examples/sample65.rb +9 -0
- data/examples/sample66.rb +4 -0
- data/examples/sample67.rb +10 -0
- data/examples/sample68.rb +27 -0
- data/examples/sample69.rb +23 -0
- data/examples/sample70.rb +9 -0
- data/examples/sample99.rb +70 -0
- data/examples/sdlshapes/README +2 -0
- data/examples/sdlshapes/sdl.ps +655 -0
- data/examples/sdlshapes/sdlshapes.dot +78 -0
- data/examples/test.xml +26 -0
- data/examples/theory/pert.rb +47 -0
- data/examples/theory/tests.rb +87 -0
- data/lib/ext/gvpr/dot2ruby.g +185 -0
- data/lib/graphviz/attrs.rb +73 -0
- data/lib/graphviz/constants.rb +294 -0
- data/lib/graphviz/core_ext.rb +64 -0
- data/lib/graphviz/dot2ruby.rb +59 -0
- data/lib/graphviz/dot_script.rb +109 -0
- data/lib/graphviz/dsl.rb +67 -0
- data/lib/graphviz/edge.rb +197 -0
- data/lib/graphviz/elements.rb +39 -0
- data/lib/graphviz/ext.rb +17 -0
- data/lib/graphviz/family_tree/couple.rb +63 -0
- data/lib/graphviz/family_tree/generation.rb +39 -0
- data/lib/graphviz/family_tree/person.rb +120 -0
- data/lib/graphviz/family_tree/sibling.rb +13 -0
- data/lib/graphviz/family_tree.rb +118 -0
- data/lib/graphviz/graphml.rb +268 -0
- data/lib/graphviz/math/matrix.rb +221 -0
- data/lib/graphviz/node.rb +160 -0
- data/lib/graphviz/nothugly/nothugly.xsl +321 -0
- data/lib/graphviz/nothugly.rb +63 -0
- data/lib/graphviz/theory.rb +321 -0
- data/lib/graphviz/types/arrow_type.rb +32 -0
- data/lib/graphviz/types/color.rb +58 -0
- data/lib/graphviz/types/color_list.rb +24 -0
- data/lib/graphviz/types/esc_string.rb +20 -0
- data/lib/graphviz/types/gv_bool.rb +49 -0
- data/lib/graphviz/types/gv_double.rb +32 -0
- data/lib/graphviz/types/html_string.rb +18 -0
- data/lib/graphviz/types/lbl_string.rb +22 -0
- data/lib/graphviz/types/rect.rb +35 -0
- data/lib/graphviz/types/spline_type.rb +77 -0
- data/lib/graphviz/types.rb +22 -0
- data/lib/graphviz/utils/colors.rb +1018 -0
- data/lib/graphviz/utils.rb +70 -0
- data/lib/graphviz/xml.rb +119 -0
- data/lib/graphviz.rb +967 -0
- data/lib/ruby-graphviz.rb +1 -0
- data/man/dot2ruby.1 +66 -0
- data/man/dot2ruby.1.ronn +55 -0
- data/man/gem2gv.1 +60 -0
- data/man/gem2gv.1.ronn +47 -0
- data/man/git2gv.1 +48 -0
- data/man/git2gv.1.ronn +40 -0
- data/man/ruby2gv.1 +60 -0
- data/man/ruby2gv.1.ronn +47 -0
- data/man/xml2gv.1 +48 -0
- data/man/xml2gv.1.ronn +39 -0
- data/ruby-graphviz.gemspec +47 -0
- data/setup.rb +1585 -0
- data/test/helper.rb +13 -0
- data/test/support.rb +95 -0
- data/test/test_dot_script.rb +47 -0
- data/test/test_examples.rb +151 -0
- data/test/test_graph.rb +115 -0
- data/test/test_search.rb +29 -0
- data/test/test_subgraph.rb +27 -0
- data/test/test_theory.rb +98 -0
- data/test/test_types.rb +65 -0
- data/test/test_utils_colors.rb +52 -0
- metadata +301 -0
@@ -0,0 +1,46 @@
|
|
1
|
+
$:.unshift( "../lib" );
|
2
|
+
require "graphviz"
|
3
|
+
|
4
|
+
GraphViz::new( "G", :rankdir => "LR", :type => "graph" ) { |graph|
|
5
|
+
graph.cluster0 { |cluster|
|
6
|
+
cluster[:label] = "Back Office"
|
7
|
+
|
8
|
+
cluster.fatman.set { |n|
|
9
|
+
n.label = "FatMan"
|
10
|
+
n.shape = "rect"
|
11
|
+
}
|
12
|
+
cluster.grobil.set { |n|
|
13
|
+
n.label = "GroBil"
|
14
|
+
n.shape = "rect"
|
15
|
+
}
|
16
|
+
}
|
17
|
+
|
18
|
+
graph.cluster1 { |cluster|
|
19
|
+
cluster[:label] = "DMZ"
|
20
|
+
|
21
|
+
cluster.dupont.set { |n|
|
22
|
+
n.label = "Dupont"
|
23
|
+
n.shape = "rect"
|
24
|
+
}
|
25
|
+
cluster.dupond.set { |n|
|
26
|
+
n.label = "Dupond"
|
27
|
+
n.shape = "rect"
|
28
|
+
}
|
29
|
+
}
|
30
|
+
|
31
|
+
graph.cluster2() { |cluster|
|
32
|
+
cluster[:label] = "Front Office"
|
33
|
+
|
34
|
+
cluster.door.set { |n|
|
35
|
+
n.label = "Door"
|
36
|
+
n.shape = "rect"
|
37
|
+
}
|
38
|
+
}
|
39
|
+
|
40
|
+
graph.cluster0.fatman << graph.cluster1.dupont
|
41
|
+
graph.cluster0.fatman << graph.cluster1.dupond
|
42
|
+
graph.cluster0.grobil << graph.cluster1.dupont
|
43
|
+
graph.cluster0.grobil << graph.cluster1.dupond
|
44
|
+
graph.cluster1.dupont << graph.cluster2.door
|
45
|
+
graph.cluster1.dupond << graph.cluster2.door
|
46
|
+
}.output( :path => '/usr/local/bin/', :png => "#{$0}.png" )
|
@@ -0,0 +1,23 @@
|
|
1
|
+
#!/usr/bin/ruby
|
2
|
+
|
3
|
+
$:.unshift( "../lib" );
|
4
|
+
require "graphviz"
|
5
|
+
|
6
|
+
GraphViz::options( :use => "dot" )
|
7
|
+
|
8
|
+
if ARGV[0]
|
9
|
+
GraphViz::options( :path => ARGV[0] )
|
10
|
+
end
|
11
|
+
|
12
|
+
g = GraphViz::new( "structs" )
|
13
|
+
|
14
|
+
g.node["shape"] = "record"
|
15
|
+
|
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
|
+
|
20
|
+
g.add_edges( { "struct1" => :f1}, {"struct2" => :f0} )
|
21
|
+
g.add_edges( {"struct1" => :f2}, {"struct3" => :here} )
|
22
|
+
|
23
|
+
g.output( :png => "#{$0}.png", :canon => nil )
|
@@ -0,0 +1,34 @@
|
|
1
|
+
#!/usr/bin/ruby
|
2
|
+
|
3
|
+
$:.unshift( "../lib" );
|
4
|
+
require "graphviz"
|
5
|
+
|
6
|
+
g = nil
|
7
|
+
if ARGV[0]
|
8
|
+
g = GraphViz::new( "G" "nodesep" => ".05", "rankdir" => "LR", "path" => ARGV[0] )
|
9
|
+
else
|
10
|
+
g = GraphViz::new( "G", "nodesep" => ".05", "rankdir" => "LR" )
|
11
|
+
end
|
12
|
+
|
13
|
+
g.node["shape"] = "record"
|
14
|
+
g.node["width"] = ".1"
|
15
|
+
g.node["height"] = ".1"
|
16
|
+
|
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
|
+
|
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
|
+
|
34
|
+
g.output( :png => "#{$0}.png" )
|
@@ -0,0 +1,50 @@
|
|
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["color"] = "black"
|
17
|
+
|
18
|
+
c0 = g.add_graph( "cluster0" )
|
19
|
+
c0["label"] = "process #1"
|
20
|
+
c0["style"] = "filled"
|
21
|
+
c0["color"] = "lightgrey"
|
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
|
+
|
30
|
+
c1 = g.add_graph( "cluster1", "label" => "process #2" )
|
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
|
+
|
50
|
+
g.output( :png => "#{$0}.png" )
|
@@ -0,0 +1,50 @@
|
|
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["color"] = "black"
|
17
|
+
|
18
|
+
c0 = g.add_graph( "cluster0" )
|
19
|
+
c0["label"] = "process #1"
|
20
|
+
c0["style"] = "filled"
|
21
|
+
c0["color"] = "lightgrey"
|
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
|
+
|
30
|
+
c1 = g.add_graph( "cluster1", "label" => "process #2" )
|
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
|
+
|
50
|
+
g.output( :png => "#{$0}.png" )
|
@@ -0,0 +1,42 @@
|
|
1
|
+
#!/usr/bin/ruby
|
2
|
+
|
3
|
+
$:.unshift( "../lib" );
|
4
|
+
require "graphviz"
|
5
|
+
|
6
|
+
graph = nil
|
7
|
+
if ARGV[0]
|
8
|
+
graph = GraphViz::new( "G", "path" => ARGV[0] )
|
9
|
+
else
|
10
|
+
graph = GraphViz::new( "G" )
|
11
|
+
end
|
12
|
+
|
13
|
+
graph["compound"] = "true"
|
14
|
+
graph.edge["lhead"] = ""
|
15
|
+
graph.edge["ltail"] = ""
|
16
|
+
|
17
|
+
c0 = graph.add_graph( "cluster0" )
|
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
|
+
|
27
|
+
c1 = graph.add_graph( "cluster1" )
|
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
|
+
|
42
|
+
graph.output( :png => "#{$0}.png" )
|
@@ -0,0 +1,55 @@
|
|
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[:color] = "black"
|
17
|
+
|
18
|
+
g.cluster0( ) do |cluster|
|
19
|
+
cluster[:label] = "process #1"
|
20
|
+
cluster[:style] = "filled"
|
21
|
+
cluster[:color] = "lightgrey"
|
22
|
+
|
23
|
+
cluster.a0 :style => "filled", :color => "white"
|
24
|
+
cluster.a1 :style => "filled", :color => "white"
|
25
|
+
cluster.a2 :style => "filled", :color => "white"
|
26
|
+
cluster.a3 :style => "filled", :color => "white"
|
27
|
+
|
28
|
+
cluster.a0 << cluster.a1
|
29
|
+
cluster.a1 << cluster.a2
|
30
|
+
cluster.a2 << cluster.a3
|
31
|
+
end
|
32
|
+
|
33
|
+
g.cluster1( :label => "process #2" ) do |cluster|
|
34
|
+
cluster.b0 :style => "filled", :color => "blue"
|
35
|
+
cluster.b1 :style => "filled", :color => "blue"
|
36
|
+
cluster.b2 :style => "filled", :color => "blue"
|
37
|
+
cluster.b3 :style => "filled", :color => "blue"
|
38
|
+
|
39
|
+
cluster.b0 << cluster.b1
|
40
|
+
cluster.b1 << cluster.b2
|
41
|
+
cluster.b2 << cluster.b3
|
42
|
+
end
|
43
|
+
|
44
|
+
g.start :shape => "Mdiamond"
|
45
|
+
g.endn :shape => "Msquare", :label => "end"
|
46
|
+
|
47
|
+
g.start << g.cluster0.a0
|
48
|
+
g.start << g.cluster1.b0
|
49
|
+
g.cluster0.a1 << g.cluster1.b3
|
50
|
+
g.cluster1.b2 << g.cluster0.a3
|
51
|
+
g.cluster0.a3 << g.cluster0.a0
|
52
|
+
g.cluster0.a3 << g.endn
|
53
|
+
g.cluster1.b3 << g.endn
|
54
|
+
|
55
|
+
g.output( :png => "#{$0}.png" )
|
@@ -0,0 +1,48 @@
|
|
1
|
+
#!/usr/bin/ruby
|
2
|
+
|
3
|
+
$:.unshift( "../lib" );
|
4
|
+
require "graphviz"
|
5
|
+
|
6
|
+
GraphViz::new( "G" ) { |graph|
|
7
|
+
graph.node[:shape] = "ellipse"
|
8
|
+
graph.node[:color] = "black"
|
9
|
+
|
10
|
+
graph[:color] = "black"
|
11
|
+
|
12
|
+
graph.cluster0( ) do |cluster|
|
13
|
+
cluster[:label] = "process #1"
|
14
|
+
cluster[:style] = "filled"
|
15
|
+
cluster[:color] = "lightgrey"
|
16
|
+
|
17
|
+
cluster.a0 :style => "filled", :color => "white"
|
18
|
+
cluster.a1 :style => "filled", :color => "white"
|
19
|
+
cluster.a2 :style => "filled", :color => "white"
|
20
|
+
cluster.a3 :style => "filled", :color => "white"
|
21
|
+
|
22
|
+
cluster.a0 << cluster.a1
|
23
|
+
cluster.a1 << cluster.a2
|
24
|
+
cluster.a2 << cluster.a3
|
25
|
+
end
|
26
|
+
|
27
|
+
graph.cluster1( :label => "process #2" ) do |cluster|
|
28
|
+
cluster.b0 :style => "filled", :color => "blue"
|
29
|
+
cluster.b1 :style => "filled", :color => "blue"
|
30
|
+
cluster.b2 :style => "filled", :color => "blue"
|
31
|
+
cluster.b3 :style => "filled", :color => "blue"
|
32
|
+
|
33
|
+
cluster.b0 << cluster.b1
|
34
|
+
cluster.b1 << cluster.b2
|
35
|
+
cluster.b2 << cluster.b3
|
36
|
+
end
|
37
|
+
|
38
|
+
graph.start :shape => "Mdiamond"
|
39
|
+
graph.endn :shape => "Msquare", :label => "end"
|
40
|
+
|
41
|
+
graph.start << graph.cluster0.a0
|
42
|
+
graph.start << graph.cluster1.b0
|
43
|
+
graph.cluster0.a1 << graph.cluster1.b3
|
44
|
+
graph.cluster1.b2 << graph.cluster0.a3
|
45
|
+
graph.cluster0.a3 << graph.cluster0.a0
|
46
|
+
graph.cluster0.a3 << graph.endn
|
47
|
+
graph.cluster1.b3 << graph.endn
|
48
|
+
}.output( :path => '/usr/local/bin/', :png => "#{$0}.png" )
|
@@ -0,0 +1,44 @@
|
|
1
|
+
#!/usr/bin/ruby
|
2
|
+
|
3
|
+
$:.unshift( "../lib" );
|
4
|
+
require "graphviz"
|
5
|
+
|
6
|
+
GraphViz::new( "G" ) { |graph|
|
7
|
+
graph.node[:shape] = "ellipse"
|
8
|
+
graph.node[:color] = "black"
|
9
|
+
|
10
|
+
graph[:color] = "black"
|
11
|
+
|
12
|
+
graph.cluster0( ) do |cluster|
|
13
|
+
cluster[:label] = "process #1"
|
14
|
+
cluster[:style] = "filled"
|
15
|
+
cluster[:color] = "lightgrey"
|
16
|
+
|
17
|
+
cluster.node[:style] = "filled"
|
18
|
+
cluster.node[:color] = "white"
|
19
|
+
|
20
|
+
cluster.a0 << cluster.a1
|
21
|
+
cluster.a1 << cluster.a2
|
22
|
+
cluster.a2 << cluster.a3
|
23
|
+
end
|
24
|
+
|
25
|
+
graph.cluster1( :label => "process #2", :color => "blue" ) do |cluster|
|
26
|
+
cluster.node[:style] = "filled"
|
27
|
+
cluster.node[:color] = "lightgrey"
|
28
|
+
|
29
|
+
cluster.b0 << cluster.b1
|
30
|
+
cluster.b1 << cluster.b2
|
31
|
+
cluster.b2 << cluster.b3
|
32
|
+
end
|
33
|
+
|
34
|
+
graph.start :shape => "Mdiamond"
|
35
|
+
graph.endn :shape => "Msquare", :label => "end"
|
36
|
+
|
37
|
+
graph.start << graph.cluster0.a0
|
38
|
+
graph.start << graph.cluster1.b0
|
39
|
+
graph.cluster0.a1 << graph.cluster1.b3
|
40
|
+
graph.cluster1.b2 << graph.cluster0.a3
|
41
|
+
graph.cluster0.a3 << graph.cluster0.a0
|
42
|
+
graph.cluster0.a3 << graph.endn
|
43
|
+
graph.cluster1.b3 << graph.endn
|
44
|
+
}.output( :path => '/usr/local/bin/', :png => "#{$0}.png" )
|
@@ -0,0 +1,25 @@
|
|
1
|
+
#!/usr/bin/ruby
|
2
|
+
|
3
|
+
# fdp example
|
4
|
+
# see : http://www.graphviz.org/Gallery/undirected/fdpclust.html
|
5
|
+
|
6
|
+
$:.unshift( "../lib" );
|
7
|
+
require "graphviz"
|
8
|
+
|
9
|
+
g = GraphViz::new( "G", :type => "graph", :use => "fdp" ) { |graph|
|
10
|
+
graph.e
|
11
|
+
graph.clusterA { |cA|
|
12
|
+
cA.a << cA.b
|
13
|
+
cA.clusterC { |cC|
|
14
|
+
cC._c( :label => "C" ) << cC._d( :label => "D" )
|
15
|
+
}
|
16
|
+
}
|
17
|
+
graph.clusterB { |cB|
|
18
|
+
cB.d << cB.f
|
19
|
+
}
|
20
|
+
graph.clusterB.d << graph.clusterA.clusterC._d
|
21
|
+
graph.e << graph.clusterB
|
22
|
+
graph.clusterA.clusterC << graph.clusterB
|
23
|
+
}
|
24
|
+
|
25
|
+
g.output( :path => '/usr/local/bin/', :png => "#{$0}.png" )
|
@@ -0,0 +1,8 @@
|
|
1
|
+
#!/usr/bin/ruby
|
2
|
+
|
3
|
+
$:.unshift( "../lib" );
|
4
|
+
require "graphviz"
|
5
|
+
|
6
|
+
GraphViz::new( "G", :type => "graph", :rankdir => "LR" ) { |graph|
|
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" )
|
@@ -0,0 +1,92 @@
|
|
1
|
+
#!/usr/bin/ruby
|
2
|
+
|
3
|
+
$:.unshift( "../lib" );
|
4
|
+
require "graphviz"
|
5
|
+
|
6
|
+
GraphViz::new( "G", :type => "graph", :rankdir => "LR", :bgcolor => "#808080" ) { |graph|
|
7
|
+
graph.edge[:dir] = "none"
|
8
|
+
|
9
|
+
graph.node[:width] = "0.3"
|
10
|
+
graph.node[:height] = "0.3"
|
11
|
+
graph.node[:label] = ""
|
12
|
+
|
13
|
+
_ = {}
|
14
|
+
|
15
|
+
("1".."8").each do |v|
|
16
|
+
_[v] = graph.add_nodes( v, :shape => "circle", :style => "invis")
|
17
|
+
end
|
18
|
+
["10","20","30","40","50","60","70","80"].each do |v|
|
19
|
+
_[v] = graph.add_nodes( v, :shape => "circle", :style => "invis")
|
20
|
+
end
|
21
|
+
|
22
|
+
("a".."x").each do |v|
|
23
|
+
_[v] = graph.add_nodes( v, :shape => "circle")
|
24
|
+
end
|
25
|
+
|
26
|
+
("A".."X").each do |v|
|
27
|
+
_[v] = graph.add_nodes( v, :shape => "diamond")
|
28
|
+
end
|
29
|
+
|
30
|
+
(_["1"] << _["a"])[:color]="#0000ff"
|
31
|
+
(_["a"] << _["A"])[:color]="#0000ff"
|
32
|
+
(_["a"] << _["B"])[:color]="#0000ff"
|
33
|
+
(_["2"] << _["b"])[:color]="#ff0000"
|
34
|
+
(_["b"] << _["B"])[:color]="#ff0000"
|
35
|
+
(_["b"] << _["A"])[:color]="#ff0000"
|
36
|
+
(_["3"] << _["c"])[:color]="#ffff00"
|
37
|
+
(_["c"] << _["C"])[:color]="#ffff00"
|
38
|
+
(_["c"] << _["D"])[:color]="#ffff00"
|
39
|
+
(_["4"] << _["d"])[:color]="#00ff00"
|
40
|
+
(_["d"] << _["D"])[:color]="#00ff00"
|
41
|
+
(_["d"] << _["C"])[:color]="#00ff00"
|
42
|
+
(_["5"] << _["e"])[:color]="#000000"
|
43
|
+
(_["e"] << _["E"])[:color]="#000000"
|
44
|
+
(_["e"] << _["F"])[:color]="#000000"
|
45
|
+
(_["6"] << _["f"])[:color]="#00ffff"
|
46
|
+
(_["f"] << _["F"])[:color]="#00ffff"
|
47
|
+
(_["f"] << _["E"])[:color]="#00ffff"
|
48
|
+
(_["7"] << _["g"])[:color]="#ffffff"
|
49
|
+
(_["g"] << _["G"])[:color]="#ffffff"
|
50
|
+
(_["g"] << _["H"])[:color]="#ffffff"
|
51
|
+
(_["8"] << _["h"])[:color]="#ff00ff"
|
52
|
+
(_["h"] << _["H"])[:color]="#ff00ff"
|
53
|
+
(_["h"] << _["G"])[:color]="#ff00ff"
|
54
|
+
|
55
|
+
graph.edge[:color]="#ff0000:#0000ff"
|
56
|
+
_["A"] << _["i"]; _["i"] << [_["I"], _["K"]]
|
57
|
+
_["B"] << _["j"]; _["j"] << [_["J"], _["L"]]
|
58
|
+
|
59
|
+
graph.edge[:color]="#00ff00:#ffff00"
|
60
|
+
_["C"] << _["k"]; _["k"] << [_["K"], _["I"]]
|
61
|
+
_["D"] << _["l"]; _["l"] << [_["L"], _["J"]]
|
62
|
+
|
63
|
+
graph.edge[:color]="#00ffff:#000000"
|
64
|
+
_["E"] << _["m"]; _["m"] << [_["M"], _["O"]]
|
65
|
+
_["F"] << _["n"]; _["n"] << [_["N"], _["P"]]
|
66
|
+
|
67
|
+
graph.edge[:color]="#ff00ff:#ffffff"
|
68
|
+
_["G"] << _["o"]; _["o"] << [_["O"], _["M"]]
|
69
|
+
_["H"] << _["p"]; _["p"] << [_["P"], _["N"]]
|
70
|
+
|
71
|
+
graph.edge[:color]="#00ff00:#ffff00:#ff0000:#0000ff"
|
72
|
+
_["I"] << _["q"]; _["q"] << [_["Q"], _["U"]]
|
73
|
+
_["J"] << _["r"]; _["r"] << [_["R"], _["V"]]
|
74
|
+
_["K"] << _["s"]; _["s"] << [_["S"], _["W"]]
|
75
|
+
_["L"] << _["t"]; _["t"] << [_["T"], _["X"]]
|
76
|
+
|
77
|
+
graph.edge[:color]="#ff00ff:#ffffff:#00ffff:#000000"
|
78
|
+
_["M"] << _["u"]; _["u"] << [_["U"], _["Q"]]
|
79
|
+
_["N"] << _["v"]; _["v"] << [_["V"], _["R"]]
|
80
|
+
_["O"] << _["w"]; _["w"] << [_["W"], _["S"]]
|
81
|
+
_["P"] << _["x"]; _["x"] << [_["X"], _["T"]]
|
82
|
+
|
83
|
+
graph.edge[:color]="#ff00ff:#ffffff:#00ffff:#000000:#00ff00:#ffff00:#ff0000:#0000ff"
|
84
|
+
_["Q"] << _["10"]
|
85
|
+
_["R"] << _["20"]
|
86
|
+
_["S"] << _["30"]
|
87
|
+
_["T"] << _["40"]
|
88
|
+
_["U"] << _["50"]
|
89
|
+
_["V"] << _["60"]
|
90
|
+
_["W"] << _["70"]
|
91
|
+
_["X"] << _["80"]
|
92
|
+
}.output( :path => '/usr/local/bin/', :png => "#{$0}.png" )
|