1

i'm using JSNetworkX for graph exploration and rendering.

JSNetworkX is using D3.js for graph render. However, as I work with large graph (json file about 5Mb), I would like to render this graph directly without any animations (so, in placing each node directly without force attraction).

I try to use D3.layout.force().stop() after rendering, but it's without effects. Because of that, I'm thinking that it has to be done in jsnx.draw, see my code below.

jsnx.draw(G, {
    element: 'body',
    d3: d3,
    layout_attr: {
        charge: -1500,
        linkDistance: 1,
        gravity: 1,
        friction: 0.4,
        alpha: -100
    },
});
force = d3.layout.force();
VividD
  • 10,456
  • 6
  • 64
  • 111
Blooheek
  • 43
  • 5
  • Unfortunately, you can't do that with the current version. Do you need a force layout at all or do you already have positions for each node? FWIW, if you really have a large graph, even a static layout would be slow, because you'd still have too many SVG elements. The next version will include a WebGL rendered for large graphs. – Felix Kling Jun 25 '13 at 09:02
  • Ow... Okay, understood. I've already approximative position for each nodes (clustering). So, i'll use a D3 static graph. For 5mb graph, it takes about 15 secondes to rendering... But it's enought for now... Thanks for your comment and Thanks for JSNetworkX :) (I'll follow his developpement) Thanks a lot :) – Blooheek Jun 25 '13 at 12:37

2 Answers2

0

Unfortunately, you can't do that with the current version. Do you need a force layout at all or do you already have positions for each node? FWIW, if you really have a large graph, even a static layout would be slow, because you'd still have too many SVG elements. The next version will include a WebGL rendered for large graphs.

So, we can't for the moment.

Blooheek
  • 43
  • 5
0

As of v0.3.4, jsnx.draw returns the force layout object so you can do var force = jsnx.draw{/*...*/} then force.stop().

ojy70616
  • 1
  • 1