jacomyal / sigma.js

A JavaScript library aimed at visualizing graphs of thousands of nodes and edges
https://www.sigmajs.org/
MIT License
11.23k stars 1.59k forks source link

Packed circles #320

Closed 1tylermitchell closed 2 years ago

1tylermitchell commented 10 years ago

Anyone working on a packed circles approach? I assume this would best fit as a custom renderer?

sheymann commented 10 years ago

What are packed circles?

1tylermitchell commented 10 years ago

I wasn't thinking of something as sophisticated as this D3 example: http://bl.ocks.org/mbostock/4063530 - but even just something that takes into account the radius of nodes (plus some padding setting maybe) and evenly distributes nodes within the camera. The use case is when just showing a bunch of nodes to the user, it helps to have them evenly distributed on the screen.

Any tip for how to do this with existing setup? I'd rather not have to run FA2 to get similar results, but will if I have to :)

1tylermitchell commented 10 years ago

I guess I really meant "bubble charts" (http://www-958.ibm.com/software/data/cognos/manyeyes/page/Bubble_Chart.html) .. though I picture something different when I hear that nowadays. A better discussion of options: http://stackoverflow.com/questions/13339615/packing-different-sized-circles-into-rectangle-d3-js

sheymann commented 10 years ago

I've coded a bubble chart layout two years ago for the older version of sigma.js, you'll find the code here:

https://gist.github.com/sheymann/5e82dcee62b0ea7486c2

Feel free to adapt it to Sigma v1! It should be straightforward! Notice that this code is a simplified force-directed layout. The layout aims at stopping automatically (see the global cooling section)

1tylermitchell commented 10 years ago

Exxxxxcellent! Stopping automatically is precisely what I'm after, thank you. So I could clone the FA2 plugin and tweak it with the above - does that sound right? Any tip on what has changed since v1 to what for? Taking a look now. - Looks like I'll have to learn the supervisor concept... hmm...

apitts commented 10 years ago

I'd also be very interested in seeing automatic stopping added to the new FA2 plug-in. Suspect it is not super straightforward though.

sheymann commented 10 years ago

The FA2 stopping condition is a research topic on its own!

I've come with an unoptimized solution that sums up the distance run by each node at each iteration, and to stop the layout if that sum < threshold. However in many cases the layout stops too early due to a local minima, so I also consider a relaxation parameter to stop the layout only if the above condition has been reached X times. But this approach doesn't completely prevent us to stop due to a local minima.

The most important hypothesis behind is that the sum of nodes distance at each iteration roughly converges, but we also have to deal with the case when it doesn't converge and nodes oscillate. This approach can be applied to any force-directed layouts, but there may be other approaches we can build based solely on the study of the FA2 itself.

paper: http://www.plosone.org/article/info:doi/10.1371/journal.pone.0098679

apitts commented 10 years ago

Fascinating. Thanks for sharing the paper! My first thought was simulated annealing but I see you have already considered that.

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.