Sha256: 6180dc614499cdbad944c80d1470dd7a6db74f62bf4a576d658df259ed8dd265

Contents?: true

Size: 1.33 KB

Versions: 48

Compression:

Stored size: 1.33 KB

Contents

#!/usr/bin/ruby

$:.unshift( "../lib" );
require "graphviz"

g = nil
if ARGV[0]
  g = GraphViz::new( "G", "path" => ARGV[0] )
else
  g = GraphViz::new( "G" )
end

g.node["shape"] = "ellipse"
g.node["color"] = "black"

g["color"] = "black"

c0 = g.add_graph( "cluster0" )
c0["label"] = "process #1"
c0["style"] = "filled"
c0["color"] = "lightgrey"
a0 = c0.add_node( "a0", "style" => "filled", "color" => "white" )
a1 = c0.add_node( "a1", "style" => "filled", "color" => "white" )
a2 = c0.add_node( "a2", "style" => "filled", "color" => "white" )
a3 = c0.add_node( "a3", "style" => "filled", "color" => "white" )
c0.add_edge( a0, a1 )
c0.add_edge( a1, a2 )
c0.add_edge( a2, a3 )

c1 = g.add_graph( "cluster1", "label" => "process #2" )
b0 = c1.add_node( "b0", "style" => "filled", "color" => "blue" )
b1 = c1.add_node( "b1", "style" => "filled", "color" => "blue" )
b2 = c1.add_node( "b2", "style" => "filled", "color" => "blue" )
b3 = c1.add_node( "b3", "style" => "filled", "color" => "blue" )
c1.add_edge( b0, b1 )
c1.add_edge( b1, b2 )
c1.add_edge( b2, b3 )

start = g.add_node( "start", "shape" => "Mdiamond" )
endn  = g.add_node( "end",   "shape" => "Msquare" )

g.add_edge( start, a0 )
g.add_edge( start, b0 )
g.add_edge( a1, b3 )
g.add_edge( b2, a3 )
g.add_edge( a3, a0 )
g.add_edge( a3, endn )
g.add_edge( b3, endn )

g.output( :png => "#{$0}.png" )

Version data entries

48 entries across 24 versions & 1 rubygems

Version Path
ruby-graphviz-1.0.2 examples/sample09.rb
ruby-graphviz-1.0.2 examples/sample10.rb
ruby-graphviz-1.0.1 examples/sample09.rb
ruby-graphviz-1.0.1 examples/sample10.rb
ruby-graphviz-1.0.0 examples/sample10.rb
ruby-graphviz-1.0.0 examples/sample09.rb
ruby-graphviz-0.9.21 examples/sample09.rb
ruby-graphviz-0.9.21 examples/sample10.rb
ruby-graphviz-0.9.20 examples/sample09.rb
ruby-graphviz-0.9.20 examples/sample10.rb
ruby-graphviz-0.9.19 examples/sample09.rb
ruby-graphviz-0.9.19 examples/sample10.rb
ruby-graphviz-0.9.18 examples/sample09.rb
ruby-graphviz-0.9.18 examples/sample10.rb
ruby-graphviz-0.9.17 examples/sample10.rb
ruby-graphviz-0.9.17 examples/sample09.rb
ruby-graphviz-0.9.16 examples/sample10.rb
ruby-graphviz-0.9.16 examples/sample09.rb
ruby-graphviz-0.9.15 examples/sample09.rb
ruby-graphviz-0.9.15 examples/sample10.rb