tgdwyer / WebCola

Javascript constraint-based graph layout
http://marvl.infotech.monash.edu/webcola/
MIT License
2.02k stars 258 forks source link

Clustering of connected nodes in WebCola ? #105

Closed AjitPS closed 9 years ago

AjitPS commented 9 years ago

Hi, Are there any examples/ code of a network graph using Cola layout with clustering, i.e., multiple nodes connected to one node being clustered around it, without using D3.js ? I am attempting to use the Cola layout with Cytoscape.js but my graph does not show clustering of the nodes.

AjitPS commented 9 years ago

My Cola layout code for usage in cytoscapeJS is below:

   var networkLayout= {
    name: 'cola', // WebCola layout
    fit: true, 
    animate: true, 
    padding: 30, 
    boundingBox: undefined, 
    randomize: false, 
    handleDisconnected: true, 
    refresh: 0.5,
    ungrabifyWhileSimulating: false, 
    ready: function() {}, 
    stop: function() {},
    avoidOverlap: true,
    nodeSpacing: 20,
    infinite: false
   };

I then use this layout while initializing my cytoscapeJS graph.

AjitPS commented 9 years ago

Any suggestions ?

tgdwyer commented 9 years ago

Hmm, no all of the cluster examples that I've built have used d3, although they use a pretty simple mapping of cola's "rectangle" object to svg rectangles, e.g. http://marvl.infotech.monash.edu/webcola/examples/smallgroups.html

Sorry, I'm not familiar with cytoscape's API to access webcola. Maybe @maxkfranz can help?

AjitPS commented 9 years ago

@tgdwyer Thanks for your reply. I've fixed the issue by reducing the sizes of the nodes and also by executing the cola layout on only the visible (unhidden) nodes & edges in my cytoscapeJS graph rather than on all the graph elements. That seems to have resolved the clustering issue.