@ohos-ports/graphviz 0.0.9-beta.0

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.
package/CHANGELOG.md ADDED
@@ -0,0 +1,65 @@
1
+ # Change Log
2
+
3
+ ## [0.0.9](https://github.com/glejeune/node-graphviz/tree/0.0.9) (2019-04-03)
4
+ [Full Changelog](https://github.com/glejeune/node-graphviz/compare/0.0.8...0.0.9)
5
+
6
+ **Closed issues:**
7
+
8
+ - Is it possible to create a stripped down version for browsers that only generates dot code? [\#15](https://github.com/glejeune/node-graphviz/issues/15)
9
+ - Is there a way to tell this library to ignore duplicate edges? [\#13](https://github.com/glejeune/node-graphviz/issues/13)
10
+ - How to get x,y coords for a node? [\#11](https://github.com/glejeune/node-graphviz/issues/11)
11
+
12
+ **Merged pull requests:**
13
+
14
+ - Fix missing error handling [\#26](https://github.com/glejeune/node-graphviz/pull/26) ([BridgeAR](https://github.com/BridgeAR))
15
+ - Fixing `for in` loops [\#17](https://github.com/glejeune/node-graphviz/pull/17) ([dariusk](https://github.com/dariusk))
16
+ - Node setter is now fluent. [\#16](https://github.com/glejeune/node-graphviz/pull/16) ([SebastienElet](https://github.com/SebastienElet))
17
+
18
+ ## [0.0.8](https://github.com/glejeune/node-graphviz/tree/0.0.8) (2012-08-04)
19
+ [Full Changelog](https://github.com/glejeune/node-graphviz/compare/0.0.7...0.0.8)
20
+
21
+ **Closed issues:**
22
+
23
+ - Clickable Nodes [\#10](https://github.com/glejeune/node-graphviz/issues/10)
24
+
25
+ **Merged pull requests:**
26
+
27
+ - `npm install node-graphviz` --\> `npm install graphviz` [\#9](https://github.com/glejeune/node-graphviz/pull/9) ([pooriaazimi](https://github.com/pooriaazimi))
28
+
29
+ ## [0.0.7](https://github.com/glejeune/node-graphviz/tree/0.0.7) (2012-07-01)
30
+ [Full Changelog](https://github.com/glejeune/node-graphviz/compare/0.0.6...0.0.7)
31
+
32
+ **Closed issues:**
33
+
34
+ - Publish 0.0.6 with correct dependency on 'temp' to the npm repo? [\#5](https://github.com/glejeune/node-graphviz/issues/5)
35
+
36
+ **Merged pull requests:**
37
+
38
+ - Fixed so it can be installed on v0.8. Please bump version & update the NPM repo :\) [\#7](https://github.com/glejeune/node-graphviz/pull/7) ([pahen](https://github.com/pahen))
39
+ - Hi! I fixed some calls to "sys" for you! [\#6](https://github.com/glejeune/node-graphviz/pull/6) ([node-migrator-bot](https://github.com/node-migrator-bot))
40
+
41
+ ## [0.0.6](https://github.com/glejeune/node-graphviz/tree/0.0.6) (2012-01-27)
42
+ [Full Changelog](https://github.com/glejeune/node-graphviz/compare/0.0.5...0.0.6)
43
+
44
+ **Closed issues:**
45
+
46
+ - Error: EPIPE, Broken pipe [\#3](https://github.com/glejeune/node-graphviz/issues/3)
47
+ - Graph.prototype.getNodeAttribut [\#2](https://github.com/glejeune/node-graphviz/issues/2)
48
+
49
+ ## [0.0.5](https://github.com/glejeune/node-graphviz/tree/0.0.5) (2011-12-14)
50
+ [Full Changelog](https://github.com/glejeune/node-graphviz/compare/0.0.4...0.0.5)
51
+
52
+ **Merged pull requests:**
53
+
54
+ - graphviz.js: Don't require the 'sys' module. [\#4](https://github.com/glejeune/node-graphviz/pull/4) ([papandreou](https://github.com/papandreou))
55
+
56
+ ## [0.0.4](https://github.com/glejeune/node-graphviz/tree/0.0.4) (2010-11-16)
57
+ [Full Changelog](https://github.com/glejeune/node-graphviz/compare/0.0.3...0.0.4)
58
+
59
+ ## [0.0.3](https://github.com/glejeune/node-graphviz/tree/0.0.3) (2010-10-04)
60
+ [Full Changelog](https://github.com/glejeune/node-graphviz/compare/0.0.2...0.0.3)
61
+
62
+ ## [0.0.2](https://github.com/glejeune/node-graphviz/tree/0.0.2) (2010-09-29)
63
+
64
+
65
+ \* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*
package/LICENCE.txt ADDED
@@ -0,0 +1,19 @@
1
+ Copyright (c) 2010 Gregoire Lejeune <gregoire.lejeune@free.fr>
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to deal
5
+ in the Software without restriction, including without limitation the rights
6
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in
11
+ all copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ THE SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,98 @@
1
+ # Node.js GraphViz Module
2
+
3
+ [![All Contributors](https://img.shields.io/badge/all_contributors-9-orange.svg?style=flat-square)](#contributors)
4
+
5
+ Copyright (C) 2010-2019 Gregoire Lejeune
6
+
7
+ * Sources : http://github.com/glejeune/node-graphviz
8
+
9
+ ## DESCRIPTION
10
+
11
+ Interface to the GraphViz graphing tool
12
+
13
+ ## SYNOPSIS
14
+
15
+ A basic example
16
+
17
+ ```
18
+ var util = require('util'),
19
+ graphviz = require('graphviz');
20
+
21
+ // Create digraph G
22
+ var g = graphviz.digraph("G");
23
+
24
+ // Add node (ID: Hello)
25
+ var n1 = g.addNode( "Hello", {"color" : "blue"} );
26
+ n1.set( "style", "filled" );
27
+
28
+ // Add node (ID: World)
29
+ g.addNode( "World" );
30
+
31
+ // Add edge between the two nodes
32
+ var e = g.addEdge( n1, "World" );
33
+ e.set( "color", "red" );
34
+
35
+ // Print the dot script
36
+ console.log( g.to_dot() );
37
+
38
+ // Set GraphViz path (if not in your path)
39
+ g.setGraphVizPath( "/usr/local/bin" );
40
+ // Generate a PNG output
41
+ g.output( "png", "test01.png" );
42
+ ```
43
+
44
+ ## INSTALLATION
45
+
46
+ ```
47
+ $ npm install graphviz
48
+ ```
49
+
50
+ You also need to install GraphViz[http://www.graphviz.org]
51
+
52
+ ## DOCUMENTATION
53
+
54
+ Install node-jake[http://github.com/mde/node-jake] and dox[http://github.com/visionmedia/dox] then run
55
+
56
+ ```
57
+ jake doc && open documentation.html
58
+ ```
59
+
60
+ ## AUTHORS
61
+
62
+ * Gregoire Lejeune (http://algorithmique.net)
63
+ * Mathieu Ravaux (http://mathieuravaux.com)
64
+
65
+ ## LICENCES
66
+
67
+ Copyright (c) 2010 Gregoire Lejeune <gregoire.lejeune@free.fr>
68
+
69
+ Permission is hereby granted, free of charge, to any person obtaining a copy
70
+ of this software and associated documentation files (the "Software"), to deal
71
+ in the Software without restriction, including without limitation the rights
72
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
73
+ copies of the Software, and to permit persons to whom the Software is
74
+ furnished to do so, subject to the following conditions:
75
+
76
+ The above copyright notice and this permission notice shall be included in
77
+ all copies or substantial portions of the Software.
78
+
79
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
80
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
81
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
82
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
83
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
84
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
85
+ THE SOFTWARE.
86
+
87
+
88
+ ## Contributors
89
+
90
+ Thanks goes to these wonderful people ([emoji key](https://github.com/kentcdodds/all-contributors#emoji-key)):
91
+
92
+ <!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
93
+ <!-- prettier-ignore -->
94
+ <table><tr><td align="center"><a href="http://lejeun.es"><img src="https://avatars1.githubusercontent.com/u/15168?v=4" width="100px;" alt="Gregoire Lejeune"/><br /><sub><b>Gregoire Lejeune</b></sub></a><br /><a href="https://github.com/glejeune/node-graphviz/commits?author=glejeune" title="Code">💻</a> <a href="https://github.com/glejeune/node-graphviz/commits?author=glejeune" title="Documentation">📖</a> <a href="#example-glejeune" title="Examples">💡</a></td><td align="center"><a href="https://tinysubversions.com"><img src="https://avatars3.githubusercontent.com/u/266454?v=4" width="100px;" alt="Darius Kazemi"/><br /><sub><b>Darius Kazemi</b></sub></a><br /><a href="https://github.com/glejeune/node-graphviz/commits?author=dariusk" title="Code">💻</a></td><td align="center"><a href="https://github.com/SebastienElet"><img src="https://avatars0.githubusercontent.com/u/541937?v=4" width="100px;" alt="Sébastien ELET"/><br /><sub><b>Sébastien ELET</b></sub></a><br /><a href="https://github.com/glejeune/node-graphviz/commits?author=SebastienElet" title="Code">💻</a></td><td align="center"><a href="https://github.com/papandreou"><img src="https://avatars3.githubusercontent.com/u/373545?v=4" width="100px;" alt="Andreas Lind"/><br /><sub><b>Andreas Lind</b></sub></a><br /><a href="https://github.com/glejeune/node-graphviz/commits?author=papandreou" title="Code">💻</a></td><td align="center"><a href="http://www.blakmatrix.com"><img src="https://avatars3.githubusercontent.com/u/91209?v=4" width="100px;" alt="Farrin Reid"/><br /><sub><b>Farrin Reid</b></sub></a><br /><a href="https://github.com/glejeune/node-graphviz/commits?author=blakmatrix" title="Code">💻</a></td><td align="center"><a href="https://pahen.se"><img src="https://avatars3.githubusercontent.com/u/353888?v=4" width="100px;" alt="Patrik Henningsson"/><br /><sub><b>Patrik Henningsson</b></sub></a><br /><a href="https://github.com/glejeune/node-graphviz/commits?author=pahen" title="Code">💻</a></td><td align="center"><a href="https://github.com/pooriaazimi"><img src="https://avatars2.githubusercontent.com/u/814637?v=4" width="100px;" alt="Pooria Azimi"/><br /><sub><b>Pooria Azimi</b></sub></a><br /><a href="https://github.com/glejeune/node-graphviz/commits?author=pooriaazimi" title="Code">💻</a></td></tr><tr><td align="center"><a href="https://twitter.com/BridgeAR"><img src="https://avatars2.githubusercontent.com/u/8822573?v=4" width="100px;" alt="Ruben Bridgewater"/><br /><sub><b>Ruben Bridgewater</b></sub></a><br /><a href="https://github.com/glejeune/node-graphviz/commits?author=BridgeAR" title="Code">💻</a></td><td align="center"><a href="https://github.com/mathieuravaux"><img src="https://avatars1.githubusercontent.com/u/38495?v=4" width="100px;" alt="Mathieu Ravaux"/><br /><sub><b>Mathieu Ravaux</b></sub></a><br /><a href="https://github.com/glejeune/node-graphviz/commits?author=mathieuravaux" title="Code">💻</a></td></tr></table>
95
+
96
+ <!-- ALL-CONTRIBUTORS-LIST:END -->
97
+
98
+ This project follows the [all-contributors](https://github.com/kentcdodds/all-contributors) specification. Contributions of any kind welcome!
Binary file
Binary file
@@ -0,0 +1,254 @@
1
+ var Hash = require('./core_ext/hash').Hash,
2
+ util = require('util');
3
+
4
+ var attrs = {
5
+ "Damping" : { "usage" : "G", "type" : "double" },
6
+ "K" : { "usage" : "GC", "type" : "double" },
7
+ "URL" : { "usage" : "ENGC", "type" : "escString" },
8
+ "area" : { "usage" : "NC", "type" : "double" },
9
+ "arrowhead" : { "usage" : "E", "type" : "arrowType" },
10
+ "arrowsize" : { "usage" : "E", "type" : "double" },
11
+ "arrowtail" : { "usage" : "E", "type" : "arrowType" },
12
+ "aspect" : { "usage" : "G", "type" : "aspectType" },
13
+ "bb" : { "usage" : "G", "type" : "rect" },
14
+ "bgcolor" : { "usage" : "GC", "type" : "color" },
15
+ "center" : { "usage" : "G", "type" : "bool" },
16
+ "charset" : { "usage" : "G", "type" : "string" },
17
+ "clusterrank" : { "usage" : "G", "type" : "clusterMode" },
18
+ "color" : { "usage" : "ENC", "type" : "color" },
19
+ "colorscheme" : { "usage" : "ENCG", "type" : "string" },
20
+ "comment" : { "usage" : "ENG", "type" : "string" },
21
+ "compound" : { "usage" : "G", "type" : "bool" },
22
+ "concentrate" : { "usage" : "G", "type" : "bool" },
23
+ "constraint" : { "usage" : "E", "type" : "bool" },
24
+ "decorate" : { "usage" : "E", "type" : "bool" },
25
+ "defaultdist" : { "usage" : "G", "type" : "double" },
26
+ "dim" : { "usage" : "G", "type" : "int" },
27
+ "dimen" : { "usage" : "G", "type" : "int" },
28
+ "dir" : { "usage" : "E", "type" : "dirType" },
29
+ "diredgeconstraints" : { "usage" : "G", "type" : "string" },
30
+ "distortion" : { "usage" : "N", "type" : "double" },
31
+ "dpi" : { "usage" : "G", "type" : "double" },
32
+ "edgeURL" : { "usage" : "E", "type" : "escString" },
33
+ "edgehref" : { "usage" : "E", "type" : "escString" },
34
+ "edgetarget" : { "usage" : "E", "type" : "escString" },
35
+ "edgetooltip" : { "usage" : "E", "type" : "escString" },
36
+ "epsilon" : { "usage" : "G", "type" : "double" },
37
+ "esep" : { "usage" : "G", "type" : "double" },
38
+ "fillcolor" : { "usage" : "NEC", "type" : "color" },
39
+ "fixedsize" : { "usage" : "N", "type" : "bool" },
40
+ "fontcolor" : { "usage" : "ENGC", "type" : "color" },
41
+ "fontname" : { "usage" : "ENGC", "type" : "string" },
42
+ "fontnames" : { "usage" : "G", "type" : "string" },
43
+ "fontpath" : { "usage" : "G", "type" : "string" },
44
+ "fontsize" : { "usage" : "ENGC", "type" : "double" },
45
+ "group" : { "usage" : "N", "type" : "string" },
46
+ "headURL" : { "usage" : "E", "type" : "escString" },
47
+ "headclip" : { "usage" : "E", "type" : "bool" },
48
+ "headhref" : { "usage" : "E", "type" : "escString" },
49
+ "headlabel" : { "usage" : "E", "type" : "lblString" },
50
+ "headport" : { "usage" : "E", "type" : "portPos" },
51
+ "headtarget" : { "usage" : "E", "type" : "escString" },
52
+ "headtooltip" : { "usage" : "E", "type" : "escString" },
53
+ "height" : { "usage" : "N", "type" : "double" },
54
+ "href" : { "usage" : "ENGC", "type" : "escString" },
55
+ "id" : { "usage" : "GNE", "type" : "lblString" },
56
+ "image" : { "usage" : "N", "type" : "string" },
57
+ "imagepath" : { "usage" : "G", "type" : "string" },
58
+ "imagescale" : { "usage" : "N", "type" : "string" },
59
+ "label" : { "usage" : "ENGC", "type" : "lblString" },
60
+ "labelURL" : { "usage" : "E", "type" : "escString" },
61
+ "labelangle" : { "usage" : "E", "type" : "double" },
62
+ "labeldistance" : { "usage" : "E", "type" : "double" },
63
+ "labelfloat" : { "usage" : "E", "type" : "bool" },
64
+ "labelfontcolor" : { "usage" : "E", "type" : "color" },
65
+ "labelfontname" : { "usage" : "E", "type" : "string" },
66
+ "labelfontsize" : { "usage" : "E", "type" : "double" },
67
+ "labelhref" : { "usage" : "E", "type" : "escString" },
68
+ "labeljust" : { "usage" : "GC", "type" : "string" },
69
+ "labelloc" : { "usage" : "NGC", "type" : "string" },
70
+ "labeltarget" : { "usage" : "E", "type" : "escString" },
71
+ "labeltooltip" : { "usage" : "E", "type" : "escString" },
72
+ "landscape" : { "usage" : "G", "type" : "bool" },
73
+ "layer" : { "usage" : "ENC", "type" : "layerRange" },
74
+ "layerlistsep" : { "usage" : "G", "type" : "string" },
75
+ "layers" : { "usage" : "G", "type" : "layerList" },
76
+ "layerselect" : { "usage" : "G", "type" : "layerRange" },
77
+ "layersep" : { "usage" : "G", "type" : "string" },
78
+ "layout" : { "usage" : "G", "type" : "string" },
79
+ "len" : { "usage" : "E", "type" : "double" },
80
+ "levels" : { "usage" : "G", "type" : "int" },
81
+ "levelsgap" : { "usage" : "G", "type" : "double" },
82
+ "lhead" : { "usage" : "E", "type" : "string" },
83
+ "lheight" : { "usage" : "GC", "type" : "double" },
84
+ "lp" : { "usage" : "EGC", "type" : "point" },
85
+ "ltail" : { "usage" : "E", "type" : "string" },
86
+ "lwidth" : { "usage" : "GC", "type" : "double" },
87
+ "margin" : { "usage" : "NGC", "type" : "pointf" },
88
+ "maxiter" : { "usage" : "G", "type" : "int" },
89
+ "mclimit" : { "usage" : "G", "type" : "double" },
90
+ "mindist" : { "usage" : "G", "type" : "double" },
91
+ "minlen" : { "usage" : "E", "type" : "int" },
92
+ "mode" : { "usage" : "G", "type" : "string" },
93
+ "model" : { "usage" : "G", "type" : "string" },
94
+ "mosek" : { "usage" : "G", "type" : "bool" },
95
+ "nodesep" : { "usage" : "G", "type" : "double" },
96
+ "nojustify" : { "usage" : "GCNE", "type" : "bool" },
97
+ "normalize" : { "usage" : "G", "type" : "bool" },
98
+ "nslimit" : { "usage" : "G", "type" : "double" },
99
+ "nslimit1" : { "usage" : "G", "type" : "double" },
100
+ "ordering" : { "usage" : "GN", "type" : "string" },
101
+ "orientation" : { "usage" : "GN", "type" : "string" },
102
+ "outputorder" : { "usage" : "G", "type" : "outputMode" },
103
+ "overlap" : { "usage" : "G", "type" : "string" },
104
+ "overlap_scaling" : { "usage" : "G", "type" : "double" },
105
+ "pack" : { "usage" : "G", "type" : "int" },
106
+ "packmode" : { "usage" : "G", "type" : "packMode" },
107
+ "pad" : { "usage" : "G", "type" : "pointf" },
108
+ "page" : { "usage" : "G", "type" : "pointf" },
109
+ "pagedir" : { "usage" : "G", "type" : "pagedir" },
110
+ "pencolor" : { "usage" : "C", "type" : "color" },
111
+ "penwidth" : { "usage" : "CNE", "type" : "double" },
112
+ "peripheries" : { "usage" : "NC", "type" : "int" },
113
+ "pin" : { "usage" : "N", "type" : "bool" },
114
+ "pos" : { "usage" : "EN", "type" : "point" },
115
+ "quadtree" : { "usage" : "G", "type" : "quadType" },
116
+ "quantum" : { "usage" : "G", "type" : "double" },
117
+ "rank" : { "usage" : "S", "type" : "rankType" },
118
+ "rankdir" : { "usage" : "G", "type" : "rankdir" },
119
+ "ranksep" : { "usage" : "G", "type" : "double" },
120
+ "ratio" : { "usage" : "G", "type" : "string" },
121
+ "rects" : { "usage" : "N", "type" : "rect" },
122
+ "regular" : { "usage" : "N", "type" : "bool" },
123
+ "remincross" : { "usage" : "G", "type" : "bool" },
124
+ "repulsiveforce" : { "usage" : "G", "type" : "double" },
125
+ "resolution" : { "usage" : "G", "type" : "double" },
126
+ "root" : { "usage" : "GN", "type" : "string" },
127
+ "rotate" : { "usage" : "G", "type" : "int" },
128
+ "rotation" : { "usage" : "G", "type" : "double" },
129
+ "samehead" : { "usage" : "E", "type" : "string" },
130
+ "sametail" : { "usage" : "E", "type" : "string" },
131
+ "samplepoints" : { "usage" : "N", "type" : "int" },
132
+ "scale" : { "usage" : "G", "type" : "double" },
133
+ "searchsize" : { "usage" : "G", "type" : "int" },
134
+ "sep" : { "usage" : "G", "type" : "double" },
135
+ "shape" : { "usage" : "N", "type" : "shape" },
136
+ "shapefile" : { "usage" : "N", "type" : "string" },
137
+ "showboxes" : { "usage" : "ENG", "type" : "int" },
138
+ "sides" : { "usage" : "N", "type" : "int" },
139
+ "size" : { "usage" : "G", "type" : "pointf" },
140
+ "skew" : { "usage" : "N", "type" : "double" },
141
+ "smoothing" : { "usage" : "G", "type" : "smoothType" },
142
+ "sortv" : { "usage" : "GCN", "type" : "int" },
143
+ "splines" : { "usage" : "G", "type" : "string" },
144
+ "start" : { "usage" : "G", "type" : "startType" },
145
+ "style" : { "usage" : "ENCG", "type" : "style" },
146
+ "stylesheet" : { "usage" : "G", "type" : "string" },
147
+ "tail_lp" : { "usage" : "E", "type" : "pointf" },
148
+ "tailURL" : { "usage" : "E", "type" : "escString" },
149
+ "tailclip" : { "usage" : "E", "type" : "bool" },
150
+ "tailhref" : { "usage" : "E", "type" : "escString" },
151
+ "taillabel" : { "usage" : "E", "type" : "lblString" },
152
+ "tailport" : { "usage" : "E", "type" : "portPos" },
153
+ "tailtarget" : { "usage" : "E", "type" : "escString" },
154
+ "tailtooltip" : { "usage" : "E", "type" : "escString" },
155
+ "target" : { "usage" : "ENGC", "type" : "escString" },
156
+ "tooltip" : { "usage" : "NEC", "type" : "escString" },
157
+ "truecolor" : { "usage" : "G", "type" : "bool" },
158
+ "vertices" : { "usage" : "N", "type" : "pointfList" },
159
+ "viewport" : { "usage" : "G", "type" : "viewPort" },
160
+ "voro_margin" : { "usage" : "G", "type" : "double" },
161
+ "weight" : { "usage" : "E", "type" : "double" },
162
+ "width" : { "usage" : "N", "type" : "double" },
163
+ "xlabel" : { "usage" : "EN", "type" : "lblString" },
164
+ "z" : { "usage" : "N", "type" : "double" }
165
+ };
166
+
167
+ var gType = {
168
+ "E" : "edge",
169
+ "N" : "node",
170
+ "G" : "graph",
171
+ "C" : "cluster"
172
+ };
173
+
174
+ var quotedTypes = [
175
+ "escString",
176
+ "rect",
177
+ "color",
178
+ "colorList",
179
+ "string",
180
+ "lblString",
181
+ "portPos",
182
+ "point",
183
+ "pointf",
184
+ "pointfList",
185
+ "splineType",
186
+ "style",
187
+ "viewPort"
188
+ ];
189
+
190
+ function mustBeQuoted(data) {
191
+ return(quotedTypes.indexOf(attrs[data].type) !== -1);
192
+ }
193
+
194
+ function quoteMe(attr, value) {
195
+ if(value[0] === '!') {
196
+ return ('<' + value.substr(1,1000) + '>');
197
+ }
198
+ else if(mustBeQuoted(attr)) {
199
+ return(' "' + value + '"');
200
+ } else {
201
+ return(value);
202
+ }
203
+ }
204
+
205
+ function validateAttribut(name, type) {
206
+ if(attrs[name]) {
207
+ return(attrs[name].usage.indexOf(type) > -1);
208
+ } else {
209
+ return(false);
210
+ }
211
+ }
212
+
213
+ exports.isValid = function(name, type) {
214
+ return validateAttribut(name, type);
215
+ };
216
+
217
+ var Attributs = exports.Attributs = function(t) {
218
+ this._type = t;
219
+ this.attributs = new Hash();
220
+ };
221
+
222
+ Attributs.prototype.length = function() {
223
+ return(this.attributs.length);
224
+ };
225
+
226
+ Attributs.prototype.set = function(name, value) {
227
+ if(validateAttribut(name, this._type) === false) {
228
+ util.debug("Warning : Invalid attribut `" + name + "' for a " + gType[this._type]);
229
+ // throw "Invalid attribut `"+name+"' for a "+gType[this._type]
230
+ }
231
+ this.attributs.setItem(name, value);
232
+ };
233
+
234
+ Attributs.prototype.get = function(name) {
235
+ return this.attributs.items[name];
236
+ };
237
+
238
+ Attributs.prototype.to_dot = function(link) {
239
+ var attrsOutput = "",
240
+ sep = "";
241
+
242
+ if(this.attributs.length > 0) {
243
+ attrsOutput = attrsOutput + " [ ";
244
+ for(var name in this.attributs.items) {
245
+ if (this.attributs.items.hasOwnProperty(name)) {
246
+ attrsOutput = attrsOutput + sep + name + " =" + quoteMe(name, this.attributs.items[name]);
247
+ sep = ", ";
248
+ }
249
+ }
250
+ attrsOutput = attrsOutput + " ]";
251
+ }
252
+
253
+ return attrsOutput;
254
+ };
@@ -0,0 +1,11 @@
1
+ var fs = require('fs');
2
+
3
+ exports.exist = function(path) {
4
+ try {
5
+ fs.statSync( path );
6
+ }
7
+ catch(e) {
8
+ return( false );
9
+ }
10
+ return( true );
11
+ }
@@ -0,0 +1,53 @@
1
+ var Hash = exports.Hash = function() {
2
+ this.length = 0;
3
+ this.items = new Array();
4
+ for (var i = 0; i < arguments.length; i += 2) {
5
+ if (typeof(arguments[i + 1]) != 'undefined') {
6
+ this.items[arguments[i]] = arguments[i + 1];
7
+ this.length++;
8
+ }
9
+ }
10
+ }
11
+
12
+ Hash.prototype.removeItem = function(in_key) {
13
+ var tmp_previous;
14
+ if (typeof(this.items[in_key]) != 'undefined') {
15
+ this.length--;
16
+ var tmp_previous = this.items[in_key];
17
+ delete this.items[in_key];
18
+ }
19
+
20
+ return tmp_previous;
21
+ }
22
+
23
+ Hash.prototype.getItem = function(in_key) {
24
+ return this.items[in_key];
25
+ }
26
+
27
+ Hash.prototype.setItem = function(in_key, in_value) {
28
+ var tmp_previous;
29
+ if (typeof(in_value) != 'undefined') {
30
+ if (typeof(this.items[in_key]) == 'undefined') {
31
+ this.length++;
32
+ }
33
+ else {
34
+ tmp_previous = this.items[in_key];
35
+ }
36
+
37
+ this.items[in_key] = in_value;
38
+ }
39
+
40
+ return tmp_previous;
41
+ }
42
+
43
+ Hash.prototype.hasItem = function(in_key) {
44
+ return typeof(this.items[in_key]) != 'undefined';
45
+ }
46
+
47
+ Hash.prototype.clear = function() {
48
+ for (var i in this.items) {
49
+ delete this.items[i];
50
+ }
51
+
52
+ this.length = 0;
53
+ }
@@ -0,0 +1,58 @@
1
+ /**
2
+ * Module dependencies
3
+ */
4
+ var Hash = require('./core_ext/hash').Hash,
5
+ Attributs = require('./attributs').Attributs;
6
+
7
+ /**
8
+ * Create a new edge
9
+ * @constructor
10
+ * @param {Graph} graph Parent Graph
11
+ * @param {String|Node} nodeOne The first node
12
+ * @param {String|Node} nodeTwo The second node
13
+ * @return {Edge}
14
+ * @api public
15
+ */
16
+ var Edge = exports.Edge = function(graph, nodeOne, nodeTwo) {
17
+ this.relativeGraph = graph;
18
+ this.nodeOne = nodeOne;
19
+ this.nodeTwo = nodeTwo;
20
+ this.attributs = new Attributs("E");
21
+ };
22
+
23
+ /**
24
+ * Set an edge attribut
25
+ *
26
+ * @param {String} name The attribut name
27
+ * @param {Void} value The attribut value
28
+ * @api public
29
+ */
30
+ Edge.prototype.set = function(name, value) {
31
+ this.attributs.set(name, value);
32
+ return this;
33
+ };
34
+
35
+ /**
36
+ * Get an edge attribut
37
+ *
38
+ * @param {String} name The attribut name
39
+ * @return {Void}
40
+ * @api public
41
+ */
42
+ Edge.prototype.get = function(name) {
43
+ return this.attributs.get(name);
44
+ };
45
+
46
+ /**
47
+ * @api private
48
+ */
49
+ Edge.prototype.to_dot = function() {
50
+ var edgeLink = "->";
51
+ if(this.relativeGraph.type === "graph") {
52
+ edgeLink = "--";
53
+ }
54
+
55
+ var edgeOutput = '"' + this.nodeOne.id + '"' + " " + edgeLink + " " + '"' + this.nodeTwo.id + '"';
56
+ edgeOutput = edgeOutput + this.attributs.to_dot();
57
+ return edgeOutput;
58
+ };