# Graphml2json Takes graphml and converts it to json for use in D3 ## Installation Add this line to your application's Gemfile: gem 'graphml2json' And then execute: $ bundle Or install it yourself as: $ gem install graphml2json ## Usage ``` gregors$ irb --simple-prompt >> file = File.open('simple.graphml', 'rb') => # >> graphml = file.read => "\n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n\n" >> require 'graphml2json' => true >> json = Graphml2Json.generate(graphml) => "{\"nodes\":[{\"name\":0},{\"name\":1},{\"name\":2},{\"name\":3},{\"name\":4},{\"name\":5},{\"name\":6},{\"name\":7},{\"name\":8},{\"name\":9},{\"name\":10}],\"edges\":[{\"source\":0,\"target\":2},{\"source\":1,\"target\":2},{\"source\":2,\"target\":3},{\"source\":3,\"target\":5},{\"source\":3,\"target\":4},{\"source\":4,\"target\":6},{\"source\":6,\"target\":5},{\"source\":5,\"target\":7},{\"source\":6,\"target\":8},{\"source\":8,\"target\":7},{\"source\":8,\"target\":9},{\"source\":8,\"target\":10}]}" ``` sample file used taken from: http://graphml.graphdrawing.org/primer/graphml-primer.html ## Contributing 1. Fork it 2. Create your feature branch (`git checkout -b my-new-feature`) 3. Commit your changes (`git commit -am 'Add some feature'`) 4. Push to the branch (`git push origin my-new-feature`) 5. Create new Pull Request