Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Force-directed layout: Slow initial chart stabilization after v3.5.4 #2673

Closed
richww opened this issue Dec 9, 2015 · 2 comments
Closed

Force-directed layout: Slow initial chart stabilization after v3.5.4 #2673

richww opened this issue Dec 9, 2015 · 2 comments
Milestone

Comments

@richww
Copy link

richww commented Dec 9, 2015

Hello,

It appears that d3.js version 3.5.4 introduced a change which is causing force-directed layouts to initially stabilize much slower than before. Is this perhaps due to the release note on v3.5.4 "Improve initial random positioning of nodes for force layouts."?

I took the existing "Mobile Patent Suits" demo page (http://bl.ocks.org/mbostock/1153292) and modified it by adding 500 nodes to highlight the initial stabilization difference (see images below).

In both examples below, I stopped the layout prematurely at 0.6 alpha to show how far the layout has stabilized.

d3js 3 5 3_stopped

v3.5.3 is already very stable even at 0.6 alpha.

d3js 3 5 4_stopped

In v3.5.4, many nodes are still far out of range from center gravity.

From what I've tested in my own application, the chart is not only wildly bouncing around (more than in v3.5.3), but it overall takes a little longer to fully stabilize. This problem is essentially a blocker for us to upgrade past v3.5.3 due to the performance hit. The delay in getting to enough stabilization resembling a useful network is especially problematic for my application because we attempt to "Pause" the animation at certain alpha states, which now seem to be on a different scale (especially between .9 to .1) relative to v3.5.3.

I will add that another force-directed layout sample page does not appear to have this problem when I similarly add 500 nodes to the graph (http://mbostock.github.io/d3/talk/20111116/force-collapsible.html). I know that the Mobile Suits demo uses paths instead of lines to connect the nodes, and also has arrow head markers, but I've taken these out and they don't appear to fix the issue.

@mbostock
Copy link
Member

mbostock commented Dec 9, 2015

I am planning on tackling this with the rewrite of the force layout for 4.0; related d3/d3-force#3.

@mbostock mbostock added the perf label Dec 9, 2015
@mbostock mbostock added this to the 4.0 milestone Dec 9, 2015
@mbostock
Copy link
Member

This has been fixed in 4.0’s d3-force thanks to the new, more stable velocity Verlet integration. See this example:

http://bl.ocks.org/mbostock/9a6d25c14e7bc5dc53de8215fc280669

Before at tick 5:

frame-0005

After at tick 5:

frame-0005

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants