Sha256: 783c192ae6128e57f26316f82579975306b834ad8dd52caa453052d6b3686aec

Contents?: true

Size: 607 Bytes

Versions: 16

Compression:

Stored size: 607 Bytes

Contents

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

require 'graphviz'
require 'graphviz/theory'
g = GraphViz.graph(:G)
g.add_nodes(["A", "B", "C", "D", "E", "F", "G"])
g.add_edges("A", ["B", "C", "E"])
g.add_edges("B", ["D", "F"])
g.add_edges("C", "G")
g.add_edges("F", "E")
g.output(:png => "#{$0}000.png")

t = GraphViz::Theory.new(g)
i = 1
t.dfs("A") { |node|
   name = sprintf("%s%03d.png", $0, i)
   node[:color => :lightblue, :style => :filled]
   g.output(:png => name)
   i = i + 1
}

t.bfs("A") { |node|
   name = sprintf("%s%03d.png", $0, i)
   node[:color => :red, :style => :filled]
   g.output(:png => name)
   i = i + 1
}

Version data entries

16 entries across 16 versions & 2 rubygems

Version Path
ruby-graphviz-1.2.5 examples/sample68.rb
ruby-graphviz-1.2.4 examples/sample68.rb
ruby-graphviz-1.2.3 examples/sample68.rb
ruby-graphviz-1.2.2 examples/sample68.rb
ruby-graphviz-1.2.1 examples/sample68.rb
ruby-graphviz-1.2.0 examples/sample68.rb
ruby-graphviz-1.1.0 examples/sample68.rb
ruby-graphviz_c-1.1.1 examples/sample68.rb
ruby-graphviz_c-1.1.0 examples/sample68.rb
ruby-graphviz-1.0.9 examples/sample68.rb
ruby-graphviz-1.0.8 examples/sample68.rb
ruby-graphviz-1.0.7 examples/sample68.rb
ruby-graphviz-1.0.6 examples/sample68.rb
ruby-graphviz-1.0.5 examples/sample68.rb
ruby-graphviz-1.0.4 examples/sample68.rb
ruby-graphviz-1.0.3 examples/sample68.rb