Sha256: 3f18c39d5f163ba95882e2a95d08f9c4e513140b787c9c75cc5dba7d75d50e81

Contents?: true

Size: 1.25 KB

Versions: 11

Compression:

Stored size: 1.25 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"

g.cluster0( ) do |cluster|
  cluster[:label] = "process #1"
  cluster[:style] = "filled"
  cluster[:color] = "lightgrey"

  cluster.a0 :style => "filled", :color => "white"
  cluster.a1 :style => "filled", :color => "white"
  cluster.a2 :style => "filled", :color => "white"
  cluster.a3 :style => "filled", :color => "white"

  cluster.a0 << cluster.a1
  cluster.a1 << cluster.a2
  cluster.a2 << cluster.a3
end

g.cluster1( :label => "process #2" ) do |cluster|
  cluster.b0 :style => "filled", :color => "blue"
  cluster.b1 :style => "filled", :color => "blue"
  cluster.b2 :style => "filled", :color => "blue"
  cluster.b3 :style => "filled", :color => "blue"

  cluster.b0 << cluster.b1
  cluster.b1 << cluster.b2
  cluster.b2 << cluster.b3
end

g.start :shape => "Mdiamond"
g.endn :shape => "Msquare", :label => "end"

g.start << g.cluster0.a0
g.start << g.cluster1.b0
g.cluster0.a1 << g.cluster1.b3
g.cluster1.b2 << g.cluster0.a3
g.cluster0.a3 << g.cluster0.a0
g.cluster0.a3 << g.endn
g.cluster1.b3 << g.endn

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

Version data entries

11 entries across 11 versions & 2 rubygems

Version Path
ruby-graphviz-1.2.5 examples/sample12.rb
ruby-graphviz-1.2.4 examples/sample12.rb
ruby-graphviz-1.2.3 examples/sample12.rb
ruby-graphviz-1.2.2 examples/sample12.rb
ruby-graphviz-1.2.1 examples/sample12.rb
ruby-graphviz-1.2.0 examples/sample12.rb
ruby-graphviz-1.1.0 examples/sample12.rb
ruby-graphviz_c-1.1.1 examples/sample12.rb
ruby-graphviz_c-1.1.0 examples/sample12.rb
ruby-graphviz-1.0.9 examples/sample12.rb
ruby-graphviz-1.0.8 examples/sample12.rb