jacomyal / sigma.js

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

Modularity #82

Closed johnbyron closed 2 years ago

johnbyron commented 11 years ago

It would be awesome to have a modularity algorithm implemented in sigma.js to color the nodes, highlighting the different communities composing the graph. Is someone working on this? :)

alx commented 11 years ago

I'd also really like this kind of feature, probably in a form of a plugin.

I'm currently generating a gexf file with a custom "viz:color" for each node.

alx commented 11 years ago

Here is a first try to colorize a graph node using a the topic on the node (this topic attribute is defined in the gexf file):

https://gist.github.com/alx/5337474

You'll need d3js to get the color array. I've limited the number of possible colors, but if you remove the condition on line 40, you can get colors for every clusters.

Have fun :)

Alex

johnbyron commented 11 years ago

That's a very interesting work! Have you ever thought of assigning a color to each node depending on its x-y position? In this way, nodes which are clustered together would have almost the same color.

alx commented 11 years ago

Thanks :)

I've got an updated version of the code where it's making a ranked topic array, so clusters containing most nodes will be colorized first.

Because you're launching this plugin once the graph is made, it should also be possible to attribute colors depending on nodes position.

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.