File: sample18.rb

package info (click to toggle)
ruby-graphviz 1.0.8-2
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 1,124 kB
  • ctags: 695
  • sloc: ruby: 7,656; xml: 26; makefile: 17
file content (24 lines) | stat: -rw-r--r-- 987 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/usr/bin/ruby

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

GraphViz::new( "G", :rankdir => "LR", :size => "8,5" ) { |graph|
  graph.node[:shape] = "doublecircle"
  graph._LR_0; graph._LR_3; graph._LR_4; graph._LR_8
  graph.node[:shape] = "circle"
  (graph._LR_0 << graph._LR_2)[:label] = "SS(B)"
  (graph._LR_0 << graph._LR_1)[:label] = "SS(S)"
  (graph._LR_1 << graph._LR_3)[:label] = "S($end)"
  (graph._LR_2 << graph._LR_6)[:label] = "SS(b)"
  (graph._LR_2 << graph._LR_5)[:label] = "SS(a)"
  (graph._LR_2 << graph._LR_4)[:label] = "S(A)"
  (graph._LR_5 << graph._LR_7)[:label] = "S(b)"
  (graph._LR_5 << graph._LR_5)[:label] = "S(a)"
  (graph._LR_6 << graph._LR_6)[:label] = "S(b)"
  (graph._LR_6 << graph._LR_5)[:label] = "S(a)"
  (graph._LR_7 << graph._LR_8)[:label] = "S(b)"
  (graph._LR_7 << graph._LR_5)[:label] = "S(a)"
  (graph._LR_8 << graph._LR_6)[:label] = "S(b)"
  (graph._LR_8 << graph._LR_5)[:label] = "S(a)"
}.output( :path => '/usr/local/bin/', :png => "#{$0}.png" )