You can scroll through the array of nodes and set the .x / .y and .px / .py values ββto the original position where you want the nodes to be, and thereby limit the amount they need to move to their original layout. If you turn off the directivity algorithm (the tick () function), you can apply the standard .transtion () behavior. Duration (500) .attr ("transform", xx) to nodes and links to make them animated in the way you prefer before or after running the algorithm with a forced orientation, but make sure you set the .x / .y and .px / .py to their final position, otherwise they will reset as soon as you .tick ()
source share