use CoSE layout method

467 views
Skip to first unread message

sl yls

unread,
Nov 12, 2013, 4:48:33 PM11/12/13
to cytoscap...@googlegroups.com
Hi, I can not use cy.layout({ name: 'CoSE' }), I was told there is no CoSE in cytoscape.min.js.
Even I try to use the same method suggested by the cytoscape js tutorial, it's still not working.

options = {
    // Number of iterations between consecutive screen positions update (0 -> only updated on the end)
    refresh             : 0,
    // Whether to fit the network view after when done
    fit                 : true, 
    // Whether to randomize node positions on the beginning
    randomize           : true,
    // Whether to use the JS console to print debug messages
    debug               : false,

    // Node repulsion (non overlapping) multiplier
    nodeRepulsion       : 10000,
    // Node repulsion (overlapping) multiplier
    nodeOverlap         : 10,
    // Ideal edge (non nested) length
    idealEdgeLength     : 10,
    // Divisor to compute edge forces
    edgeElasticity      : 100,
    // Nesting factor (multiplier) to compute ideal edge length for nested edges
    nestingFactor       : 5, 
    // Gravity force (constant)
    gravity             : 250, 

    // Maximum number of iterations to perform
    numIter             : 100,
    // Initial temperature (maximum node displacement)
    initialTemp         : 200,
    // Cooling factor (how the temperature is reduced between consecutive iterations)
    coolingFactor       : 0.95, 
    // Lower temperature threshold (below this point the layout will end)
    minTemp             : 1
};

cy.layout( options );

Is there anyone who knows how to use this layout for the new version? Thanks.  

Max Franz

unread,
Nov 14, 2013, 12:05:38 PM11/14/13
to cytoscap...@googlegroups.com
As indicated in the docs (http://cytoscape.github.io/cytoscape.js/#core/visuals/cy.layout), you must include `options.name` to indicate which layout you want to run.  Otherwise, nothing is run on account of nothing being specified.

Unfortunately, that example does not include the `name` field.  Additionally, I tried both `cy.layout({ name: ‘cose' })` and `cy.layout({ name: ‘CoSE' })`, and both worked.  However, ‘CoSE’ did print an error message in the console, though the layout worked just the same — both using the minified and unminified options of the debug page.

You should use `cose` lowercase, and the docs have been updated as such.  The change will be visible when Github loads the page changes.

-M
--
You received this message because you are subscribed to the Google Groups "cytoscape-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cytoscape-disc...@googlegroups.com.
To post to this group, send email to cytoscap...@googlegroups.com.
Visit this group at http://groups.google.com/group/cytoscape-discuss.
For more options, visit https://groups.google.com/groups/opt_out.

Reply all
Reply to author
Forward
0 new messages