force-graph icon indicating copy to clipboard operation
force-graph copied to clipboard

Redirecting links

Open Alexithemia opened this issue 3 years ago • 1 comments

Is your feature request related to a problem? Please describe. In my implementation, I am clustering nodes together and redirecting links to different nodes for temporary references. The only way to get the links to redraw in this situation is to send the links and nodes to the graph and redraw the entire thing. In your 3D implementation I can just run refreshGraph and the links would show up correctly and not require a rebuild.

Main issue is that doing the rebuild resets the camera position and when there is a lot of data, the rebuild could take some time and cause slowdowns.

Describe the solution you'd like An implementation like refreshGraph for 2D, or the redrawing that is constantly occurring to detect source and target changes of links.

Describe alternatives you've considered I have tried storing the camera position and reverting to it after the rebuild and while that works, the camera does skip around during this, and this does not fix the processing the rebuild takes.

Additional context I am basically just changing the target and source of the links while storing the original target or source to switch back to later.

Alexithemia avatar Jan 06 '21 16:01 Alexithemia

Hi @Alexithemia!

I'm not sure I'm totally following. If something in your data topology changes, all you should have to do is re-invoke

myGraph.graphData(<myData>)

At the following frame the data changes should be visible.

Also, this shouldn't at any point affect the viewport position, unless the graph is unmounted and re-initialised again. But you shouldn't really ever need to do that. Is that what you mean by rebuild?

vasturiano avatar Feb 07 '21 02:02 vasturiano