Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Add unique id's to edges on a .gexf file. Gephi 0.8.2 did not add them.
require "rexml/document"
INPUT = "/tmp/facebook.gexf"
OUTPUT = "/tmp/output.gexf"
xml =
doc =
doc.root.elements.each_with_index("graph/edges/edge") { |e, i| e.attributes["id"] = i }, 'w') { |file| file.write(doc) }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment