Export d3.js javascript network in GEXF

Graphs inside the browser
Post Reply
mikima
Posts: 3
Joined: 12 Apr 2011 12:00

Export d3.js javascript network in GEXF

Post by mikima » 09 Apr 2014 07:23

Hi to all,
i've created an online app to explore networks. Everything is made in js. The network is rendered using d3.js.

I'd like to add the ability to download the network in GEXF format, or something edible by gephi.

The networks are now described as js objects, containing two array of objects.

Any suggestion?

Below an example of network.

Code: Select all

var graph =  {
  "nodes": [
    {
      "name": "Climate change",
      "size": 68578,
      "depthlevel": 0,
      "status": "visited",
      "id": 0,
      "index": 0,
      "weight": 0,
      "x": 479.8230417570266,
      "y": 245.88634526613947,
      "px": 479.8031565954434,
      "py": 245.4240854261562
    },
    {
      "name": "Thermohaline circulation",
      "size": 0,
      "depthlevel": 1,
      "status": "new",
      "id": 1
    },
    {
      "name": "Milankovitch cycles",
      "size": 0,
      "depthlevel": 1,
      "status": "new",
      "id": 2
    },
    {
      "name": "Solar variation",
      "size": 0,
      "depthlevel": 1,
      "status": "new",
      "id": 3
    },
    {
      "name": "Global warming",
      "size": 0,
      "depthlevel": 1,
      "status": "new",
      "id": 4
    },
    {
      "name": "Historical impacts of climate change",
      "size": 0,
      "depthlevel": 1,
      "status": "new",
      "id": 5
    },
    {
      "name": "Polar ice packs|Climate change in the Arctic",
      "size": 0,
      "depthlevel": 1,
      "status": "new",
      "id": 6
    },
    {
      "name": "Sea level|Current sea level rise",
      "size": 0,
      "depthlevel": 1,
      "status": "new",
      "id": 7
    }
  ],
  "edges": [
    {
      "source": 0,
      "target": 1
    },
    {
      "source": 0,
      "target": 2
    },
    {
      "source": 0,
      "target": 3
    },
    {
      "source": 0,
      "target": 4
    },
    {
      "source": 0,
      "target": 5
    },
    {
      "source": 0,
      "target": 6
    },
    {
      "source": 0,
      "target": 7
    }
  ]
} 

Post Reply