Sha256: 3d1e95942f4063e22c33ae6cce5121b967d6c551b545c1187748a44c1d53ef5b

Contents?: true

Size: 903 Bytes

Versions: 15

Compression:

Stored size: 903 Bytes

Contents

#!/usr/bin/ruby

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

GraphViz.graph( :G ) { |g|
  last_line = []
  node_number = 0
  
  100.times do |j|
    # New_Line
    new_line = []
    c = g.subgraph( :rank => "same" )
    
    100.times do |i|
      current_node = c.add_node( "N#{node_number}", :shape => "point", :label => "" )
      last_node = new_line[-1]
      unless last_node.nil?
        c.add_edge( last_node, current_node )
      end
      new_line << current_node
      top_first_node = last_line.shift
      unless top_first_node.nil?
        g.add_edge( top_first_node, current_node )
        top_second_node = last_line.shift
        unless top_second_node.nil?
          g.add_edge( top_second_node, current_node )
          last_line.unshift( top_second_node )
        end
      end
      node_number = node_number + 1
    end
    last_line = new_line
  end
}.output( :png => "#{$0}.png" )

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
ruby-graphviz-1.0.2 examples/sample36.rb
ruby-graphviz-1.0.1 examples/sample36.rb
ruby-graphviz-1.0.0 examples/sample36.rb
ruby-graphviz-0.9.21 examples/sample36.rb
ruby-graphviz-0.9.20 examples/sample36.rb
ruby-graphviz-0.9.19 examples/sample36.rb
ruby-graphviz-0.9.18 examples/sample36.rb
ruby-graphviz-0.9.17 examples/sample36.rb
ruby-graphviz-0.9.16 examples/sample36.rb
ruby-graphviz-0.9.15 examples/sample36.rb
ruby-graphviz-0.9.14 examples/sample36.rb
ruby-graphviz-0.9.13 examples/sample36.rb
ruby-graphviz-0.9.12 examples/sample36.rb
ruby-graphviz-0.9.11 examples/sample36.rb
ruby-graphviz-0.9.10 examples/sample36.rb