sigma-rails 1.0.2
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.
- checksums.yaml +7 -0
- data/LICENSE.txt +22 -0
- data/README.md +37 -0
- data/lib/sigma/rails.rb +8 -0
- data/lib/sigma/rails/version.rb +5 -0
- data/vendor/assets/javascripts/sigma.js +8723 -0
- data/vendor/assets/javascripts/sigma.layout.forceAtlas2/README.md +12 -0
- data/vendor/assets/javascripts/sigma.layout.forceAtlas2/sigma.layout.forceAtlas2.js +1051 -0
- data/vendor/assets/javascripts/sigma.parsers.gexf/README.md +29 -0
- data/vendor/assets/javascripts/sigma.parsers.gexf/gexf-parser.js +548 -0
- data/vendor/assets/javascripts/sigma.parsers.gexf/sigma.parsers.gexf.js +108 -0
- data/vendor/assets/javascripts/sigma.parsers.json/README.md +29 -0
- data/vendor/assets/javascripts/sigma.parsers.json/sigma.parsers.json.js +88 -0
- data/vendor/assets/javascripts/sigma.plugins.animate/README.md +8 -0
- data/vendor/assets/javascripts/sigma.plugins.animate/sigma.plugins.animate.js +165 -0
- data/vendor/assets/javascripts/sigma.plugins.dragNodes/README.md +8 -0
- data/vendor/assets/javascripts/sigma.plugins.dragNodes/sigma.plugins.dragNodes.js +135 -0
- data/vendor/assets/javascripts/sigma.plugins.neighborhoods/README.md +24 -0
- data/vendor/assets/javascripts/sigma.plugins.neighborhoods/sigma.plugins.neighborhoods.js +186 -0
- data/vendor/assets/javascripts/sigma.renderers.customShapes/README.md +55 -0
- data/vendor/assets/javascripts/sigma.renderers.customShapes/shape-library.js +145 -0
- data/vendor/assets/javascripts/sigma.renderers.customShapes/sigma.renderers.customShapes.js +112 -0
- metadata +121 -0
@@ -0,0 +1,29 @@
|
|
1
|
+
sigma.parsers.gexf
|
2
|
+
==================
|
3
|
+
|
4
|
+
Plugin developed by [Alexis Jacomy](https://github.com/jacomyal), on top of [gexf-parser](https://github.com/Yomguithereal/gexf-parser), developed by [Guillaume Plique](https://github.com/Yomguithereal).
|
5
|
+
|
6
|
+
---
|
7
|
+
|
8
|
+
This plugin provides a single function, `sigma.parsers.gexf()`, that will load a GEXF encoded file, parse it, and instantiate sigma.
|
9
|
+
|
10
|
+
The most basic way to use this helper is to call it with a path and a sigma configuration object. It will then instantiate sigma, but after having added the graph into the config object.
|
11
|
+
|
12
|
+
````javascript
|
13
|
+
sigma.parsers.gexf(
|
14
|
+
'myGraph.gexf',
|
15
|
+
{ container: 'myContainer' }
|
16
|
+
);
|
17
|
+
````
|
18
|
+
|
19
|
+
It is also possible to update an existing instance's graph instead.
|
20
|
+
|
21
|
+
````javascript
|
22
|
+
sigma.parsers.gexf(
|
23
|
+
'myGraph.gexf',
|
24
|
+
myExistingInstance,
|
25
|
+
function() {
|
26
|
+
myExistingInstance.refresh();
|
27
|
+
}
|
28
|
+
);
|
29
|
+
````
|
@@ -0,0 +1,548 @@
|
|
1
|
+
;(function(undefined) {
|
2
|
+
'use strict';
|
3
|
+
|
4
|
+
/**
|
5
|
+
* GEXF Library
|
6
|
+
* =============
|
7
|
+
*
|
8
|
+
* Author: PLIQUE Guillaume (Yomguithereal)
|
9
|
+
* URL: https://github.com/Yomguithereal/gexf-parser
|
10
|
+
* Version: 0.1.1
|
11
|
+
*/
|
12
|
+
|
13
|
+
/**
|
14
|
+
* Helper Namespace
|
15
|
+
* -----------------
|
16
|
+
*
|
17
|
+
* A useful batch of function dealing with DOM operations and types.
|
18
|
+
*/
|
19
|
+
var _helpers = {
|
20
|
+
getModelTags: function(xml) {
|
21
|
+
var attributesTags = xml.getElementsByTagName('attributes'),
|
22
|
+
modelTags = {},
|
23
|
+
l = attributesTags.length,
|
24
|
+
i;
|
25
|
+
|
26
|
+
for (i = 0; i < l; i++)
|
27
|
+
modelTags[attributesTags[i].getAttribute('class')] =
|
28
|
+
attributesTags[i].childNodes;
|
29
|
+
|
30
|
+
return modelTags;
|
31
|
+
},
|
32
|
+
nodeListToArray: function(nodeList) {
|
33
|
+
|
34
|
+
// Return array
|
35
|
+
var children = [];
|
36
|
+
|
37
|
+
// Iterating
|
38
|
+
for (var i = 0, len = nodeList.length; i < len; ++i) {
|
39
|
+
if (nodeList[i].nodeName !== '#text')
|
40
|
+
children.push(nodeList[i]);
|
41
|
+
}
|
42
|
+
|
43
|
+
return children;
|
44
|
+
},
|
45
|
+
nodeListEach: function(nodeList, func) {
|
46
|
+
|
47
|
+
// Iterating
|
48
|
+
for (var i = 0, len = nodeList.length; i < len; ++i) {
|
49
|
+
if (nodeList[i].nodeName !== '#text')
|
50
|
+
func(nodeList[i]);
|
51
|
+
}
|
52
|
+
},
|
53
|
+
nodeListToHash: function(nodeList, filter) {
|
54
|
+
|
55
|
+
// Return object
|
56
|
+
var children = {};
|
57
|
+
|
58
|
+
// Iterating
|
59
|
+
for (var i = 0; i < nodeList.length; i++) {
|
60
|
+
if (nodeList[i].nodeName !== '#text') {
|
61
|
+
var prop = filter(nodeList[i]);
|
62
|
+
children[prop.key] = prop.value;
|
63
|
+
}
|
64
|
+
}
|
65
|
+
|
66
|
+
return children;
|
67
|
+
},
|
68
|
+
namedNodeMapToObject: function(nodeMap) {
|
69
|
+
|
70
|
+
// Return object
|
71
|
+
var attributes = {};
|
72
|
+
|
73
|
+
// Iterating
|
74
|
+
for (var i = 0; i < nodeMap.length; i++) {
|
75
|
+
attributes[nodeMap[i].name] = nodeMap[i].value;
|
76
|
+
}
|
77
|
+
|
78
|
+
return attributes;
|
79
|
+
},
|
80
|
+
getFirstElementByTagNS: function(node, ns, tag) {
|
81
|
+
var el = node.getElementsByTagName(ns + ':' + tag)[0];
|
82
|
+
|
83
|
+
if (!el)
|
84
|
+
el = node.getElementsByTagNameNS(ns, tag)[0];
|
85
|
+
|
86
|
+
if (!el)
|
87
|
+
el = node.getElementsByTagName(tag)[0];
|
88
|
+
|
89
|
+
return el;
|
90
|
+
},
|
91
|
+
getAttributeNS: function(node, ns, attribute) {
|
92
|
+
var attr_value = node.getAttribute(ns + ':' + attribute);
|
93
|
+
|
94
|
+
if (attr_value === undefined)
|
95
|
+
attr_value = node.getAttributeNS(ns, attribute);
|
96
|
+
|
97
|
+
if (attr_value === undefined)
|
98
|
+
attr_value = node.getAttribute(attribute);
|
99
|
+
|
100
|
+
return attr_value;
|
101
|
+
},
|
102
|
+
enforceType: function(type, value) {
|
103
|
+
|
104
|
+
switch (type) {
|
105
|
+
case 'boolean':
|
106
|
+
value = (value === 'true');
|
107
|
+
break;
|
108
|
+
|
109
|
+
case 'integer':
|
110
|
+
case 'long':
|
111
|
+
case 'float':
|
112
|
+
case 'double':
|
113
|
+
value = +value;
|
114
|
+
break;
|
115
|
+
}
|
116
|
+
|
117
|
+
return value;
|
118
|
+
},
|
119
|
+
getRGB: function(values) {
|
120
|
+
return (values[3]) ?
|
121
|
+
'rgba(' + values.join(',') + ')' :
|
122
|
+
'rgb(' + values.slice(0, -1).join(',') + ')';
|
123
|
+
}
|
124
|
+
};
|
125
|
+
|
126
|
+
|
127
|
+
/**
|
128
|
+
* Parser Core Functions
|
129
|
+
* ----------------------
|
130
|
+
*
|
131
|
+
* The XML parser's functions themselves.
|
132
|
+
*/
|
133
|
+
|
134
|
+
/**
|
135
|
+
* Node structure.
|
136
|
+
* A function returning an object guarded with default value.
|
137
|
+
*
|
138
|
+
* @param {object} properties The node properties.
|
139
|
+
* @return {object} The guarded node object.
|
140
|
+
*/
|
141
|
+
function Node(properties) {
|
142
|
+
|
143
|
+
// Possible Properties
|
144
|
+
var node = {
|
145
|
+
id: properties.id,
|
146
|
+
label: properties.label
|
147
|
+
};
|
148
|
+
|
149
|
+
if (properties.viz)
|
150
|
+
node.viz = properties.viz;
|
151
|
+
|
152
|
+
if (properties.attributes)
|
153
|
+
node.attributes = properties.attributes;
|
154
|
+
|
155
|
+
return node;
|
156
|
+
}
|
157
|
+
|
158
|
+
|
159
|
+
/**
|
160
|
+
* Edge structure.
|
161
|
+
* A function returning an object guarded with default value.
|
162
|
+
*
|
163
|
+
* @param {object} properties The edge properties.
|
164
|
+
* @return {object} The guarded edge object.
|
165
|
+
*/
|
166
|
+
function Edge(properties) {
|
167
|
+
|
168
|
+
// Possible Properties
|
169
|
+
var edge = {
|
170
|
+
id: properties.id,
|
171
|
+
type: properties.type || 'undirected',
|
172
|
+
label: properties.label || '',
|
173
|
+
source: properties.source,
|
174
|
+
target: properties.target,
|
175
|
+
weight: +properties.weight || 1.0
|
176
|
+
};
|
177
|
+
|
178
|
+
if (properties.viz)
|
179
|
+
edge.viz = properties.viz;
|
180
|
+
|
181
|
+
if (properties.attributes)
|
182
|
+
edge.attributes = properties.attributes;
|
183
|
+
|
184
|
+
return edge;
|
185
|
+
}
|
186
|
+
|
187
|
+
/**
|
188
|
+
* Graph parser.
|
189
|
+
* This structure parse a gexf string and return an object containing the
|
190
|
+
* parsed graph.
|
191
|
+
*
|
192
|
+
* @param {string} xml The xml string of the gexf file to parse.
|
193
|
+
* @return {object} The parsed graph.
|
194
|
+
*/
|
195
|
+
function Graph(xml) {
|
196
|
+
var _xml = {};
|
197
|
+
|
198
|
+
// Basic Properties
|
199
|
+
//------------------
|
200
|
+
_xml.els = {
|
201
|
+
root: xml.getElementsByTagName('gexf')[0],
|
202
|
+
graph: xml.getElementsByTagName('graph')[0],
|
203
|
+
meta: xml.getElementsByTagName('meta')[0],
|
204
|
+
nodes: xml.getElementsByTagName('node'),
|
205
|
+
edges: xml.getElementsByTagName('edge'),
|
206
|
+
model: _helpers.getModelTags(xml)
|
207
|
+
};
|
208
|
+
|
209
|
+
// Information
|
210
|
+
_xml.hasViz = !!_helpers.getAttributeNS(_xml.els.root, 'xmlns', 'viz');
|
211
|
+
_xml.version = _xml.els.root.getAttribute('version') || '1.0';
|
212
|
+
_xml.mode = _xml.els.graph.getAttribute('mode') || 'static';
|
213
|
+
|
214
|
+
var edgeType = _xml.els.graph.getAttribute('defaultedgetype');
|
215
|
+
_xml.defaultEdgetype = edgeType || 'undirected';
|
216
|
+
|
217
|
+
// Parser Functions
|
218
|
+
//------------------
|
219
|
+
|
220
|
+
// Meta Data
|
221
|
+
function _metaData() {
|
222
|
+
|
223
|
+
var metas = {};
|
224
|
+
if (!_xml.els.meta)
|
225
|
+
return metas;
|
226
|
+
|
227
|
+
// Last modified date
|
228
|
+
metas.lastmodifieddate = _xml.els.meta.getAttribute('lastmodifieddate');
|
229
|
+
|
230
|
+
// Other information
|
231
|
+
_helpers.nodeListEach(_xml.els.meta.childNodes, function(child) {
|
232
|
+
metas[child.tagName.toLowerCase()] = child.textContent;
|
233
|
+
});
|
234
|
+
|
235
|
+
return metas;
|
236
|
+
}
|
237
|
+
|
238
|
+
// Model
|
239
|
+
function _model(cls) {
|
240
|
+
var attributes = [];
|
241
|
+
|
242
|
+
// Iterating through attributes
|
243
|
+
if (_xml.els.model[cls])
|
244
|
+
_helpers.nodeListEach(_xml.els.model[cls], function(attr) {
|
245
|
+
|
246
|
+
// Properties
|
247
|
+
var properties = {
|
248
|
+
id: attr.getAttribute('id') || attr.getAttribute('for'),
|
249
|
+
type: attr.getAttribute('type') || 'string',
|
250
|
+
title: attr.getAttribute('title') || ''
|
251
|
+
};
|
252
|
+
|
253
|
+
// Defaults
|
254
|
+
var default_el = _helpers.nodeListToArray(attr.childNodes);
|
255
|
+
|
256
|
+
if (default_el.length > 0)
|
257
|
+
properties.defaultValue = default_el[0].textContent;
|
258
|
+
|
259
|
+
// Creating attribute
|
260
|
+
attributes.push(properties);
|
261
|
+
});
|
262
|
+
|
263
|
+
return attributes.length > 0 ? attributes : false;
|
264
|
+
}
|
265
|
+
|
266
|
+
// Data from nodes or edges
|
267
|
+
function _data(model, node_or_edge) {
|
268
|
+
|
269
|
+
var data = {};
|
270
|
+
var attvalues_els = node_or_edge.getElementsByTagName('attvalue');
|
271
|
+
|
272
|
+
// Getting Node Indicated Attributes
|
273
|
+
var ah = _helpers.nodeListToHash(attvalues_els, function(el) {
|
274
|
+
var attributes = _helpers.namedNodeMapToObject(el.attributes);
|
275
|
+
var key = attributes.id || attributes['for'];
|
276
|
+
|
277
|
+
// Returning object
|
278
|
+
return {key: key, value: attributes.value};
|
279
|
+
});
|
280
|
+
|
281
|
+
|
282
|
+
// Iterating through model
|
283
|
+
model.map(function(a) {
|
284
|
+
|
285
|
+
// Default value?
|
286
|
+
var att_title = a.title.toLowerCase();
|
287
|
+
data[att_title] = !(a.id in ah) && 'defaultValue' in a ?
|
288
|
+
_helpers.enforceType(a.type, a.defaultValue) :
|
289
|
+
_helpers.enforceType(a.type, ah[a.id]);
|
290
|
+
|
291
|
+
});
|
292
|
+
|
293
|
+
return data;
|
294
|
+
}
|
295
|
+
|
296
|
+
// Nodes
|
297
|
+
function _nodes(model) {
|
298
|
+
var nodes = [];
|
299
|
+
|
300
|
+
// Iteration through nodes
|
301
|
+
_helpers.nodeListEach(_xml.els.nodes, function(n) {
|
302
|
+
|
303
|
+
// Basic properties
|
304
|
+
var properties = {
|
305
|
+
id: n.getAttribute('id'),
|
306
|
+
label: n.getAttribute('label') || ''
|
307
|
+
};
|
308
|
+
|
309
|
+
// Retrieving data from nodes if any
|
310
|
+
if (model)
|
311
|
+
properties.attributes = _data(model, n);
|
312
|
+
|
313
|
+
// Retrieving viz information
|
314
|
+
if (_xml.hasViz)
|
315
|
+
properties.viz = _nodeViz(n);
|
316
|
+
|
317
|
+
// Pushing node
|
318
|
+
nodes.push(Node(properties));
|
319
|
+
});
|
320
|
+
|
321
|
+
return nodes;
|
322
|
+
}
|
323
|
+
|
324
|
+
// Viz information from nodes
|
325
|
+
function _nodeViz(node) {
|
326
|
+
var viz = {};
|
327
|
+
|
328
|
+
// Color
|
329
|
+
var color_el = _helpers.getFirstElementByTagNS(node, 'viz', 'color');
|
330
|
+
|
331
|
+
if (color_el) {
|
332
|
+
var color = ['r', 'g', 'b', 'a'].map(function(c) {
|
333
|
+
return color_el.getAttribute(c);
|
334
|
+
});
|
335
|
+
|
336
|
+
viz.color = _helpers.getRGB(color);
|
337
|
+
}
|
338
|
+
|
339
|
+
// Position
|
340
|
+
var pos_el = _helpers.getFirstElementByTagNS(node, 'viz', 'position');
|
341
|
+
|
342
|
+
if (pos_el) {
|
343
|
+
viz.position = {};
|
344
|
+
|
345
|
+
['x', 'y', 'z'].map(function(p) {
|
346
|
+
viz.position[p] = +pos_el.getAttribute(p);
|
347
|
+
});
|
348
|
+
}
|
349
|
+
|
350
|
+
// Size
|
351
|
+
var size_el = _helpers.getFirstElementByTagNS(node, 'viz', 'size');
|
352
|
+
if (size_el)
|
353
|
+
viz.size = +size_el.getAttribute('value');
|
354
|
+
|
355
|
+
// Shape
|
356
|
+
var shape_el = _helpers.getFirstElementByTagNS(node, 'viz', 'shape');
|
357
|
+
if (shape_el)
|
358
|
+
viz.shape = shape_el.getAttribute('value');
|
359
|
+
|
360
|
+
return viz;
|
361
|
+
}
|
362
|
+
|
363
|
+
// Edges
|
364
|
+
function _edges(model, default_type) {
|
365
|
+
var edges = [];
|
366
|
+
|
367
|
+
// Iteration through edges
|
368
|
+
_helpers.nodeListEach(_xml.els.edges, function(e) {
|
369
|
+
|
370
|
+
// Creating the edge
|
371
|
+
var properties = _helpers.namedNodeMapToObject(e.attributes);
|
372
|
+
if (!('type' in properties)) {
|
373
|
+
properties.type = default_type;
|
374
|
+
}
|
375
|
+
|
376
|
+
// Retrieving edge data
|
377
|
+
if (model)
|
378
|
+
properties.attributes = _data(model, e);
|
379
|
+
|
380
|
+
|
381
|
+
// Retrieving viz information
|
382
|
+
if (_xml.hasViz)
|
383
|
+
properties.viz = _edgeViz(e);
|
384
|
+
|
385
|
+
edges.push(Edge(properties));
|
386
|
+
});
|
387
|
+
|
388
|
+
return edges;
|
389
|
+
}
|
390
|
+
|
391
|
+
// Viz information from edges
|
392
|
+
function _edgeViz(edge) {
|
393
|
+
var viz = {};
|
394
|
+
|
395
|
+
// Color
|
396
|
+
var color_el = _helpers.getFirstElementByTagNS(edge, 'viz', 'color');
|
397
|
+
|
398
|
+
if (color_el) {
|
399
|
+
var color = ['r', 'g', 'b', 'a'].map(function(c) {
|
400
|
+
return color_el.getAttribute(c);
|
401
|
+
});
|
402
|
+
|
403
|
+
viz.color = _helpers.getRGB(color);
|
404
|
+
}
|
405
|
+
|
406
|
+
// Shape
|
407
|
+
var shape_el = _helpers.getFirstElementByTagNS(edge, 'viz', 'shape');
|
408
|
+
if (shape_el)
|
409
|
+
viz.shape = shape_el.getAttribute('value');
|
410
|
+
|
411
|
+
// Thickness
|
412
|
+
var thick_el = _helpers.getFirstElementByTagNS(edge, 'viz', 'thickness');
|
413
|
+
if (thick_el)
|
414
|
+
viz.thickness = +thick_el.getAttribute('value');
|
415
|
+
|
416
|
+
return viz;
|
417
|
+
}
|
418
|
+
|
419
|
+
|
420
|
+
// Returning the Graph
|
421
|
+
//---------------------
|
422
|
+
var nodeModel = _model('node'),
|
423
|
+
edgeModel = _model('edge');
|
424
|
+
|
425
|
+
var graph = {
|
426
|
+
version: _xml.version,
|
427
|
+
mode: _xml.mode,
|
428
|
+
defaultEdgeType: _xml.defaultEdgetype,
|
429
|
+
meta: _metaData(),
|
430
|
+
model: {},
|
431
|
+
nodes: _nodes(nodeModel),
|
432
|
+
edges: _edges(edgeModel, _xml.defaultEdgetype)
|
433
|
+
};
|
434
|
+
|
435
|
+
if (nodeModel)
|
436
|
+
graph.model.node = nodeModel;
|
437
|
+
if (edgeModel)
|
438
|
+
graph.model.edge = edgeModel;
|
439
|
+
|
440
|
+
return graph;
|
441
|
+
}
|
442
|
+
|
443
|
+
|
444
|
+
/**
|
445
|
+
* Public API
|
446
|
+
* -----------
|
447
|
+
*
|
448
|
+
* User-accessible functions.
|
449
|
+
*/
|
450
|
+
|
451
|
+
// Fetching GEXF with XHR
|
452
|
+
function fetch(gexf_url, callback) {
|
453
|
+
var xhr = (function() {
|
454
|
+
if (window.XMLHttpRequest)
|
455
|
+
return new XMLHttpRequest();
|
456
|
+
|
457
|
+
var names,
|
458
|
+
i;
|
459
|
+
|
460
|
+
if (window.ActiveXObject) {
|
461
|
+
names = [
|
462
|
+
'Msxml2.XMLHTTP.6.0',
|
463
|
+
'Msxml2.XMLHTTP.3.0',
|
464
|
+
'Msxml2.XMLHTTP',
|
465
|
+
'Microsoft.XMLHTTP'
|
466
|
+
];
|
467
|
+
|
468
|
+
for (i in names)
|
469
|
+
try {
|
470
|
+
return new ActiveXObject(names[i]);
|
471
|
+
} catch (e) {}
|
472
|
+
}
|
473
|
+
|
474
|
+
return null;
|
475
|
+
})();
|
476
|
+
|
477
|
+
if (!xhr)
|
478
|
+
throw 'XMLHttpRequest not supported, cannot load the file.';
|
479
|
+
|
480
|
+
// Async?
|
481
|
+
var async = (typeof callback === 'function'),
|
482
|
+
getResult;
|
483
|
+
|
484
|
+
// If we can't override MIME type, we are on IE 9
|
485
|
+
// We'll be parsing the response string then.
|
486
|
+
if (xhr.overrideMimeType) {
|
487
|
+
xhr.overrideMimeType('text/xml');
|
488
|
+
getResult = function(r) {
|
489
|
+
return r.responseXML;
|
490
|
+
};
|
491
|
+
}
|
492
|
+
else {
|
493
|
+
getResult = function(r) {
|
494
|
+
var p = new DOMParser();
|
495
|
+
return p.parseFromString(r.responseText, 'application/xml');
|
496
|
+
};
|
497
|
+
}
|
498
|
+
|
499
|
+
xhr.open('GET', gexf_url, async);
|
500
|
+
|
501
|
+
if (async)
|
502
|
+
xhr.onreadystatechange = function() {
|
503
|
+
if (xhr.readyState === 4)
|
504
|
+
callback(getResult(xhr));
|
505
|
+
};
|
506
|
+
|
507
|
+
xhr.send();
|
508
|
+
|
509
|
+
return (async) ? xhr : getResult(xhr);
|
510
|
+
}
|
511
|
+
|
512
|
+
// Parsing the GEXF File
|
513
|
+
function parse(gexf) {
|
514
|
+
return Graph(gexf);
|
515
|
+
}
|
516
|
+
|
517
|
+
// Fetch and parse the GEXF File
|
518
|
+
function fetchAndParse(gexf_url, callback) {
|
519
|
+
if (typeof callback === 'function') {
|
520
|
+
return fetch(gexf_url, function(gexf) {
|
521
|
+
callback(Graph(gexf));
|
522
|
+
});
|
523
|
+
} else
|
524
|
+
return Graph(fetch(gexf_url));
|
525
|
+
}
|
526
|
+
|
527
|
+
|
528
|
+
/**
|
529
|
+
* Exporting
|
530
|
+
* ----------
|
531
|
+
*/
|
532
|
+
if (typeof this.gexf !== 'undefined')
|
533
|
+
throw 'gexf: error - a variable called "gexf" already ' +
|
534
|
+
'exists in the global scope';
|
535
|
+
|
536
|
+
this.gexf = {
|
537
|
+
|
538
|
+
// Functions
|
539
|
+
parse: parse,
|
540
|
+
fetch: fetchAndParse,
|
541
|
+
|
542
|
+
// Version
|
543
|
+
version: '0.1.1'
|
544
|
+
};
|
545
|
+
|
546
|
+
if (typeof exports !== 'undefined' && this.exports !== exports)
|
547
|
+
module.exports = this.gexf;
|
548
|
+
}).call(this);
|