Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Use required edge ID attribute when parsing GEXF #85

Merged
merged 1 commit into from

2 participants

@mattcg

Both the 1.1draft and 1.2draft schema definitions for GEXF define the id attribute of an edge element as required. This is what should be used instead of an incrementing ID, for consistency with pushGraph, which uses the id property of each edge object.

Otherwise, if pushGraph is used to push in a graph which contains edges previously added after parsing a GEXF file, duplicate edges will be drawn, as the IDs don't match.

@jacomyal jacomyal merged commit 633ec12 into jacomyal:master
@mattcg mattcg deleted the unknown repository branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Apr 1, 2013
  1. @mattcg
This page is out of date. Refresh to see the latest.
Showing with 3 additions and 3 deletions.
  1. +3 −3 plugins/sigma.parseGexf.js
View
6 plugins/sigma.parseGexf.js
@@ -121,18 +121,18 @@ sigma.publicPrototype.parseGexf = function(gexfPath) {
}
var edges = [];
- var edgeId = 0;
var edgesNodes = gexf.getElementsByTagName('edges');
for(i=0; i<edgesNodes.length; i++){
var edgesNode = edgesNodes[i];
var edgeNodes = edgesNode.getElementsByTagName('edge');
for(j=0; j<edgeNodes.length; j++){
var edgeNode = edgeNodes[j];
+ var id = edgeNode.getAttribute('id');
var source = edgeNode.getAttribute('source');
var target = edgeNode.getAttribute('target');
var label = edgeNode.getAttribute('label');
var edge = {
- id: j,
+ id: id,
sourceID: source,
targetID: target,
label: label,
@@ -152,7 +152,7 @@ sigma.publicPrototype.parseGexf = function(gexfPath) {
edge.attributes.push({attr:attr, val:val});
}
- sigmaInstance.addEdge(edgeId++,source,target,edge);
+ sigmaInstance.addEdge(id,source,target,edge);
}
}
};
Something went wrong with that request. Please try again.