almende / vis

⚠️ This project is not maintained anymore! Please go to https://github.com/visjs
7.85k stars 1.48k forks source link

Network: Auto stablize all node on initial draw #1139

Closed abcbaby closed 9 years ago

abcbaby commented 9 years ago

Let say I have a large number of nodes, let say 500+, when I initially draw the network, all the nodes are pushed from the center and outward to stabilize. This can consume lots of time for all the nodes to settle. Is there a way to auto spread them out by default? I have tried to play around w/ the physics which helps a little. But wanted a better way to randomly spread the node out when I draw.

AlexDM0 commented 9 years ago

Hi,

Apart from you manually setting the x y coordinates, no. There are mechanisms like storePositions that help you store the positions after they have been calculated once. This can be used to quickly load the page the second time.

Regards

abcbaby commented 9 years ago

What's interesting is, in my network I have some feature where you can also change the layout to different hierarchical layout. On initial load, if I do not set any layout and then select a hierarchical layout, such as "UD", and then change back to default, all the nodes will settle. Which is much faster. It's a workaround, but why is that?

AlexDM0 commented 9 years ago

Because the initial positioning scheme is different for hierarchical and normal. The hierarchical layout engine gives the nodes positions. For certain networks that could be a good start.

The normal initial position is just in a circle. This could be improved but we do not have the manpower do this soon. It is on my wishlist of things to do though.

Implementing the Kamada–Kawai algorithm could be fun and a great improvement.

Regards

abcbaby commented 9 years ago

Thanks, it's good to know more how these works.