ruby-graphviz 0.8.1 → 0.8.3

Sign up to get free protection for your applications and to get access to all the features.
data/ChangeLog CHANGED
@@ -1,3 +1,7 @@
1
+ 0.8.2 :
2
+ * Update Node, Edge and Graph Attributes (see http://www.graphviz.org/doc/info/attrs.html)
3
+ * Bugs corrections
4
+
1
5
  0.8.1 :
2
6
  * Documentation
3
7
 
data/README CHANGED
@@ -1,46 +1,13 @@
1
- Ruby/GraphViz v0.6.0
1
+ Ruby/GraphViz
2
2
 
3
- Copyright (C) 2004 Gregoire Lejeune
3
+ Copyright (C) 2004, 2005, 2006, 2007, 2008 Gregoire Lejeune
4
4
 
5
- Ruby/Asp is freely distributable according to the terms of the
5
+ Ruby/GraphViz is freely distributable according to the terms of the
6
6
  GNU General Public License (see the file 'COPYING').
7
7
 
8
8
  This program is distributed without any warranty. See the file
9
9
  'COPYING' for details.
10
10
 
11
- ---
12
-
13
- Ruby-GraphViz - Interface to the GraphViz graphing tool
14
-
15
- This modules provides an interface to layout and generate images of
16
- directed graphs in a variety of formats (PostScript, PNG, etc.) using
17
- GraphViz.
18
-
19
- This module require GraphViz version 1.10 (or higher)
20
-
21
- +-----------------------------------------------------+
22
- | CAUTION: You must uninstall Ruby/Graphviz 0.1.0 !!! |
23
- +-----------------------------------------------------+
24
-
25
- ---
26
-
27
- ChangeLog :
28
-
29
- 0.6.0 :
30
- * Add undirected graph support
31
-
32
- 0.5.0 :
33
- * Preserve the original order of creation of nodes and edges
34
-
35
- 0.4.0 :
36
- * Add HTML-Labels
37
-
38
- 0.3.0 :
39
- * Bugs corrections
40
-
41
- 0.2.0 :
42
- * Pure ruby
43
-
44
- 0.1.0 :
45
- * Initial version
11
+ = Examples
46
12
 
13
+ see http://ruby-asp.rubyforge.org/svn/trunk/ruby-graphviz/examples/
@@ -1,4 +1,4 @@
1
- #! /opt/rosx/bin/ruby
1
+ #!/usr/bin/env ruby
2
2
  # Copyright (C) 2005, 2006, 2007 Gregoire Lejeune <gregoire.lejeune@free.fr>
3
3
  #
4
4
  # This program is free software; you can redistribute it and/or modify
@@ -17,10 +17,10 @@
17
17
 
18
18
  require 'getoptlong'
19
19
  require 'graphviz'
20
+ require "graphviz/constants"
20
21
  require 'rbconfig'
21
22
 
22
23
  DEBUG = false
23
- RGV_VERSION = "0.7.0"
24
24
 
25
25
  class Rb2Gv
26
26
  REQUIRE = /^\s*require\s*("|')([^\1]*)(\1)/
@@ -131,7 +131,7 @@ def usage
131
131
  end
132
132
 
133
133
  def version
134
- puts "Ruby2GraphViz v#{RGV_VERSION}, (c)2005 Gregoire Lejeune <gregoire.lejeune@free.fr>"
134
+ puts "Ruby2GraphViz v#{Constants::RGV_VERSION}, (c)2005 Gregoire Lejeune <gregoire.lejeune@free.fr>"
135
135
  puts ""
136
136
  puts "This program is free software; you can redistribute it and/or modify"
137
137
  puts "it under the terms of the GNU General Public License as published by"
data/examples/s10.png ADDED
Binary file
data/examples/s12.png ADDED
Binary file
data/examples/s13.png ADDED
Binary file
data/examples/s14.png ADDED
Binary file
@@ -0,0 +1,33 @@
1
+ $:.unshift( "../lib" );
2
+ require "graphviz"
3
+
4
+ g = GraphViz::new( :path => ARGV[0] )
5
+
6
+ g.digraph :G {
7
+
8
+ subgraph :cluster_0 {
9
+ style :filled
10
+ color :lightgrey
11
+ node :style => :filled, :color => :white
12
+ a0 << a1 << a2 << a3
13
+ label "process #1"
14
+ }
15
+
16
+ subgraph :cluster_1 {
17
+ node :style => :filled
18
+ b0 << b1 << b2 << b3
19
+ label "process #2"
20
+ color :blue
21
+ }
22
+
23
+ start << a0;
24
+ start << b0;
25
+ a1 << b3;
26
+ b2 << a3;
27
+ a3 << a0;
28
+ a3 << _end;
29
+ b3 << _end;
30
+
31
+ start :shape => :Mdiamond
32
+ _end :shape=> :Msquare
33
+ }
data/examples/sample10.rb CHANGED
@@ -5,9 +5,9 @@ require "graphviz"
5
5
 
6
6
  g = nil
7
7
  if ARGV[0]
8
- g = GraphViz::new( "G", "output" => "png", "type" => "graph", "path" => ARGV[0] )
8
+ g = GraphViz::new( "G", "output" => "png", "path" => ARGV[0] )
9
9
  else
10
- g = GraphViz::new( "G", "output" => "png", "type" => "graph" )
10
+ g = GraphViz::new( "G", "output" => "png" )
11
11
  end
12
12
 
13
13
  g.node["shape"] = "ellipse"
data/examples/sample12.rb CHANGED
@@ -42,23 +42,14 @@ g.cluster1( :label => "process #2" ) do |cluster|
42
42
  end
43
43
 
44
44
  g.start :shape => "Mdiamond"
45
- g.endn :shape => "Msquare"
45
+ g.endn :shape => "Msquare", :label => "end"
46
46
 
47
- ## THIS DON'T WORK !!!
48
- #g.start << g.cluster0.a0
49
- #g.start << g.cluster1.b0
50
- #g.cluster0.a1 << g.cluster1.b3
51
- #g.cluster1.b2 << g.cluster0.a3
52
- #g.cluster0.a3 << g.cluster0.a0
53
- #g.cluster0.a3 << g.endn
54
- #g.cluster1.b3 << g.endn
47
+ g.start << g.cluster0.a0
48
+ g.start << g.cluster1.b0
49
+ g.cluster0.a1 << g.cluster1.b3
50
+ g.cluster1.b2 << g.cluster0.a3
51
+ g.cluster0.a3 << g.cluster0.a0
52
+ g.cluster0.a3 << g.endn
53
+ g.cluster1.b3 << g.endn
55
54
 
56
- g.add_edge( g.start, g.cluster0.a0 )
57
- g.add_edge( g.start, g.cluster1.b0 )
58
- g.add_edge( g.cluster0.a1, g.cluster1.b3 )
59
- g.add_edge( g.cluster1.b2, g.cluster0.a3 )
60
- g.add_edge( g.cluster0.a3, g.cluster0.a0 )
61
- g.add_edge( g.cluster0.a3, g.endn )
62
- g.add_edge( g.cluster1.b3, g.endn )
63
-
64
- g.output
55
+ g.output( :path => '/usr/local/graphviz-2.14/bin/' )
@@ -0,0 +1,48 @@
1
+ #!/usr/bin/ruby
2
+
3
+ $:.unshift( "../lib" );
4
+ require "graphviz"
5
+
6
+ GraphViz::new( "G", "output" => "png" ) { |graph|
7
+ graph.node[:shape] = "ellipse"
8
+ graph.node[:color] = "black"
9
+
10
+ graph[:color] = "black"
11
+
12
+ graph.cluster0( ) do |cluster|
13
+ cluster[:label] = "process #1"
14
+ cluster[:style] = "filled"
15
+ cluster[:color] = "lightgrey"
16
+
17
+ cluster.a0 :style => "filled", :color => "white"
18
+ cluster.a1 :style => "filled", :color => "white"
19
+ cluster.a2 :style => "filled", :color => "white"
20
+ cluster.a3 :style => "filled", :color => "white"
21
+
22
+ cluster.a0 << cluster.a1
23
+ cluster.a1 << cluster.a2
24
+ cluster.a2 << cluster.a3
25
+ end
26
+
27
+ graph.cluster1( :label => "process #2" ) do |cluster|
28
+ cluster.b0 :style => "filled", :color => "blue"
29
+ cluster.b1 :style => "filled", :color => "blue"
30
+ cluster.b2 :style => "filled", :color => "blue"
31
+ cluster.b3 :style => "filled", :color => "blue"
32
+
33
+ cluster.b0 << cluster.b1
34
+ cluster.b1 << cluster.b2
35
+ cluster.b2 << cluster.b3
36
+ end
37
+
38
+ graph.start :shape => "Mdiamond"
39
+ graph.endn :shape => "Msquare", :label => "end"
40
+
41
+ graph.start << graph.cluster0.a0
42
+ graph.start << graph.cluster1.b0
43
+ graph.cluster0.a1 << graph.cluster1.b3
44
+ graph.cluster1.b2 << graph.cluster0.a3
45
+ graph.cluster0.a3 << graph.cluster0.a0
46
+ graph.cluster0.a3 << graph.endn
47
+ graph.cluster1.b3 << graph.endn
48
+ }.output( :path => '/usr/local/graphviz-2.14/bin/' )
@@ -0,0 +1,44 @@
1
+ #!/usr/bin/ruby
2
+
3
+ $:.unshift( "../lib" );
4
+ require "graphviz"
5
+
6
+ GraphViz::new( "G", "output" => "png" ) { |graph|
7
+ graph.node[:shape] = "ellipse"
8
+ graph.node[:color] = "black"
9
+
10
+ graph[:color] = "black"
11
+
12
+ graph.cluster0( ) do |cluster|
13
+ cluster[:label] = "process #1"
14
+ cluster[:style] = "filled"
15
+ cluster[:color] = "lightgrey"
16
+
17
+ cluster.node[:style] = "filled"
18
+ cluster.node[:color] = "white"
19
+
20
+ cluster.a0 << cluster.a1
21
+ cluster.a1 << cluster.a2
22
+ cluster.a2 << cluster.a3
23
+ end
24
+
25
+ graph.cluster1( :label => "process #2", :color => "blue" ) do |cluster|
26
+ cluster.node[:style] = "filled"
27
+ cluster.node[:color] = "lightgrey"
28
+
29
+ cluster.b0 << cluster.b1
30
+ cluster.b1 << cluster.b2
31
+ cluster.b2 << cluster.b3
32
+ end
33
+
34
+ graph.start :shape => "Mdiamond"
35
+ graph.endn :shape => "Msquare", :label => "end"
36
+
37
+ graph.start << graph.cluster0.a0
38
+ graph.start << graph.cluster1.b0
39
+ graph.cluster0.a1 << graph.cluster1.b3
40
+ graph.cluster1.b2 << graph.cluster0.a3
41
+ graph.cluster0.a3 << graph.cluster0.a0
42
+ graph.cluster0.a3 << graph.endn
43
+ graph.cluster1.b3 << graph.endn
44
+ }.output( :path => '/usr/local/graphviz-2.14/bin/' )
data/lib/graphviz.rb CHANGED
@@ -125,7 +125,7 @@ class GraphViz
125
125
  return( @hoGraphs[xGraphName] )
126
126
  end
127
127
 
128
- def method_missing( idName, *args, &block )
128
+ def method_missing( idName, *args, &block ) #:nodoc:
129
129
  xName = idName.id2name
130
130
 
131
131
  rCod = nil
@@ -288,6 +288,22 @@ class GraphViz
288
288
  end
289
289
  end
290
290
 
291
+ def pg #:nodoc:
292
+ @oParentGraph
293
+ end
294
+
295
+ def self.commonGraph( o1, o2 ) #:nodoc:
296
+ g1 = o1.pg
297
+ g2 = o2.pg
298
+
299
+ return o1 if g1.nil?
300
+ return o2 if g2.nil?
301
+
302
+ return g1 if g1.object_id == g2.object_id
303
+
304
+ return GraphViz::commonGraph( g1, g2 )
305
+ end
306
+
291
307
  def set_position( xType, xKey, xValue ) #:nodoc:
292
308
  @elements_order.push( {
293
309
  "type" => "#{xType}_attr",
@@ -312,17 +328,17 @@ class GraphViz
312
328
  @oGraphType
313
329
 
314
330
  #
315
- # Create a new Graphviz object
331
+ # Create a new graph object
316
332
  #
317
333
  # Options :
318
- # :output : Output format (Constants::FORMATS)
319
- # :file : Output file name
320
- # :use : Program to use (Constants::PROGRAMS)
334
+ # :output : Output format (Constants::FORMATS) (default : dot)
335
+ # :file : Output file name (default : none)
336
+ # :use : Program to use (Constants::PROGRAMS) (default : dot)
321
337
  # :path : Program PATH
322
- # :parent : Parent graph
323
- # :type : Graph type (Constants::GRAPHTYPE)
338
+ # :parent : Parent graph (default : none)
339
+ # :type : Graph type (Constants::GRAPHTYPE) (default : digraph)
324
340
  #
325
- def initialize( xGraphName, *hOpt )
341
+ def initialize( xGraphName, *hOpt, &block )
326
342
  @format = "dot"
327
343
  @filename = nil
328
344
  @prog = "dot"
@@ -371,6 +387,8 @@ class GraphViz
371
387
  end
372
388
  end
373
389
  end
390
+
391
+ yield( self ) if( block )
374
392
  end
375
393
 
376
394
  def find_executable( ) #:nodoc:
@@ -15,7 +15,7 @@
15
15
  # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16
16
 
17
17
  module Constants
18
- RGV_VERSION = "0.8.1"
18
+ RGV_VERSION = "0.8.3"
19
19
 
20
20
  ## Const: Output formats
21
21
  FORMATS = [
@@ -55,337 +55,173 @@ module Constants
55
55
  "circo"
56
56
  ]
57
57
 
58
- ## Const: type de graphs
58
+ ## Const: graphs type
59
59
  GRAPHTYPE = [
60
60
  "digraph",
61
61
  "graph"
62
62
  ]
63
63
 
64
+ def self.getAttrsFor( x )
65
+ r = []
66
+ GENCS_ATTRS.each { |k,v|
67
+ r << k if /#{x}/.match( x.to_s ) and not r.include?( k )
68
+ }
69
+ r
70
+ end
71
+
64
72
  # E, N, G, S and C represent edges, nodes, the root graph, subgraphs and cluster subgraphs, respectively
65
73
  GENCS_ATTRS = {
66
- "Damping" => { "UseBy" => "G", "Type" => "double" },
67
- "K" => { "UseBy" => "GC", "Tyep" => "double" },
68
- "URL" => { "UseBy" => "ENGC", "Type" => "escString, string" },
69
- "arrowhead" => { "UseBy" => "E", "Type" => "arrowType" },
70
- "arrowsize" => { "UseBy" => "E", "Type" => "double" },
71
- "arrowtail" => { "UseBy" => "E", "Type" => "arrowType" },
72
- "bb" => { "UseBy" => "G", "Type" => "rect" },
73
- "bgcolor" => { "UseBy" => "GC", "Type" => "color" },
74
- "bottomlabel" => { "UseBy" => "N", "Type" => "string" },
75
- "center" => { "UseBy" => "G", "Type" => "bool" },
76
- "charset" => { "UseBy" => "G", "Type" => "string" },
77
- "clusterrank" => { "UseBy" => "G", "Type" => "clusterMode" },
78
- "color" => { "UseBy" => "ENC", "Type" => "color, colorList" },
79
- "colorscheme" => { "UseBy" => "ENCG", "Type" => "string" },
80
- "comment" => { "UseBy" => "ENG", "Type" => "string" },
81
- "compound" => { "UseBy" => "G", "Type" => "bool" },
82
- "concentrate" => { "UseBy" => "G", "Type" => "bool" },
83
- "constraint" => { "UseBy" => "E", "Type" => "bool" },
84
- "decorate" => { "UseBy" => "E", "Type" => "bool" },
85
- "defaultdist" => { "UseBy" => "G", "Type" => "double" },
86
- "dim" => { "UseBy" => "G", "Type" => "int" },
87
- "dir" => { "UseBy" => "E", "Type" => "dirType" },
88
- "diredgeconstraints"=> { "UseBy" => "N", "Type" => "double" },
89
- "distortion" => { "UseBy" => "N", "Type" => "double" },
90
- "dpi" => { "UseBy" => "G", "Type" => "double" },
91
- "edgeURL" => { "UseBy" => "E", "Type" => "lblString" },
92
- "edgehref" => { "UseBy" => "E", "Type" => "lblString" },
93
- "edgetarget" => { "UseBy" => "E", "Type" => "escString" },
94
- "edgetooltip" => { "UseBy" => "E", "Type" => "escString" },
95
- "epsilon" => { "UseBy" => "G", "Type" => "double" },
96
- "esep" => { "UseBy" => "G", "Type" => "double" },
97
- "fillcolor" => { "UseBy" => "NC", "Type" => "color" },
98
- "fixedsize" => { "UseBy" => "N", "Type" => "bool" },
99
- "fontcolor" => { "UseBy" => "ENGC", "Type" => "color" },
100
- "fontname" => { "UseBy" => "ENGC", "Type" => "string" },
101
- "fontpath" => { "UseBy" => "G", "Type" => "string" },
102
- "fontsize" => { "UseBy" => "ENGC", "Type" => "double" },
103
- "group" => { "UseBy" => "N", "Type" => "string" },
104
- "headURL" => { "UseBy" => "E", "Type" => "escString" },
105
- "headclip" => { "UseBy" => "E", "Type" => "bool" },
106
- "headhref" => { "UseBy" => "E", "Type" => "escString" },
107
- "headlabel" => { "UseBy" => "E", "Type" => "lblString" },
108
- "headport" => { "UseBy" => "E", "Type" => "portPos" },
109
- "headtarget" => { "UseBy" => "E", "Type" => "escString" },
110
- "headtooltip" => { "UseBy" => "E", "Type" => "escString" },
111
- "height" => { "UseBy" => "N", "Type" => "double" },
112
- "href" => { "UseBy" => "E", "Type" => "lblString" },
113
- "html" => { "UseBy" => "N", "Type" => "lblString" }, # API extension
114
- "labelURL" => { "UseBy" => "E", "Type" => "double" },
115
- "labelangle" => { "UseBy" => "E", "Type" => "double" },
116
- "labeldistance" => { "UseBy" => "E", "Type" => "double" },
117
- "labelfloat" => { "UseBy" => "E", "Type" => "bool" },
118
- "labelfontcolor" => { "UseBy" => "E", "Type" => "color" },
119
- "labelfontname" => { "UseBy" => "E", "Type" => "string" },
120
- "labelfontsize" => { "UseBy" => "E", "Type" => "double" },
121
- "labelhref" => { "UseBy" => "E", "Type" => "double" },
122
- "labeljust" => { "UseBy" => "GC", "Type" => "string" },
123
- "labelloc" => { "UseBy" => "GC", "Type" => "string" },
124
- "labeltarget" => { "UseBy" => "E", "Type" => "escString" },
125
- "labeltooltip" => { "UseBy" => "E", "Type" => "escString" },
126
- "landscape" => { "UseBy" => "G", "Type" => "bool" },
127
- "layer" => { "UseBy" => "EN", "Type" => "layerRange" },
128
- "layers" => { "UseBy" => "G", "Type" => "layerList" },
129
- "layersep" => { "UseBy" => "G", "Type" => "string" },
130
- "len" => { "UseBy" => "E", "Type" => "double" },
131
- "levelsgap" => { "UseBy" => "G", "Type" => "double" },
132
- "lhead" => { "UseBy" => "E", "Type" => "string" },
133
- "lp" => { "UseBy" => "EGC", "Type" => "point" },
134
- "ltail" => { "UseBy" => "E", "Type" => "string" },
135
- "margin" => { "UseBy" => "NG", "Type" => "double, pointf" },
136
- "maxiter" => { "UseBy" => "G", "Type" => "int" },
137
- "mclimit" => { "UseBy" => "G", "Type" => "double" },
138
- "mindist" => { "UseBy" => "G", "Type" => "double" },
139
- "minlen" => { "UseBy" => "E", "Type" => "int" },
140
- "mode" => { "UseBy" => "G", "Type" => "string" },
141
- "model" => { "UseBy" => "G", "Type" => "string" },
142
- "mosek" => { "UseBy" => "G", "Type" => "bool" },
143
- "nodesep" => { "UseBy" => "G", "Type" => "double" },
144
- "nojustify" => { "UseBy" => "GCNE", "Type" => "bool" },
145
- "normalize" => { "UseBy" => "G", "Type" => "bool" },
146
- "nslimit" => { "UseBy" => "G", "Type" => "double" },
147
- "nslimit1" => { "UseBy" => "G", "Type" => "double" },
148
- "ordering" => { "UseBy" => "G", "Type" => "string" },
149
- "orientation" => { "UseBy" => "N", "Type" => "double" },
150
- "orientation" => { "UseBy" => "G", "Type" => "string" },
151
- "outputorder" => { "UseBy" => "G", "Type" => "outputMode" },
152
- "overlap" => { "UseBy" => "G", "Type" => "string, bool" },
153
- "pack" => { "UseBy" => "G", "Type" => "bool, int" },
154
- "packmode" => { "UseBy" => "G", "Type" => "packMode" },
155
- "pad" => { "UseBy" => "G", "Type" => "double, pointf" },
156
- "page" => { "UseBy" => "G", "Type" => "pointf" },
157
- "pagedir" => { "UseBy" => "G", "Type" => "pagedir" },
158
- "pencolor" => { "UseBy" => "C", "Type" => "color" },
159
- "peripheries" => { "UseBy" => "NC", "Type" => "int" },
160
- "pin" => { "UseBy" => "N", "Type" => "bool" },
161
- "pos" => { "UseBy" => "EN", "Type" => "point, splineType" },
162
- "quantum" => { "UseBy" => "G", "Type" => "double" },
163
- "rank" => { "UseBy" => "S", "Type" => "rankType" },
164
- "rankdir" => { "UseBy" => "G", "Type" => "rankdir" },
165
- "ranksep" => { "UseBy" => "G", "Type" => "double" },
166
- "ratio" => { "UseBy" => "G", "Type" => "double, string" },
167
- "rects" => { "UseBy" => "N", "Type" => "rect" },
168
- "regular" => { "UseBy" => "N", "Type" => "bool" },
169
- "remincross" => { "UseBy" => "G", "Type" => "bool" },
170
- "resolution" => { "UseBy" => "G", "Type" => "double" },
171
- "root" => { "UseBy" => "GN", "Type" => "string, bool" },
172
- "rotate" => { "UseBy" => "G", "Type" => "int" },
173
- "samehead" => { "UseBy" => "E", "Type" => "string" },
174
- "sametail" => { "UseBy" => "E", "Type" => "string" },
175
- "samplepoints" => { "UseBy" => "G", "Type" => "int" },
176
- "searchsize" => { "UseBy" => "G", "Type" => "int" },
177
- "sep" => { "UseBy" => "G", "Type" => "double, pointf" },
178
- "shape" => { "UseBy" => "N", "Type" => "shape" },
179
- "shapefile" => { "UseBy" => "N", "Type" => "string" },
180
- "showboxes" => { "UseBy" => "ENG", "Type" => "int" },
181
- "sides" => { "UseBy" => "N", "Type" => "int" },
182
- "size" => { "UseBy" => "G", "Type" => "pointf" },
183
- "skew" => { "UseBy" => "N", "Type" => "double" },
184
- "splines" => { "UseBy" => "G", "Type" => "bool, string" },
185
- "start" => { "UseBy" => "G", "Type" => "startType" },
186
- "style" => { "UseBy" => "ENC", "Type" => "style" },
187
- "stylesheet" => { "UseBy" => "G", "Type" => "string" },
188
- "tailURL" => { "UseBy" => "E", "Type" => "escString" },
189
- "tailclip" => { "UseBy" => "E", "Type" => "bool" },
190
- "tailhref" => { "UseBy" => "E", "Type" => "escString" },
191
- "taillabel" => { "UseBy" => "E", "Type" => "lblString" },
192
- "tailport" => { "UseBy" => "E", "Type" => "portPos" },
193
- "tailtarget" => { "UseBy" => "E", "Type" => "escString" },
194
- "tailtooltip" => { "UseBy" => "E", "Type" => "escString" },
195
- "target" => { "UseBy" => "ENGC", "Type" => "escString, string" },
196
- "tooltip" => { "UseBy" => "NE", "Type" => "escString" },
197
- "toplabel" => { "UseBy" => "N", "Type" => "string" },
198
- "truecolor" => { "UseBy" => "G", "Type" => "bool" },
199
- "vertices" => { "UseBy" => "N", "Type" => "pointfList" },
200
- "viewport" => { "UseBy" => "G", "Type" => "viewPort" },
201
- "voro_margin" => { "UseBy" => "G", "Type" => "double" },
202
- "weight" => { "UseBy" => "E", "Type" => "double" },
203
- "width" => { "UseBy" => "N", "Type" => "double" },
204
- "z" => { "UseBy" => "N", "Type" => "double" }
74
+ "Damping" => "G",
75
+ "K" => "GC",
76
+ "URL" => "ENGC",
77
+ "arrowhead" => "E",
78
+ "arrowsize" => "E",
79
+ "arrowtail" => "E",
80
+ "bb" => "G",
81
+ "bgcolor" => "GC",
82
+ # "bottomlabel" => "N",
83
+ "center" => "G",
84
+ "charset" => "G",
85
+ "clusterrank" => "G",
86
+ "color" => "ENC",
87
+ "colorscheme" => "ENCG",
88
+ "comment" => "ENG",
89
+ "compound" => "G",
90
+ "concentrate" => "G",
91
+ "constraint" => "E",
92
+ "decorate" => "E",
93
+ "defaultdist" => "G",
94
+ "dim" => "G",
95
+ "dir" => "E",
96
+ "diredgeconstraints" => "G",
97
+ "distortion" => "N",
98
+ "dpi" => "G",
99
+ "edgeURL" => "E",
100
+ "edgehref" => "E",
101
+ "edgetarget" => "E",
102
+ "edgetooltip" => "E",
103
+ "epsilon" => "G",
104
+ "esep" => "G",
105
+ "fillcolor" => "NC",
106
+ "fixedsize" => "N",
107
+ "fontcolor" => "ENGC",
108
+ "fontname" => "ENGC",
109
+ "fontnames" => "G",
110
+ "fontpath" => "G",
111
+ "fontsize" => "ENGC",
112
+ "group" => "N",
113
+ "headURL" => "E",
114
+ "headclip" => "E",
115
+ "headhref" => "E",
116
+ "headlabel" => "E",
117
+ "headport" => "E",
118
+ "headtarget" => "E",
119
+ "headtooltip" => "E",
120
+ "height" => "N",
121
+ "href" => "E",
122
+ "html" => "N", # API extension
123
+ "image" => "N",
124
+ "imagescale" => "N",
125
+ "label" => "ENGC",
126
+ "labelURL" => "E",
127
+ "labelangle" => "E",
128
+ "labeldistance" => "E",
129
+ "labelfloat" => "E",
130
+ "labelfontcolor" => "E",
131
+ "labelfontname" => "E",
132
+ "labelfontsize" => "E",
133
+ "labelhref" => "E",
134
+ "labeljust" => "GC",
135
+ "labelloc" => "GCN",
136
+ "labeltarget" => "E",
137
+ "labeltooltip" => "E",
138
+ "landscape" => "G",
139
+ "layer" => "EN",
140
+ "layers" => "G",
141
+ "layersep" => "G",
142
+ "len" => "E",
143
+ "levelsgap" => "G",
144
+ "lhead" => "E",
145
+ "lp" => "EGC",
146
+ "ltail" => "E",
147
+ "margin" => "NG",
148
+ "maxiter" => "G",
149
+ "mclimit" => "G",
150
+ "mindist" => "G",
151
+ "minlen" => "E",
152
+ "mode" => "G",
153
+ "model" => "G",
154
+ "mosek" => "G",
155
+ "nodesep" => "G",
156
+ "nojustify" => "GCNE",
157
+ "normalize" => "G",
158
+ "nslimit" => "G",
159
+ "nslimit1" => "G",
160
+ "ordering" => "G",
161
+ "orientation" => "NG",
162
+ "outputorder" => "G",
163
+ "overlap" => "G",
164
+ "pack" => "G",
165
+ "packmode" => "G",
166
+ "pad" => "G",
167
+ "page" => "G",
168
+ "pagedir" => "G",
169
+ "pencolor" => "C",
170
+ "penwidth" => "CNE",
171
+ "peripheries" => "NC",
172
+ "pin" => "N",
173
+ "pos" => "EN",
174
+ "quantum" => "G",
175
+ "rank" => "S",
176
+ "rankdir" => "G",
177
+ "ranksep" => "G",
178
+ "ratio" => "G",
179
+ "rects" => "N",
180
+ "regular" => "N",
181
+ "remincross" => "G",
182
+ "resolution" => "G",
183
+ "root" => "GN",
184
+ "rotate" => "G",
185
+ "samehead" => "E",
186
+ "sametail" => "E",
187
+ "samplepoints" => "G",
188
+ "searchsize" => "G",
189
+ "sep" => "G",
190
+ "shape" => "N",
191
+ "shapefile" => "N",
192
+ "showboxes" => "ENG",
193
+ "sides" => "N",
194
+ "size" => "G",
195
+ "skew" => "N",
196
+ "splines" => "G",
197
+ "start" => "G",
198
+ "style" => "ENC",
199
+ "stylesheet" => "G",
200
+ "tailURL" => "E",
201
+ "tailclip" => "E",
202
+ "tailhref" => "E",
203
+ "taillabel" => "E",
204
+ "tailport" => "E",
205
+ "tailtarget" => "E",
206
+ "tailtooltip" => "E",
207
+ "target" => "ENGC",
208
+ "tooltip" => "NEC",
209
+ # "toplabel" => "N",
210
+ "truecolor" => "G",
211
+ "vertices" => "N",
212
+ "viewport" => "G",
213
+ "voro_margin" => "G",
214
+ "weight" => "E",
215
+ "width" => "N",
216
+ "z" => "N"
205
217
  }
206
218
 
207
219
  ## Const: Graph attributs
208
- GRAPHSATTRS = [
209
- "Damping",
210
- "K",
211
- "URL",
212
- "bb",
213
- "bgcolor",
214
- "center",
215
- "charset",
216
- "clusterrank",
217
- "color",
218
- "colorscheme",
219
- "comment",
220
- "compound",
221
- "concentrate",
222
- "defaultdist",
223
- "dim",
224
- "diredgeconstraints",
225
- "dpi",
226
- "epsilon",
227
- "esep",
228
- "fillcolor",
229
- "fontcolor",
230
- "fontname",
231
- "fontnames",
232
- "fontpath",
233
- "fontsize",
234
- "label",
235
- "labeljust",
236
- "labelloc",
237
- "landscape",
238
- "layer",
239
- "layers",
240
- "layersep",
241
- "lp",
242
- "margin",
243
- "maxiter",
244
- "mclimit",
245
- "mindist",
246
- "mode",
247
- "model",
248
- "mosek",
249
- "nodesep",
250
- "nojustify",
251
- "normalize",
252
- "nslimit",
253
- "nslimit1",
254
- "ordering",
255
- "orientation",
256
- "outputorder",
257
- "overlap",
258
- "pack",
259
- "packmode",
260
- "pad",
261
- "page",
262
- "pagedir",
263
- "pencolor",
264
- "peripheries",
265
- "quantum",
266
- "rank",
267
- "rankdir",
268
- "ranksep",
269
- "ratio",
270
- "remincross",
271
- "resolution",
272
- "root",
273
- "rotate",
274
- "samplepoints",
275
- "searchsize",
276
- "sep",
277
- "showboxes",
278
- "size",
279
- "splines",
280
- "start",
281
- "style",
282
- "stylesheet",
283
- "target",
284
- "tooltip",
285
- "truecolor",
286
- "viewport",
287
- "voro_margin"
288
- ]
220
+ GRAPHSATTRS = Constants::getAttrsFor( :G ) + Constants::getAttrsFor( :S ) + Constants::getAttrsFor( :C )
289
221
 
290
222
  ## Const: Node attributs
291
- NODESATTRS = [
292
- "URL",
293
- "bottomlabel",
294
- "color",
295
- "colorscheme",
296
- "comment",
297
- "distortion",
298
- "fillcolor",
299
- "fixedsize",
300
- "fontcolor",
301
- "fontname",
302
- "fontsize",
303
- "group",
304
- "height",
305
- "label", "html",
306
- "layer",
307
- "margin",
308
- "nojustify",
309
- "orientation",
310
- "peripheries",
311
- "pin",
312
- "pos",
313
- "rects",
314
- "regular",
315
- "root",
316
- "samplepoints",
317
- "shape",
318
- "shapefile",
319
- "sides",
320
- "skew",
321
- "style",
322
- "target",
323
- "tooltip",
324
- #"toplabel",
325
- #does not appear to be an option according to attributes info
326
- "vertices",
327
- "width",
328
- "z"
329
- ]
223
+ NODESATTRS = Constants::getAttrsFor( :N )
330
224
 
331
225
  ## Const: Edge attributs
332
- EDGESATTRS = [
333
- "arrowhead",
334
- "arrowsize",
335
- "arrowtail",
336
- "color",
337
- "colorscheme",
338
- "comment",
339
- "constraint",
340
- "decorate",
341
- "dir",
342
- "edgeURL",
343
- "edgehref",
344
- "edgetarget",
345
- "edgetooltip",
346
- "fontcolor",
347
- "fontname",
348
- "fontsize",
349
- "headURL",
350
- "headclip",
351
- "headhref",
352
- "headlabel",
353
- "headport",
354
- "headtarget",
355
- "headtooltip",
356
- "href",
357
- "label",
358
- "labelURL",
359
- "labelangle",
360
- "labeldistance",
361
- "labelfloat",
362
- "labelfontcolor",
363
- "labelfontname",
364
- "labelfontsize",
365
- "labelhref",
366
- "labeltarget",
367
- "labeltooltip",
368
- "layer",
369
- "len",
370
- "lhead",
371
- "lp",
372
- "ltail",
373
- "minlen",
374
- "nojustify",
375
- "pos",
376
- "samehead",
377
- "sametail",
378
- "showboxes",
379
- "style",
380
- "tailURL",
381
- "tailclip",
382
- "tailhref",
383
- "taillabel",
384
- "tailport",
385
- "tailtarget",
386
- "tailtooltip",
387
- "target",
388
- "tooltip",
389
- "weight"
390
- ]
226
+ EDGESATTRS = Constants::getAttrsFor( :E )
391
227
  end
data/lib/graphviz/node.rb CHANGED
@@ -62,7 +62,11 @@ class GraphViz
62
62
  # Create an edge between the current node and the node +oNode+
63
63
  #
64
64
  def <<( oNode )
65
- return @oGParrent.add_edge( self, oNode )
65
+ return GraphViz::commonGraph( oNode, self ).add_edge( self, oNode )
66
+ end
67
+
68
+ def pg #:nodoc:
69
+ @oGParrent
66
70
  end
67
71
 
68
72
  def output #:nodoc:
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-graphviz
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.1
4
+ version: 0.8.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gregoire Lejeune
@@ -9,14 +9,14 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-04-06 00:00:00 +02:00
12
+ date: 2008-05-16 00:00:00 +02:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
16
16
  description: Ruby/Graphviz provides an interface to layout and generate images of directed graphs in a variety of formats (PostScript, PNG, etc.) using GraphViz.
17
17
  email: gregoire.lejeune@free.fr
18
- executables: []
19
-
18
+ executables:
19
+ - ruby2gv
20
20
  extensions: []
21
21
 
22
22
  extra_rdoc_files:
@@ -30,11 +30,16 @@ files:
30
30
  - README
31
31
  - AUTHORS
32
32
  - setup.rb
33
- - bin/ruby2gv.rb
33
+ - bin/ruby2gv
34
34
  - examples/arrowhead.rb
35
35
  - examples/HTML-Labels.rb
36
36
  - examples/maketest.sh
37
37
  - examples/p2p.rb
38
+ - examples/s10.png
39
+ - examples/s12.png
40
+ - examples/s13.png
41
+ - examples/s14.png
42
+ - examples/sample-dsl-10.rb
38
43
  - examples/sample01.rb
39
44
  - examples/sample02.rb
40
45
  - examples/sample03.rb
@@ -46,6 +51,8 @@ files:
46
51
  - examples/sample10.rb
47
52
  - examples/sample11.rb
48
53
  - examples/sample12.rb
54
+ - examples/sample13.rb
55
+ - examples/sample14.rb
49
56
  - examples/shapes.rb
50
57
  - examples/test.xml
51
58
  - examples/testorder.rb
@@ -83,7 +90,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
83
90
  requirements: []
84
91
 
85
92
  rubyforge_project: ruby-asp
86
- rubygems_version: 1.1.0
93
+ rubygems_version: 1.1.1
87
94
  signing_key:
88
95
  specification_version: 2
89
96
  summary: Interface to the GraphViz graphing tool