Sha256: d00c8d61014e20e8998ef7cc75e3a139c31a9e075b1982608dda406a59d5cf68

Contents?: true

Size: 1.25 KB

Versions: 10

Compression:

Stored size: 1.25 KB

Contents

# http://www.graphviz.org/Gallery/directed/cluster.html
# 
# digraph G {
# 
# 	subgraph cluster_0 {
# 		style=filled;
# 		color=lightgrey;
# 		node [style=filled,color=white];
# 		a0 -> a1 -> a2 -> a3;
# 		label = "process #1";
# 	}
# 
# 	subgraph cluster_1 {
# 		node [style=filled];
# 		b0 -> b1 -> b2 -> b3;
# 		label = "process #2";
# 		color=blue
# 	}
# 	start -> a0;
# 	start -> b0;
# 	a1 -> b3;
# 	b2 -> a3;
# 	a3 -> a0;
# 	a3 -> end;
# 	b3 -> end;
# 
# 	start [shape=Mdiamond];
# 	end [shape=Msquare];
# }

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

GraphViz.new( :G, :type => :digraph ) { |g|
  g.cluster_0 { |c|
    c[:style] = :filled
    c[:color] = :lightgrey
    c.node[:style] = :filled
    c.node[:color] = :white
    c.a0 << c.a1 << c.a2 << c.a3
    c[:label] = "process #1"
  }
  
  g.cluster_1 { |c|
     c.node[:style] = :filled
     c.b0 << c.b1 << c.b2 << c.b3
     c[:label] = "process #1"
     c[:color] = :blue
  }
    
  g.start << g.cluster_0.a0
  g.start << g.cluster_1.b0
  g.cluster_0.a1 << g.cluster_1.b3
  g.cluster_1.b2 << g.cluster_0.a3
  g.cluster_0.a3 << g.cluster_0.a0
  g.cluster_0.a3 << g._end
  g.cluster_1.b3 << g._end
  
  g.start[:shape] = :Mdiamond
  g._end[:label] = "end"
  g._end[:shape] = :Mdiamond
}.output( :png => "cluster.png" )

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
ruby-graphviz-0.9.11 examples/graphviz.org/cluster.rb
ruby-graphviz-0.9.10 examples/graphviz.org/cluster.rb
ruby-graphviz-0.9.9 examples/graphviz.org/cluster.rb
ruby-graphviz-0.9.8 examples/graphviz.org/cluster.rb
ruby-graphviz-0.9.7 examples/graphviz.org/cluster.rb
ruby-graphviz-0.9.6 examples/graphviz.org/cluster.rb
ruby-graphviz-0.9.5 examples/graphviz.org/cluster.rb
ruby-graphviz-0.9.4 examples/graphviz.org/cluster.rb
ruby-graphviz-0.9.3 examples/graphviz.org/cluster.rb
ruby-graphviz-0.9.2 examples/graphviz.org/cluster.rb