ruby-graphviz 0.9.7 → 0.9.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/AUTHORS +2 -0
- data/ChangeLog.rdoc +9 -0
- data/README.rdoc +11 -0
- data/bin/gem2gv +166 -0
- data/bin/ruby2gv +76 -33
- data/examples/HTML-Labels.rb +8 -1
- data/examples/dot/hello_test.rb +1 -1
- data/examples/maketest.bat +94 -0
- data/examples/maketest.sh +10 -0
- data/examples/sample01.rb +1 -1
- data/examples/sample28.rb +12 -0
- data/examples/sample29.rb +8 -0
- data/examples/sample30.rb +12 -0
- data/examples/sdlshapes/README +2 -0
- data/examples/sdlshapes/sdl.ps +655 -0
- data/examples/sdlshapes/sdlshapes.dot +78 -0
- data/examples/testxml.rb +1 -1
- data/lib/graphviz.rb +43 -18
- data/lib/graphviz/attrs.rb +5 -4
- data/lib/graphviz/constants.rb +184 -151
- data/lib/graphviz/edge.rb +2 -2
- data/lib/graphviz/node.rb +10 -4
- data/lib/graphviz/parser.rb +15 -0
- data/lib/graphviz/types.rb +21 -0
- data/lib/graphviz/types/esc_string.rb +29 -0
- data/lib/graphviz/types/html_string.rb +16 -0
- data/lib/graphviz/xml.rb +1 -1
- data/test/test_init.rb +46 -0
- metadata +15 -2
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
digraph test
|
|
2
|
+
{
|
|
3
|
+
sdl_task [shape=sdl_task, color=red, fillcolor=cyan, style=filled, peripheries=0];
|
|
4
|
+
sdl_task2 [shape=sdl_task, label="sdl_task", peripheries=0];
|
|
5
|
+
sdl_task -> sdl_task2;
|
|
6
|
+
sdl_input_from_right [shape=sdl_input_from_right, color=red, fillcolor=cyan, style=filled, peripheries=0];
|
|
7
|
+
sdl_input_from_right2 [shape=sdl_input_from_right, label="sdl_input_from_right ", peripheries=0];
|
|
8
|
+
sdl_input_from_right -> sdl_input_from_right2;
|
|
9
|
+
sdl_input_from_left [shape=sdl_input_from_left, color=red, fillcolor=cyan, style=filled, peripheries=0];
|
|
10
|
+
sdl_input_from_left2 [shape=sdl_input_from_left, label=" sdl_input_from_left", peripheries=0];
|
|
11
|
+
sdl_input_from_left -> sdl_input_from_left2;
|
|
12
|
+
sdl_priority_input_from_right [shape=sdl_priority_input_from_right, color=red, fillcolor=cyan, style=filled, peripheries=0];
|
|
13
|
+
sdl_priority_input_from_right2 [shape=sdl_priority_input_from_right, label="sdl_priority_input_from_right ", peripheries=0];
|
|
14
|
+
sdl_priority_input_from_right -> sdl_priority_input_from_right2;
|
|
15
|
+
sdl_priority_input_from_left [shape=sdl_priority_input_from_left, color=red, fillcolor=cyan, style=filled, peripheries=0];
|
|
16
|
+
sdl_priority_input_from_left2 [shape=sdl_priority_input_from_left, label=" sdl_priority_input_from_left", peripheries=0];
|
|
17
|
+
sdl_priority_input_from_left -> sdl_priority_input_from_left2;
|
|
18
|
+
sdl_start [shape=sdl_start, color=red, fillcolor=cyan, style=filled, peripheries=0];
|
|
19
|
+
sdl_start2 [shape=sdl_start, label=" ", peripheries=0];
|
|
20
|
+
sdl_start -> sdl_start2;
|
|
21
|
+
sdl_procedure_start [shape=sdl_procedure_start, color=red, fillcolor=cyan, style=filled, peripheries=0];
|
|
22
|
+
sdl_procedure_start2 [shape=sdl_procedure_start, label=" ", peripheries=0];
|
|
23
|
+
sdl_procedure_start -> sdl_procedure_start2;
|
|
24
|
+
sdl_state [shape=sdl_state, color=red, fillcolor=cyan, style=filled, peripheries=0];
|
|
25
|
+
sdl_state2 [shape=sdl_state, peripheries=0];
|
|
26
|
+
sdl_state -> sdl_state2;
|
|
27
|
+
sdl_output_to_right [shape=sdl_output_to_right, color=red, fillcolor=cyan, style=filled, peripheries=0];
|
|
28
|
+
sdl_output_to_right2 [shape=sdl_output_to_right, label="sdl_output_to_right ", peripheries=0];
|
|
29
|
+
sdl_output_to_right -> sdl_output_to_right2;
|
|
30
|
+
sdl_output_to_left [shape=sdl_output_to_left, color=red, fillcolor=cyan, style=filled, peripheries=0];
|
|
31
|
+
sdl_output_to_left2 [shape=sdl_output_to_left, label=" sdl_output_to_left", peripheries=0];
|
|
32
|
+
sdl_output_to_left -> sdl_output_to_left2;
|
|
33
|
+
sdl_condition [shape=sdl_condition, color=red, fillcolor=cyan, style=filled, peripheries=0];
|
|
34
|
+
sdl_condition2 [shape=sdl_condition, label=" sdl_condition ", peripheries=0];
|
|
35
|
+
sdl_condition -> sdl_condition2;
|
|
36
|
+
sdl_save [shape=sdl_save, color=red, fillcolor=cyan, style=filled, peripheries=0];
|
|
37
|
+
sdl_save2 [shape=sdl_save, label=" sdl_save ", peripheries=0];
|
|
38
|
+
sdl_save -> sdl_save2;
|
|
39
|
+
sdl_stop [shape=sdl_stop, peripheries=0];
|
|
40
|
+
sdl_stop2 [shape=sdl_stop, label="", peripheries=0];
|
|
41
|
+
sdl_stop -> sdl_stop2 [arrowhead=none, headclip=false];
|
|
42
|
+
sdl_return [shape=sdl_return, color=red, fillcolor=cyan, style=filled, peripheries=0];
|
|
43
|
+
sdl_return2 [shape=sdl_return, label="", peripheries=0];
|
|
44
|
+
sdl_return -> sdl_return2;
|
|
45
|
+
sdl_create [shape=sdl_create, color=red, fillcolor=cyan, style=filled, peripheries=0];
|
|
46
|
+
sdl_create2 [shape=sdl_create, peripheries=0];
|
|
47
|
+
sdl_create -> sdl_create2;
|
|
48
|
+
sdl_call [shape=sdl_call, color=red, fillcolor=cyan, style=filled, peripheries=0];
|
|
49
|
+
sdl_call2 [shape=sdl_call, label=" sdl_call ", peripheries=0];
|
|
50
|
+
sdl_call -> sdl_call2;
|
|
51
|
+
sdl_text [shape=sdl_text, color=red, fillcolor=cyan, style=filled, peripheries=0];
|
|
52
|
+
sdl_text2 [shape=sdl_text, peripheries=0];
|
|
53
|
+
sdl_text -> sdl_text2;
|
|
54
|
+
sdl_text_extension_from_left [shape=sdl_text_extension_from_left, color=red, fillcolor=cyan, style=filled, peripheries=0];
|
|
55
|
+
sdl_text_extension_from_left2 [shape=sdl_text_extension_from_left, peripheries=0];
|
|
56
|
+
sdl_text_extension_from_left -> sdl_text_extension_from_left2;
|
|
57
|
+
sdl_text_extension_from_right [shape=sdl_text_extension_from_right, color=red, fillcolor=cyan, style=filled, peripheries=0];
|
|
58
|
+
sdl_text_extension_from_right2 [shape=sdl_text_extension_from_right, peripheries=0];
|
|
59
|
+
sdl_text_extension_from_right -> sdl_text_extension_from_right2;
|
|
60
|
+
sdl_comment_from_left [shape=sdl_comment_from_left, color=red, fillcolor=cyan, style=filled, peripheries=0];
|
|
61
|
+
sdl_comment_from_left2 [shape=sdl_comment_from_left, style=dashed, peripheries=0];
|
|
62
|
+
sdl_comment_from_left -> sdl_comment_from_left2;
|
|
63
|
+
sdl_comment_from_right [shape=sdl_comment_from_right, color=red, fillcolor=cyan, style=filled, peripheries=0];
|
|
64
|
+
sdl_comment_from_right2 [shape=sdl_comment_from_right, style=dashed, peripheries=0];
|
|
65
|
+
sdl_comment_from_right -> sdl_comment_from_right2;
|
|
66
|
+
sdl_connector [shape=sdl_connector, color=red, fillcolor=cyan, style=filled, peripheries=0];
|
|
67
|
+
sdl_connector2 [shape=sdl_connector, peripheries=0];
|
|
68
|
+
sdl_connector -> sdl_connector2;
|
|
69
|
+
sdl_set [shape=sdl_set, color=red, fillcolor=cyan, style=filled, peripheries=0];
|
|
70
|
+
sdl_set2 [shape=sdl_set, label=" sdl_set2", peripheries=0];
|
|
71
|
+
sdl_set -> sdl_set2;
|
|
72
|
+
sdl_reset [shape=sdl_reset, color=red, fillcolor=cyan, style=filled, peripheries=0];
|
|
73
|
+
sdl_reset2 [shape=sdl_reset, label=" sdl_reset2", peripheries=0];
|
|
74
|
+
sdl_reset -> sdl_reset2;
|
|
75
|
+
sdl_export [shape=sdl_export, color=red, fillcolor=cyan, style=filled, peripheries=0];
|
|
76
|
+
sdl_export2 [shape=sdl_export, label=" sdl_export", peripheries=0];
|
|
77
|
+
sdl_export -> sdl_export2;
|
|
78
|
+
}
|
data/examples/testxml.rb
CHANGED
data/lib/graphviz.rb
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Copyright (C) 2003, 2004, 2005, 2006, 2007 Gregoire Lejeune <gregoire.lejeune@free.fr>
|
|
1
|
+
# Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Gregoire Lejeune <gregoire.lejeune@free.fr>
|
|
2
2
|
#
|
|
3
3
|
# This program is free software; you can redistribute it and/or modify
|
|
4
4
|
# it under the terms of the GNU General Public License as published by
|
|
@@ -29,6 +29,7 @@ require 'graphviz/edge'
|
|
|
29
29
|
require 'graphviz/attrs'
|
|
30
30
|
require 'graphviz/constants'
|
|
31
31
|
require 'graphviz/parser'
|
|
32
|
+
require 'graphviz/types'
|
|
32
33
|
|
|
33
34
|
class GraphViz
|
|
34
35
|
include Constants
|
|
@@ -46,11 +47,14 @@ class GraphViz
|
|
|
46
47
|
@@prog = "dot"
|
|
47
48
|
@prog
|
|
48
49
|
## Var: program path
|
|
49
|
-
@@path =
|
|
50
|
+
@@path = []
|
|
50
51
|
@path
|
|
51
52
|
## Var: Error level
|
|
52
53
|
@@errors = 1
|
|
53
54
|
@errors
|
|
55
|
+
## Var: External libraries
|
|
56
|
+
@@extlibs = []
|
|
57
|
+
@extlibs
|
|
54
58
|
|
|
55
59
|
## Var: Graph name
|
|
56
60
|
@name
|
|
@@ -234,7 +238,13 @@ class GraphViz
|
|
|
234
238
|
# Get the value of the graph attribut +xAttrName+
|
|
235
239
|
#
|
|
236
240
|
def []( xAttrName )
|
|
237
|
-
|
|
241
|
+
if Hash === xAttrName
|
|
242
|
+
xAttrName.each do |key, value|
|
|
243
|
+
self[key] = value
|
|
244
|
+
end
|
|
245
|
+
else
|
|
246
|
+
return( @graph[xAttrName].clone )
|
|
247
|
+
end
|
|
238
248
|
end
|
|
239
249
|
|
|
240
250
|
#
|
|
@@ -291,15 +301,15 @@ class GraphViz
|
|
|
291
301
|
|
|
292
302
|
case kElement["type"]
|
|
293
303
|
when "graph_attr"
|
|
294
|
-
xData << xSeparator + kElement["name"] + " =
|
|
304
|
+
xData << xSeparator + kElement["name"] + " = " + kElement["value"].to_gv
|
|
295
305
|
xSeparator = "; "
|
|
296
306
|
|
|
297
307
|
when "node_attr"
|
|
298
|
-
xData << xSeparator + kElement["name"] + " =
|
|
308
|
+
xData << xSeparator + kElement["name"] + " = " + kElement["value"].to_gv
|
|
299
309
|
xSeparator = ", "
|
|
300
310
|
|
|
301
311
|
when "edge_attr"
|
|
302
|
-
xData << xSeparator + kElement["name"] + " =
|
|
312
|
+
xData << xSeparator + kElement["name"] + " = " + kElement["value"].to_gv
|
|
303
313
|
xSeparator = ", "
|
|
304
314
|
|
|
305
315
|
when "node"
|
|
@@ -354,9 +364,11 @@ class GraphViz
|
|
|
354
364
|
end
|
|
355
365
|
@prog = xValue
|
|
356
366
|
when "path"
|
|
357
|
-
@path = xValue
|
|
367
|
+
@path = xValue.split( "," ).map{ |x| x.strip }
|
|
358
368
|
when "errors"
|
|
359
369
|
@errors = xValue
|
|
370
|
+
when "extlib"
|
|
371
|
+
@extlibs = xValue.split( "," ).map{ |x| x.strip }
|
|
360
372
|
else
|
|
361
373
|
if FORMATS.index( xKey.to_s ).nil? == true
|
|
362
374
|
raise ArgumentError, "output format '#{xValue}' invalid"
|
|
@@ -370,7 +382,7 @@ class GraphViz
|
|
|
370
382
|
|
|
371
383
|
xOutputString = (@filename == String ||
|
|
372
384
|
@output.any? {|format, file| file == String })
|
|
373
|
-
|
|
385
|
+
|
|
374
386
|
xOutput =
|
|
375
387
|
if @format.to_s == "none" || @output.any? {|fmt, fn| fmt.to_s == "none" }
|
|
376
388
|
xDOTScript
|
|
@@ -380,7 +392,7 @@ class GraphViz
|
|
|
380
392
|
t.print( xDOTScript )
|
|
381
393
|
t.close
|
|
382
394
|
|
|
383
|
-
cmd = find_executable( )
|
|
395
|
+
cmd = find_executable( @prog, @path )
|
|
384
396
|
if cmd == nil
|
|
385
397
|
raise StandardError, "GraphViz not installed or #{@prog} not in PATH. Install GraphViz or use the 'path' option"
|
|
386
398
|
end
|
|
@@ -404,10 +416,15 @@ class GraphViz
|
|
|
404
416
|
end
|
|
405
417
|
end
|
|
406
418
|
|
|
419
|
+
xExternalLibraries = ""
|
|
420
|
+
@extlibs.each do |lib|
|
|
421
|
+
xExternalLibraries << "-l#{lib} "
|
|
422
|
+
end
|
|
423
|
+
|
|
407
424
|
if IS_JRUBY
|
|
408
|
-
xCmd = "#{cmd} -q#{@errors} #{xOutputWithFile} #{xOutputWithoutFile} #{t.path}"
|
|
425
|
+
xCmd = "#{cmd} -q#{@errors} #{xExternalLibraries} #{xOutputWithFile} #{xOutputWithoutFile} #{t.path}"
|
|
409
426
|
else
|
|
410
|
-
xCmd = "\"#{cmd}\" -q#{@errors} #{xOutputWithFile} #{xOutputWithoutFile} #{t.path}"
|
|
427
|
+
xCmd = "\"#{cmd}\" -q#{@errors} #{xExternalLibraries} #{xOutputWithFile} #{xOutputWithoutFile} #{t.path}"
|
|
411
428
|
end
|
|
412
429
|
|
|
413
430
|
output_from_command( xCmd )
|
|
@@ -514,9 +531,11 @@ class GraphViz
|
|
|
514
531
|
when "use"
|
|
515
532
|
@@prog = v
|
|
516
533
|
when "path"
|
|
517
|
-
@@path = v
|
|
534
|
+
@@path = v.split( "," ).map{ |x| x.strip }
|
|
518
535
|
when "errors"
|
|
519
536
|
@@errors = v
|
|
537
|
+
when "extlibs"
|
|
538
|
+
@@extlibs = v.split( "," ).map{ |x| x.strip }
|
|
520
539
|
when "output"
|
|
521
540
|
warn ":output option is deprecated!"
|
|
522
541
|
@@format = v
|
|
@@ -585,6 +604,7 @@ class GraphViz
|
|
|
585
604
|
@prog = @@prog
|
|
586
605
|
@path = @@path
|
|
587
606
|
@errors = @@errors
|
|
607
|
+
@extlibs = @@extlibs
|
|
588
608
|
@output = {}
|
|
589
609
|
|
|
590
610
|
@elements_order = Array::new()
|
|
@@ -625,9 +645,11 @@ class GraphViz
|
|
|
625
645
|
end
|
|
626
646
|
@oGraphType = xValue.to_s
|
|
627
647
|
when "path"
|
|
628
|
-
@path = xValue.
|
|
648
|
+
@path = xValue.split( "," ).map{ |x| x.strip }
|
|
629
649
|
when "errors"
|
|
630
650
|
@errors = xValue
|
|
651
|
+
when "extlibs"
|
|
652
|
+
@extlibs = xValue.split( "," ).map{ |x| x.strip }
|
|
631
653
|
else
|
|
632
654
|
self[xKey.to_s] = xValue.to_s
|
|
633
655
|
end
|
|
@@ -640,9 +662,11 @@ class GraphViz
|
|
|
640
662
|
#
|
|
641
663
|
# Escape a string to be acceptable as a node name in a graphviz input file
|
|
642
664
|
#
|
|
643
|
-
def self.escape(str, force = false) #:nodoc:
|
|
665
|
+
def self.escape(str, force = false ) #:nodoc:
|
|
644
666
|
if force or str.match( /\A[a-zA-Z_]+[a-zA-Z0-9_:]*\Z/ ).nil?
|
|
645
667
|
'"' + str.gsub('"', '\\"').gsub("\n", '\\\\n').gsub(".","\\.") + '"'
|
|
668
|
+
#if force or str.match( /\A[a-zA-Z_]+[a-zA-Z0-9_:\.]*\Z/ ).nil?
|
|
669
|
+
# '"' + str.gsub('"', '\\"').gsub("\n", '\\\\n') + '"'
|
|
646
670
|
else
|
|
647
671
|
str
|
|
648
672
|
end
|
|
@@ -663,10 +687,11 @@ class GraphViz
|
|
|
663
687
|
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
|
|
664
688
|
# OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
|
|
665
689
|
# CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
666
|
-
def find_executable(bin
|
|
667
|
-
paths = ENV['PATH'].split(File::PATH_SEPARATOR) if paths.empty?
|
|
668
|
-
|
|
669
|
-
|
|
690
|
+
def find_executable(bin, paths) #:nodoc:
|
|
691
|
+
paths = ENV['PATH'].split(File::PATH_SEPARATOR) if paths.nil? or paths.empty?
|
|
692
|
+
|
|
693
|
+
paths.each do |path|
|
|
694
|
+
file = (path.nil?)?bin:File.join(path,bin)
|
|
670
695
|
if File.executable?(file) then
|
|
671
696
|
return file
|
|
672
697
|
elsif RUBY_PLATFORM =~ /mswin|mingw/
|
data/lib/graphviz/attrs.rb
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Copyright (C) 2004, 2005, 2006, 2007, 2008 Gregoire Lejeune <gregoire.lejeune@free.fr>
|
|
1
|
+
# Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Gregoire Lejeune <gregoire.lejeune@free.fr>
|
|
2
2
|
#
|
|
3
3
|
# This program is free software; you can redistribute it and/or modify
|
|
4
4
|
# it under the terms of the GNU General Public License as published by
|
|
@@ -38,13 +38,14 @@ class GraphViz
|
|
|
38
38
|
end
|
|
39
39
|
|
|
40
40
|
def []=( xKey, xValue )
|
|
41
|
-
|
|
41
|
+
unless @attributs.keys.include?( xKey.to_s )
|
|
42
42
|
raise ArgumentError, "#{@name} attribut '#{xKey.to_s}' invalid"
|
|
43
43
|
end
|
|
44
|
-
|
|
44
|
+
|
|
45
|
+
@data[xKey.to_s] = GraphViz::Types.const_get(@attributs[xKey.to_s]).new( xValue )
|
|
45
46
|
|
|
46
47
|
if @graphviz.nil? == false
|
|
47
|
-
@graphviz.set_position( @name, xKey.to_s,
|
|
48
|
+
@graphviz.set_position( @name, xKey.to_s, @data[xKey.to_s] )
|
|
48
49
|
end
|
|
49
50
|
end
|
|
50
51
|
end
|
data/lib/graphviz/constants.rb
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Copyright (C) 2004, 2005, 2006, 2007, 2008 Gregoire Lejeune <gregoire.lejeune@free.fr>
|
|
1
|
+
# Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Gregoire Lejeune <gregoire.lejeune@free.fr>
|
|
2
2
|
#
|
|
3
3
|
# This program is free software; you can redistribute it and/or modify
|
|
4
4
|
# it under the terms of the GNU General Public License as published by
|
|
@@ -14,8 +14,33 @@
|
|
|
14
14
|
# along with this program; if not, write to the Free Software
|
|
15
15
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
16
16
|
|
|
17
|
+
# Constants for ruby-graphviz
|
|
18
|
+
#
|
|
19
|
+
# Constants::FORMATS: the possible output formats
|
|
20
|
+
# "bmp", "canon", "dot", "xdot", "cmap", "dia", "eps",
|
|
21
|
+
# "fig", "gd", "gd2", "gif", "gtk", "hpgl", "ico", "imap",
|
|
22
|
+
# "cmapx", "imap_np", "cmapx_np", "ismap", "jpeg", "jpg",
|
|
23
|
+
# "jpe", "mif", "mp", "pcl", "pdf", "pic", "plain",
|
|
24
|
+
# "plain-ext", "png", "ps", "ps2", "svg", "svgz", "tga",
|
|
25
|
+
# "tiff", "tif", "vml", "vmlz", "vrml", "vtx", "wbmp",
|
|
26
|
+
# "xlib", "none"
|
|
27
|
+
#
|
|
28
|
+
# Constants::PROGRAMS: The possible programs
|
|
29
|
+
# "dot", "neato", "twopi", "fdp", "circo"
|
|
30
|
+
#
|
|
31
|
+
# Constants::GRAPHTYPE The possible types of graph
|
|
32
|
+
# "digraph", "graph"
|
|
33
|
+
#
|
|
34
|
+
#
|
|
35
|
+
# The single letter codes used in constructors map as follows:
|
|
36
|
+
# G => The root graph, with GRAPHATTRS
|
|
37
|
+
# E => Edge, with EDGESATTRS
|
|
38
|
+
# N => Node, with NODESATTRS
|
|
39
|
+
# S => subgraph
|
|
40
|
+
# C => cluster
|
|
41
|
+
#
|
|
17
42
|
module Constants
|
|
18
|
-
RGV_VERSION = "0.9.
|
|
43
|
+
RGV_VERSION = "0.9.8"
|
|
19
44
|
|
|
20
45
|
## Const: Output formats
|
|
21
46
|
FORMATS = [
|
|
@@ -81,166 +106,174 @@ module Constants
|
|
|
81
106
|
]
|
|
82
107
|
|
|
83
108
|
def self.getAttrsFor( x )
|
|
84
|
-
|
|
109
|
+
list = {}
|
|
85
110
|
GENCS_ATTRS.each { |k,v|
|
|
86
|
-
|
|
111
|
+
list[k] = v[:type] if x.match( v[:usedBy] ) and not list.keys.include?(k)
|
|
87
112
|
}
|
|
88
|
-
|
|
113
|
+
list
|
|
89
114
|
end
|
|
90
115
|
|
|
91
116
|
# E, N, G, S and C represent edges, nodes, the root graph, subgraphs and cluster subgraphs, respectively
|
|
92
117
|
GENCS_ATTRS = {
|
|
93
|
-
"Damping" => "G",
|
|
94
|
-
"K" => "GC",
|
|
95
|
-
"URL" => "ENGC",
|
|
96
|
-
"arrowhead" => "E",
|
|
97
|
-
"arrowsize" => "E",
|
|
98
|
-
"arrowtail" => "E",
|
|
99
|
-
"
|
|
100
|
-
"
|
|
101
|
-
|
|
102
|
-
"center" => "G",
|
|
103
|
-
"charset" => "G",
|
|
104
|
-
"clusterrank" => "G",
|
|
105
|
-
"color" => "ENC",
|
|
106
|
-
"colorscheme" => "ENCG",
|
|
107
|
-
"comment" => "ENG",
|
|
108
|
-
"compound" => "G",
|
|
109
|
-
"concentrate" => "G",
|
|
110
|
-
"constraint" => "E",
|
|
111
|
-
"decorate" => "E",
|
|
112
|
-
"defaultdist" => "G",
|
|
113
|
-
"dim" => "G",
|
|
114
|
-
"
|
|
115
|
-
"
|
|
116
|
-
"
|
|
117
|
-
"
|
|
118
|
-
"
|
|
119
|
-
"
|
|
120
|
-
"
|
|
121
|
-
"
|
|
122
|
-
"
|
|
123
|
-
"
|
|
124
|
-
"
|
|
125
|
-
"
|
|
126
|
-
"
|
|
127
|
-
"
|
|
128
|
-
"
|
|
129
|
-
"
|
|
130
|
-
"
|
|
131
|
-
"
|
|
132
|
-
"
|
|
133
|
-
"
|
|
134
|
-
"
|
|
135
|
-
"
|
|
136
|
-
"
|
|
137
|
-
"
|
|
138
|
-
"
|
|
139
|
-
"
|
|
140
|
-
"
|
|
141
|
-
"
|
|
142
|
-
"
|
|
143
|
-
"
|
|
144
|
-
"
|
|
145
|
-
"
|
|
146
|
-
"
|
|
147
|
-
"
|
|
148
|
-
"
|
|
149
|
-
"
|
|
150
|
-
"
|
|
151
|
-
"
|
|
152
|
-
"
|
|
153
|
-
"
|
|
154
|
-
"
|
|
155
|
-
"
|
|
156
|
-
"
|
|
157
|
-
"
|
|
158
|
-
"
|
|
159
|
-
"
|
|
160
|
-
"
|
|
161
|
-
"
|
|
162
|
-
"
|
|
163
|
-
"
|
|
164
|
-
"
|
|
165
|
-
"
|
|
166
|
-
"
|
|
167
|
-
"
|
|
168
|
-
"
|
|
169
|
-
"
|
|
170
|
-
"
|
|
171
|
-
"
|
|
172
|
-
"
|
|
173
|
-
"
|
|
174
|
-
"
|
|
175
|
-
"
|
|
176
|
-
"
|
|
177
|
-
"
|
|
178
|
-
"
|
|
179
|
-
"
|
|
180
|
-
"
|
|
181
|
-
"
|
|
182
|
-
"
|
|
183
|
-
"
|
|
184
|
-
"
|
|
185
|
-
"
|
|
186
|
-
"
|
|
187
|
-
"
|
|
188
|
-
"
|
|
189
|
-
"
|
|
190
|
-
"
|
|
191
|
-
"
|
|
192
|
-
"
|
|
193
|
-
"
|
|
194
|
-
"
|
|
195
|
-
"
|
|
196
|
-
"
|
|
197
|
-
"
|
|
198
|
-
"
|
|
199
|
-
"
|
|
200
|
-
"
|
|
201
|
-
"
|
|
202
|
-
"
|
|
203
|
-
"
|
|
204
|
-
"
|
|
205
|
-
"
|
|
206
|
-
"
|
|
207
|
-
"
|
|
208
|
-
"
|
|
209
|
-
"
|
|
210
|
-
"
|
|
211
|
-
"
|
|
212
|
-
"
|
|
213
|
-
"
|
|
214
|
-
"
|
|
215
|
-
"
|
|
216
|
-
"
|
|
217
|
-
"
|
|
218
|
-
"
|
|
219
|
-
"
|
|
220
|
-
"
|
|
221
|
-
"
|
|
222
|
-
"
|
|
223
|
-
"
|
|
224
|
-
"
|
|
225
|
-
"
|
|
226
|
-
"
|
|
227
|
-
"
|
|
228
|
-
|
|
229
|
-
"
|
|
230
|
-
"
|
|
231
|
-
"
|
|
232
|
-
"
|
|
233
|
-
"
|
|
234
|
-
"
|
|
235
|
-
"
|
|
118
|
+
"Damping" => { :usedBy => "G", :type => :EscString },
|
|
119
|
+
"K" => { :usedBy => "GC", :type => :EscString },
|
|
120
|
+
"URL" => { :usedBy => "ENGC", :type => :EscString },
|
|
121
|
+
"arrowhead" => { :usedBy => "E", :type => :EscString },
|
|
122
|
+
"arrowsize" => { :usedBy => "E", :type => :EscString },
|
|
123
|
+
"arrowtail" => { :usedBy => "E", :type => :EscString },
|
|
124
|
+
"aspect" => { :usedBy => "G", :type => :EscString },
|
|
125
|
+
"bb" => { :usedBy => "G", :type => :EscString },
|
|
126
|
+
"bgcolor" => { :usedBy => "GC", :type => :EscString },
|
|
127
|
+
"center" => { :usedBy => "G", :type => :EscString },
|
|
128
|
+
"charset" => { :usedBy => "G", :type => :EscString },
|
|
129
|
+
"clusterrank" => { :usedBy => "G", :type => :EscString },
|
|
130
|
+
"color" => { :usedBy => "ENC", :type => :EscString },
|
|
131
|
+
"colorscheme" => { :usedBy => "ENCG", :type => :EscString },
|
|
132
|
+
"comment" => { :usedBy => "ENG", :type => :EscString },
|
|
133
|
+
"compound" => { :usedBy => "G", :type => :EscString },
|
|
134
|
+
"concentrate" => { :usedBy => "G", :type => :EscString },
|
|
135
|
+
"constraint" => { :usedBy => "E", :type => :EscString },
|
|
136
|
+
"decorate" => { :usedBy => "E", :type => :EscString },
|
|
137
|
+
"defaultdist" => { :usedBy => "G", :type => :EscString },
|
|
138
|
+
"dim" => { :usedBy => "G", :type => :EscString },
|
|
139
|
+
"dimen" => { :usedBy => "G", :type => :EscString },
|
|
140
|
+
"dir" => { :usedBy => "E", :type => :EscString },
|
|
141
|
+
"diredgeconstraints" => { :usedBy => "G", :type => :EscString },
|
|
142
|
+
"distortion" => { :usedBy => "N", :type => :EscString },
|
|
143
|
+
"dpi" => { :usedBy => "G", :type => :EscString },
|
|
144
|
+
"edgeURL" => { :usedBy => "E", :type => :EscString },
|
|
145
|
+
"edgehref" => { :usedBy => "E", :type => :EscString },
|
|
146
|
+
"edgetarget" => { :usedBy => "E", :type => :EscString },
|
|
147
|
+
"edgetooltip" => { :usedBy => "E", :type => :EscString },
|
|
148
|
+
"epsilon" => { :usedBy => "G", :type => :EscString },
|
|
149
|
+
"esep" => { :usedBy => "G", :type => :EscString },
|
|
150
|
+
"fillcolor" => { :usedBy => "NC", :type => :EscString },
|
|
151
|
+
"fixedsize" => { :usedBy => "N", :type => :EscString },
|
|
152
|
+
"fontcolor" => { :usedBy => "ENGC", :type => :EscString },
|
|
153
|
+
"fontname" => { :usedBy => "ENGC", :type => :EscString },
|
|
154
|
+
"fontnames" => { :usedBy => "G", :type => :EscString },
|
|
155
|
+
"fontpath" => { :usedBy => "G", :type => :EscString },
|
|
156
|
+
"fontsize" => { :usedBy => "ENGC", :type => :EscString },
|
|
157
|
+
"group" => { :usedBy => "N", :type => :EscString },
|
|
158
|
+
"headURL" => { :usedBy => "E", :type => :EscString },
|
|
159
|
+
"headclip" => { :usedBy => "E", :type => :EscString },
|
|
160
|
+
"headhref" => { :usedBy => "E", :type => :EscString },
|
|
161
|
+
"headlabel" => { :usedBy => "E", :type => :EscString },
|
|
162
|
+
"headport" => { :usedBy => "E", :type => :EscString },
|
|
163
|
+
"headtarget" => { :usedBy => "E", :type => :EscString },
|
|
164
|
+
"headtooltip" => { :usedBy => "E", :type => :EscString },
|
|
165
|
+
"height" => { :usedBy => "N", :type => :EscString },
|
|
166
|
+
"href" => { :usedBy => "NE", :type => :EscString },
|
|
167
|
+
"html" => { :usedBy => "N", :type => :HtmlString }, # API extension
|
|
168
|
+
"id" => { :usedBy => "ENG", :type => :EscString },
|
|
169
|
+
"image" => { :usedBy => "N", :type => :EscString },
|
|
170
|
+
"imagescale" => { :usedBy => "N", :type => :EscString },
|
|
171
|
+
"label" => { :usedBy => "ENGC", :type => :EscString },
|
|
172
|
+
"labelURL" => { :usedBy => "E", :type => :EscString },
|
|
173
|
+
"labelangle" => { :usedBy => "E", :type => :EscString },
|
|
174
|
+
"labeldistance" => { :usedBy => "E", :type => :EscString },
|
|
175
|
+
"labelfloat" => { :usedBy => "E", :type => :EscString },
|
|
176
|
+
"labelfontcolor" => { :usedBy => "E", :type => :EscString },
|
|
177
|
+
"labelfontname" => { :usedBy => "E", :type => :EscString },
|
|
178
|
+
"labelfontsize" => { :usedBy => "E", :type => :EscString },
|
|
179
|
+
"labelhref" => { :usedBy => "E", :type => :EscString },
|
|
180
|
+
"labeljust" => { :usedBy => "GC", :type => :EscString },
|
|
181
|
+
"labelloc" => { :usedBy => "GCN", :type => :EscString },
|
|
182
|
+
"labeltarget" => { :usedBy => "E", :type => :EscString },
|
|
183
|
+
"labeltooltip" => { :usedBy => "E", :type => :EscString },
|
|
184
|
+
"landscape" => { :usedBy => "G", :type => :EscString },
|
|
185
|
+
"layer" => { :usedBy => "EN", :type => :EscString },
|
|
186
|
+
"layers" => { :usedBy => "G", :type => :EscString },
|
|
187
|
+
"layersep" => { :usedBy => "G", :type => :EscString },
|
|
188
|
+
"layout" => { :usedBy => "G", :type => :EscString },
|
|
189
|
+
"len" => { :usedBy => "E", :type => :EscString },
|
|
190
|
+
"levels" => { :usedBy => "G", :type => :EscString },
|
|
191
|
+
"levelsgap" => { :usedBy => "G", :type => :EscString },
|
|
192
|
+
"lhead" => { :usedBy => "E", :type => :EscString },
|
|
193
|
+
"lp" => { :usedBy => "EGC", :type => :EscString },
|
|
194
|
+
"ltail" => { :usedBy => "E", :type => :EscString },
|
|
195
|
+
"margin" => { :usedBy => "NG", :type => :EscString },
|
|
196
|
+
"maxiter" => { :usedBy => "G", :type => :EscString },
|
|
197
|
+
"mclimit" => { :usedBy => "G", :type => :EscString },
|
|
198
|
+
"mindist" => { :usedBy => "G", :type => :EscString },
|
|
199
|
+
"minlen" => { :usedBy => "E", :type => :EscString },
|
|
200
|
+
"mode" => { :usedBy => "G", :type => :EscString },
|
|
201
|
+
"model" => { :usedBy => "G", :type => :EscString },
|
|
202
|
+
"mosek" => { :usedBy => "G", :type => :EscString },
|
|
203
|
+
"nodesep" => { :usedBy => "G", :type => :EscString },
|
|
204
|
+
"nojustify" => { :usedBy => "GCNE", :type => :EscString },
|
|
205
|
+
"normalize" => { :usedBy => "G", :type => :EscString },
|
|
206
|
+
"nslimit" => { :usedBy => "G", :type => :EscString },
|
|
207
|
+
"nslimit1" => { :usedBy => "G", :type => :EscString },
|
|
208
|
+
"ordering" => { :usedBy => "G", :type => :EscString },
|
|
209
|
+
"orientation" => { :usedBy => "NG", :type => :EscString },
|
|
210
|
+
"outputorder" => { :usedBy => "G", :type => :EscString },
|
|
211
|
+
"overlap" => { :usedBy => "G", :type => :EscString },
|
|
212
|
+
"overlap_scaling" => { :usedBy => "G", :type => :EscString },
|
|
213
|
+
"pack" => { :usedBy => "G", :type => :EscString },
|
|
214
|
+
"packmode" => { :usedBy => "G", :type => :EscString },
|
|
215
|
+
"pad" => { :usedBy => "G", :type => :EscString },
|
|
216
|
+
"page" => { :usedBy => "G", :type => :EscString },
|
|
217
|
+
"pagedir" => { :usedBy => "G", :type => :EscString },
|
|
218
|
+
"pencolor" => { :usedBy => "C", :type => :EscString },
|
|
219
|
+
"penwidth" => { :usedBy => "CNE", :type => :EscString },
|
|
220
|
+
"peripheries" => { :usedBy => "NC", :type => :EscString },
|
|
221
|
+
"pin" => { :usedBy => "N", :type => :EscString },
|
|
222
|
+
"pos" => { :usedBy => "EN", :type => :EscString },
|
|
223
|
+
"quadtree" => { :usedBy => "G", :type => :EscString },
|
|
224
|
+
"quantum" => { :usedBy => "G", :type => :EscString },
|
|
225
|
+
"rank" => { :usedBy => "S", :type => :EscString },
|
|
226
|
+
"rankdir" => { :usedBy => "G", :type => :EscString },
|
|
227
|
+
"ranksep" => { :usedBy => "G", :type => :EscString },
|
|
228
|
+
"ratio" => { :usedBy => "G", :type => :EscString },
|
|
229
|
+
"rects" => { :usedBy => "N", :type => :EscString },
|
|
230
|
+
"regular" => { :usedBy => "N", :type => :EscString },
|
|
231
|
+
"remincross" => { :usedBy => "G", :type => :EscString },
|
|
232
|
+
"repulsiveforce" => { :usedBy => "G", :type => :EscString },
|
|
233
|
+
"resolution" => { :usedBy => "G", :type => :EscString },
|
|
234
|
+
"root" => { :usedBy => "GN", :type => :EscString },
|
|
235
|
+
"rotate" => { :usedBy => "G", :type => :EscString },
|
|
236
|
+
"samehead" => { :usedBy => "E", :type => :EscString },
|
|
237
|
+
"sametail" => { :usedBy => "E", :type => :EscString },
|
|
238
|
+
"samplepoints" => { :usedBy => "G", :type => :EscString },
|
|
239
|
+
"searchsize" => { :usedBy => "G", :type => :EscString },
|
|
240
|
+
"sep" => { :usedBy => "G", :type => :EscString },
|
|
241
|
+
"shape" => { :usedBy => "N", :type => :EscString },
|
|
242
|
+
"shapefile" => { :usedBy => "N", :type => :EscString },
|
|
243
|
+
"showboxes" => { :usedBy => "ENG", :type => :EscString },
|
|
244
|
+
"sides" => { :usedBy => "N", :type => :EscString },
|
|
245
|
+
"size" => { :usedBy => "G", :type => :EscString },
|
|
246
|
+
"skew" => { :usedBy => "N", :type => :EscString },
|
|
247
|
+
"smoothing" => { :usedBy => "G", :type => :EscString },
|
|
248
|
+
"sortv" => { :usedBy => "GCN", :type => :EscString },
|
|
249
|
+
"splines" => { :usedBy => "G", :type => :EscString },
|
|
250
|
+
"start" => { :usedBy => "G", :type => :EscString },
|
|
251
|
+
"style" => { :usedBy => "ENC", :type => :EscString },
|
|
252
|
+
"stylesheet" => { :usedBy => "G", :type => :EscString },
|
|
253
|
+
"tailURL" => { :usedBy => "E", :type => :EscString },
|
|
254
|
+
"tailclip" => { :usedBy => "E", :type => :EscString },
|
|
255
|
+
"tailhref" => { :usedBy => "E", :type => :EscString },
|
|
256
|
+
"taillabel" => { :usedBy => "E", :type => :EscString },
|
|
257
|
+
"tailport" => { :usedBy => "E", :type => :EscString },
|
|
258
|
+
"tailtarget" => { :usedBy => "E", :type => :EscString },
|
|
259
|
+
"tailtooltip" => { :usedBy => "E", :type => :EscString },
|
|
260
|
+
"target" => { :usedBy => "ENGC", :type => :EscString },
|
|
261
|
+
"tooltip" => { :usedBy => "NEC", :type => :EscString },
|
|
262
|
+
"truecolor" => { :usedBy => "G", :type => :EscString },
|
|
263
|
+
"vertices" => { :usedBy => "N", :type => :EscString },
|
|
264
|
+
"viewport" => { :usedBy => "G", :type => :EscString },
|
|
265
|
+
"voro_margin" => { :usedBy => "G", :type => :EscString },
|
|
266
|
+
"weight" => { :usedBy => "E", :type => :EscString },
|
|
267
|
+
"width" => { :usedBy => "N", :type => :EscString },
|
|
268
|
+
"z" => { :usedBy => "N", :type => :EscString }
|
|
236
269
|
}
|
|
237
270
|
|
|
238
271
|
## Const: Graph attributs
|
|
239
|
-
GRAPHSATTRS = Constants::getAttrsFor(
|
|
272
|
+
GRAPHSATTRS = Constants::getAttrsFor( /G|S|C/ )
|
|
240
273
|
|
|
241
274
|
## Const: Node attributs
|
|
242
|
-
NODESATTRS = Constants::getAttrsFor(
|
|
275
|
+
NODESATTRS = Constants::getAttrsFor( /N/ )
|
|
243
276
|
|
|
244
277
|
## Const: Edge attributs
|
|
245
|
-
EDGESATTRS = Constants::getAttrsFor(
|
|
278
|
+
EDGESATTRS = Constants::getAttrsFor( /E/ )
|
|
246
279
|
end
|