@@ -8,9 +8,9 @@ sigma.publicPrototype.parseGexf = function(gexfPath) {
8
8
new XMLHttpRequest ( ) :
9
9
new ActiveXObject ( 'Microsoft.XMLHTTP' ) ;
10
10
11
- if ( gexfhttp . overrideMimeType ) {
11
+ if ( gexfhttp . overrideMimeType ) {
12
12
gexfhttp . overrideMimeType ( 'text/xml' ) ;
13
- }
13
+ }
14
14
15
15
gexfhttp . open ( 'GET' , gexfPath , false ) ;
16
16
gexfhttp . send ( ) ;
@@ -23,53 +23,53 @@ if (gexfhttp.overrideMimeType) {
23
23
var nodesAttributes = [ ] ; // The list of attributes of the nodes of the graph that we build in json
24
24
var edgesAttributes = [ ] ; // The list of attributes of the edges of the graph that we build in json
25
25
var attributesNodes = gexf . getElementsByTagName ( 'attributes' ) ; // In the gexf (that is an xml), the list of xml nodes 'attributes' (note the plural 's')
26
-
26
+
27
27
for ( i = 0 ; i < attributesNodes . length ; i ++ ) {
28
28
var attributesNode = attributesNodes [ i ] ; // attributesNode is each xml node 'attributes' (plural)
29
29
if ( attributesNode . getAttribute ( 'class' ) == 'node' ) {
30
30
var attributeNodes = attributesNode . getElementsByTagName ( 'attribute' ) ; // The list of xml nodes 'attribute' (no 's')
31
31
for ( j = 0 ; j < attributeNodes . length ; j ++ ) {
32
32
var attributeNode = attributeNodes [ j ] ; // Each xml node 'attribute'
33
-
33
+
34
34
var id = attributeNode . getAttribute ( 'id' ) ,
35
35
title = attributeNode . getAttribute ( 'title' ) ,
36
36
type = attributeNode . getAttribute ( 'type' ) ;
37
-
37
+
38
38
var attribute = { id :id , title :title , type :type } ;
39
39
nodesAttributes . push ( attribute ) ;
40
-
40
+
41
41
}
42
42
} else if ( attributesNode . getAttribute ( 'class' ) == 'edge' ) {
43
43
var attributeNodes = attributesNode . getElementsByTagName ( 'attribute' ) ; // The list of xml nodes 'attribute' (no 's')
44
44
for ( j = 0 ; j < attributeNodes . length ; j ++ ) {
45
45
var attributeNode = attributeNodes [ j ] ; // Each xml node 'attribute'
46
-
46
+
47
47
var id = attributeNode . getAttribute ( 'id' ) ,
48
48
title = attributeNode . getAttribute ( 'title' ) ,
49
49
type = attributeNode . getAttribute ( 'type' ) ;
50
-
50
+
51
51
var attribute = { id :id , title :title , type :type } ;
52
52
edgesAttributes . push ( attribute ) ;
53
-
53
+
54
54
}
55
55
}
56
56
}
57
-
57
+
58
58
var nodes = [ ] ; // The nodes of the graph
59
59
var nodesNodes = gexf . getElementsByTagName ( 'nodes' ) // The list of xml nodes 'nodes' (plural)
60
-
60
+
61
61
for ( i = 0 ; i < nodesNodes . length ; i ++ ) {
62
62
var nodesNode = nodesNodes [ i ] ; // Each xml node 'nodes' (plural)
63
63
var nodeNodes = nodesNode . getElementsByTagName ( 'node' ) ; // The list of xml nodes 'node' (no 's')
64
64
65
65
for ( j = 0 ; j < nodeNodes . length ; j ++ ) {
66
66
var nodeNode = nodeNodes [ j ] ; // Each xml node 'node' (no 's')
67
-
67
+
68
68
window . NODE = nodeNode ;
69
69
70
70
var id = nodeNode . getAttribute ( 'id' ) ;
71
71
var label = nodeNode . getAttribute ( 'label' ) || id ;
72
-
72
+
73
73
//viz
74
74
var size = 1 ;
75
75
var x = 100 - 200 * Math . random ( ) ;
@@ -105,10 +105,10 @@ if (gexfhttp.overrideMimeType) {
105
105
parseFloat ( colorNode . getAttribute ( 'g' ) ) ,
106
106
parseFloat ( colorNode . getAttribute ( 'b' ) ) ) ;
107
107
}
108
-
108
+
109
109
// Create Node
110
110
var node = { label :label , size :size , x :x , y :y , attributes :[ ] , color :color } ; // The graph node
111
-
111
+
112
112
// Attribute values
113
113
var attvalueNodes = nodeNode . getElementsByTagName ( 'attvalue' ) ;
114
114
for ( k = 0 ; k < attvalueNodes . length ; k ++ ) {
@@ -158,4 +158,4 @@ if (gexfhttp.overrideMimeType) {
158
158
sigmaInstance . addEdge ( id , source , target , edge ) ;
159
159
}
160
160
}
161
- } ;
161
+ } ;
0 commit comments