anvaka / VivaGraphJS

Graph drawing library for JavaScript
Other
3.73k stars 423 forks source link

Two networks, one graph, drift apart #45

Closed pahlers closed 11 years ago

pahlers commented 11 years ago

First of all, you made a very nice library to work with graphs. I also experienced with d3, but this library is much more easy. Well done!

I'm working on a project where we have more than one networks in a graph. When that happens the networks drifting away out of sight.

What I tried is turned off the gravity to 0. The graphs are standing still, but when you move a node the nodes act "dead" as expected.

Are there better options I can use?

anvaka commented 11 years ago

Yep, you could use pinning. Here is a demo: https://github.com/anvaka/VivaGraphJS/blob/master/demos/other/pinNode.html

pahlers commented 11 years ago

Thanks for your suggestion.

In my second attempt to solve this puzzle I used isPinned in combination with Viva.Graph.community. Community to select the most important nodes and isPinned to pinned the node. But because I do this right after the initialisation the pinned nodes standing very close together. A bit to close to me.

It would be nice when there is a springLength room between the nodes just after initialisation. How can I do that?

jsFiddle example

vivagraph_good_result