https://github.com/cytoscape/cytoscape.js-spread

The speedy Spread physics simulation layout for Cytoscape.js

https://github.com/cytoscape/cytoscape.js-spread

Science Score: 20.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
  • .zenodo.json file
  • DOI references
  • Academic publication links
    Links to: zenodo.org
  • Committers with academic emails
    1 of 3 committers (33.3%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (10.4%) to scientific vocabulary

Keywords

cytoscapejs cytoscapejs-extension

Keywords from Contributors

graph-theory visualisation
Last synced: 11 months ago · JSON representation

Repository

The speedy Spread physics simulation layout for Cytoscape.js

Basic Info
  • Host: GitHub
  • Owner: cytoscape
  • License: mit
  • Language: JavaScript
  • Default Branch: master
  • Homepage:
  • Size: 12.3 MB
Statistics
  • Stars: 27
  • Watchers: 17
  • Forks: 20
  • Open Issues: 1
  • Releases: 0
Topics
cytoscapejs cytoscapejs-extension
Created almost 11 years ago · Last pushed over 3 years ago
Metadata Files
Readme License

README.md

cytoscape-spread

DOI

Description

The Spread physics simulation layout for Cytoscape.js (demo) (proteins demo)

The spread layout uses a force-directed physics simulation with several external libraries. The layout tries to keep elements spread out evenly, making good use of constrained space.

The layout makes use of CoSE (MIT) and rhill-voronoi-core.js (MIT). CoSE is already bundled in Cytoscape.js, and rhill-voronoi-core.js is bundled in cytoscape-spread.

There are two phases to this layout:

(1) A force-directed layout provides initial positions for the nodes. By default, the embedded version of CoSE is used, because it is fast and because it does not increase your app's bundle size any more than using Cytoscape.js itself. You can use an alternative layout by specifying options.prelayout with the layout options you want to use for the first phase (e.g. { name: 'grid' }). Alternatively, you can specify options.prelayout: false (falsey) to just use the node's existing positions for the first phase.

(2) Voronoi is used to spread out the nodes in the remaining space.

Note that since you are composing layouts with phase (1), where options.prelayout is non-falsey, you will have more layout events. For example, you will have more than one layoutstop event -- one for the Spread layout overall and one for the prelayout within phase (1) of Spread.

If you skip phase (1) with options.prelayout falsey, you will not get extra events within Spread. You can use promise chaining with two layouts to get the same effect as running a layout in phase (1), i.e.:

```js var layout1 = cy.makeLayout({ name: 'cose' }); var layout2 = cy.makeLayout({ name: 'spread', prelayout: false });

var run = function(l){ var p = l.promiseOn('layoutstop');

l.run();

return p; };

( Promise.resolve() .then(function(){ return run(layout1); }) .then(function(){ return run(layout2); }) .then(function(){ console.log('done 1 and 2') }) ); ```

Dependencies

  • Cytoscape.js ^3.0.0
  • Weaver.js ^1.2.0

Usage instructions

Download the library: * via npm: npm install cytoscape-spread, * via bower: bower install cytoscape-spread, or * via direct download in the repository (probably from a tag).

require() the library as appropriate for your project:

CommonJS: ```js var cytoscape = require('cytoscape'); var spread = require('cytoscape-spread');

spread( cytoscape ); // register extension ```

AMD: js require(['cytoscape', 'cytoscape-spread', 'weaverjs'], function( cytoscape, spread, weaver ){ spread( cytoscape, weaver ); // register extension });

Plain HTML/JS has the extension registered for you automatically, because no require() is needed. However, the weaverjs library must be included as well.

API

Call the layout, e.g. cy.layout({ name: 'spread', ... }), with options:

js var defaults = { animate: true, // Whether to show the layout as it's running ready: undefined, // Callback on layoutready stop: undefined, // Callback on layoutstop fit: true, // Reset viewport to fit default simulationBounds minDist: 20, // Minimum distance between nodes padding: 20, // Padding expandingFactor: -1.0, // If the network does not satisfy the minDist // criterium then it expands the network of this amount // If it is set to -1.0 the amount of expansion is automatically // calculated based on the minDist, the aspect ratio and the // number of nodes prelayout: { name: 'cose' }, // Layout options for the first phase maxExpandIterations: 4, // Maximum number of expanding iterations boundingBox: undefined, // Constrain layout bounds; { x1, y1, x2, y2 } or { x1, y1, w, h } randomize: false // Uses random initial node positions on true };

Build targets

  • npm run test : Run Mocha tests in ./test
  • npm run build : Build ./src/** into cytoscape-spread.js
  • npm run watch : Automatically rebuild on source changes
  • npm run lint : Run eslint on the source

N.b. all builds use babel, so modern ES features can be used in the src.

Publishing instructions

This project is set up to automatically be published to npm and bower. To publish:

  1. Build the extension : npm run build:release
  2. Commit the build : git commit -am "Build for release"
  3. Bump the version number and tag: npm version major|minor|patch
  4. Push to origin: git push && git push --tags
  5. Publish to npm: npm publish .
  6. If publishing to bower for the first time, you'll need to run bower register cytoscape-spread https://github.com/cytoscape/cytoscape.js-spread.git
  7. Make a new release for Zenodo.

Owner

  • Name: Cytoscape Consortium
  • Login: cytoscape
  • Kind: organization

GitHub Events

Total
  • Watch event: 3
Last Year
  • Watch event: 3

Committers

Last synced: 11 months ago

All Time
  • Total Commits: 59
  • Total Committers: 3
  • Avg Commits per committer: 19.667
  • Development Distribution Score (DDS): 0.203
Past Year
  • Commits: 0
  • Committers: 0
  • Avg Commits per committer: 0.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
Max Franz m****z@g****m 47
Manfred Cheung m****n@u****a 10
Alexander Li a****0@g****m 2
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 11 months ago

All Time
  • Total issues: 9
  • Total pull requests: 3
  • Average time to close issues: 9 months
  • Average time to close pull requests: 8 months
  • Total issue authors: 7
  • Total pull request authors: 3
  • Average comments per issue: 1.56
  • Average comments per pull request: 1.67
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 1
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • maxkfranz (3)
  • ling1726 (1)
  • kchima (1)
  • Marianna1989 (1)
  • michaelhappycheng (1)
  • adroslice (1)
  • taurenshaman (1)
Pull Request Authors
  • obender (1)
  • michaelhappycheng (1)
  • dependabot[bot] (1)
Top Labels
Issue Labels
stale (2) bug (2) enhancement (1)
Pull Request Labels
dependencies (1) stale (1)

Packages

  • Total packages: 3
  • Total downloads:
    • npm 10,943 last-month
  • Total docker downloads: 35
  • Total dependent packages: 20
    (may contain duplicates)
  • Total dependent repositories: 119
    (may contain duplicates)
  • Total versions: 35
  • Total maintainers: 5
npmjs.org: cytoscape-spread

The Spread physics simulation layout for Cytoscape.js

  • Versions: 17
  • Dependent Packages: 16
  • Dependent Repositories: 99
  • Downloads: 10,943 Last month
Rankings
Dependent packages count: 1.4%
Dependent repos count: 1.4%
Downloads: 1.6%
Average: 3.4%
Forks count: 5.4%
Stargazers count: 7.4%
Last synced: 11 months ago
repo1.maven.org: org.webjars.npm:cytoscape-spread

WebJar for cytoscape-spread

  • Versions: 1
  • Dependent Packages: 4
  • Dependent Repositories: 19
  • Docker Downloads: 35
Rankings
Dependent repos count: 5.5%
Average: 9.7%
Dependent packages count: 13.9%
Last synced: 11 months ago
bower.io: cytoscape-spread

The Spread physics simulation layout for Cytoscape.js

  • License: MIT
  • Latest release: v3.0.0
    published about 8 years ago
  • Versions: 17
  • Dependent Packages: 0
  • Dependent Repositories: 1
Rankings
Dependent packages count: 6.0%
Forks count: 12.0%
Average: 13.7%
Stargazers count: 16.6%
Dependent repos count: 20.1%
Last synced: 11 months ago

Dependencies

bower.json bower
  • cytoscape ^2.5.0 || ^3.0.0
package-lock.json npm
  • 997 dependencies
package.json npm
  • cpy-cli ^1.0.1 development
  • cross-env ^5.1.6 development
  • eslint ^3.19.0 development
  • gh-pages ^1.1.0 development
  • npm-run-all ^4.1.2 development
  • rimraf ^2.6.2 development
  • update ^0.7.4 development
  • updater-license ^1.0.0 development
  • webpack ^2.7.0 development
  • webpack-dev-server ^2.11.2 development
  • weaverjs ^1.2.0