Skip to content

Is it possible to add/remove nodes and links during simulation? #40

Answered by Stukova
cyremur asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @cyremur! Incremental addition of nodes and links is not supported in Cosmos due to WebGL/GPU limitations.
For nodes and links, Cosmos creates a new texture for each to store data, similar to an array in JS. But unlike an array in JS, a texture cannot be resized dynamically. So to add a new node/link, Cosmos naturally need to create a new texture with a new size. In other words, initialise new data.

You can reproduce the incremental behaviour by initialising new nodes/links with setData method as you did in your example. You can also initialise the position (x and y) for each node. In this way, you can get the current position of the nodes (with getNodePositionMap method) and use them …

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by rokotyan
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
question Further information is requested
2 participants
Converted from issue

This discussion was converted from issue #38 on March 10, 2023 04:58.