Good morning,
just starting with the awesome d3js library ...
I want to show only a portion of a graph with the force directed layout. The idea is to have one no
This isn't implemented in D3, and I'm not aware of any examples. What you would have to do is the following:
fixed
attribute of the new center node to true to prevent the force layout from changing its position.px
and py
attributes of that same node to the center position.The trickiest part here is the computation of the path from each node to the new center, but even this is a pretty standard algorithmic problem. Another thing to keep in mind is that you need to modify the data structures that contain the nodes and links of the force layout in place, i.e. you can't set new nodes and links for the force layout and expect everything to work smoothly.