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

Layouts should not mutate data. #62

Open
mbostock opened this issue Oct 27, 2016 · 1 comment
Open

Layouts should not mutate data. #62

mbostock opened this issue Oct 27, 2016 · 1 comment
Assignees
Milestone

Comments

@mbostock
Copy link
Member

This will be a breaking change, but I think we really want hierarchy layouts to be immutable—to return a copy of the hierarchy with the layout’s computed coordinates applied, rather than setting the computed coordinates directly on the input hierarchy. Given that the semantics of node.copy are already defined, this should not be difficult to do. It shouldn’t be hard to implement resquarify, since it can read the input node._squarify and set the output node._squarify.

Probably this means that node.sum and node.sort should return copies of the hierarchy, too, making everything immutable.

@jacobp100
Copy link

Just a note on this, we're doing layouts on 250,000 nodes. If this was immutable, it would add a lot of GC and memory overhead

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