cytoscape-expand-collapse
A Cytoscape.js extension to expand/collapse nodes for better management of complexity of compound graphs
https://github.com/ivis-at-bilkent/cytoscape.js-expand-collapse
Science Score: 75.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
✓CITATION.cff file
Found CITATION.cff file -
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
✓DOI references
Found 2 DOI reference(s) in README -
○Academic publication links
-
✓Committers with academic emails
3 of 15 committers (20.0%) from academic institutions -
✓Institutional organization owner
Organization ivis-at-bilkent has institutional domain (www.cs.bilkent.edu.tr) -
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (9.1%) to scientific vocabulary
Keywords
Keywords from Contributors
Repository
A Cytoscape.js extension to expand/collapse nodes for better management of complexity of compound graphs
Basic Info
Statistics
- Stars: 135
- Watchers: 9
- Forks: 41
- Open Issues: 32
- Releases: 15
Topics
Metadata Files
README.md
cytoscape-expand-collapse
We are in the process of developing a new unified framework for complexity management of graphs. Thus this repositoy is no longer being maintained
Description
This extension provides an interface to expand/collapse nodes and edges for better management of complexity of Cytoscape.js compound graphs, distributed under The MIT License.
Please cite the following paper when using this extension:
U. Dogrusoz , A. Karacelik, I. Safarli, H. Balci, L. Dervishi, and M.C. Siper, "Efficient methods and readily customizable libraries for managing complexity of large networks", PLoS ONE, 13(5): e0197238, 2018.
Demo
Here are some demos: no undo and with custom cue image, undoable, and collapsing edges and nodes, respectively:
API
- Note that compounds are nodes.
cy.expandCollapse(options)
To initialize the extension with given options.
var api = cy.expandCollapse('get')
To get the extension instance after initialization.
- Following functions get options parameter to apply during a particular event unlike the function above.
api.collapse(nodes, options)
Collapse given nodes, extend options with given param.
api.collapseRecursively(nodes, options)
Collapse given nodes recursively, extend options with given param.
api.collapseAll(options)
Collapse all nodes on graph (recursively), extend options with given param.
api.expand(nodes, options)
Expand given nodes, extend options with given param.
api.expandRecursively(nodes, options)
Expand given nodes recursively, extend options with given param.
api.expandAll(options)
Expand all nodes on graph (recursively), extend options with given param.
api.isExpandable(node)
Get whether node is expandable (or is collapsed)
api.isCollapsible(node)
Get whether node is collapsible.
api.expandableNodes(nodes)
Get expandable ones inside given nodes if nodes parameter is not specified consider all nodes
api.collapsibleNodes(nodes)
Get collapsible ones inside given nodes if nodes parameter is not specified consider all nodes
api.setOptions(options)
Resets the options to the given parameter.
api.setOption(name, value)
Sets the value of the option given by the name to the given value.
api.extendOptions(options)
Extend the current options with the given options.
api.getCollapsedChildren(node)
Get the children of the given collapsed node which are removed during collapse operation
api.getCollapsedChildrenRecursively(node)
Get collapsed children recursively including nested collapsed children. Returned value includes edges and nodes, use selector to get edges or nodes.
api.getAllCollapsedChildrenRecursively()
Get collapsed children of all collapsed nodes recursively. Returned value includes edges and nodes, use selector to get edges or nodes.
api.clearVisualCue()
Forces the visual cue to be cleared. It is to be called in extreme cases.
api.enableCue()
Enable rendering of visual cue.
api.disableCue()
Disable rendering of visual cue.
api.getParent(nodeId)
Get the parent of a node given its node id. Useful to reach parent of a node removed because of collapse operation.
api.collapseEdges(edges,options)
Collapse the given edges if all the given edges are between same two nodes and number of edges passed is at least 2. Does nothing otherwise.
api.expandEdges(edges){
Expand the given collapsed edges
api.collapseEdgesBetweenNodes(nodes, options)
Collapse all edges between the set of given nodes.
api.expandEdgesBetweenNodes(nodes)
Expand all collapsed edges between the set of given nodes
api.collapseAllEdges(options)
Collapse all edges in the graph.
api.expandAllEdges()
Expand all edges in the graph.
api.loadJson(jsonStr)
Load elements from JSON string.
api.saveJson(elems, filename)
Return elements in JSON format and saves them to a file if a file name is provided via filename parameter. Default value for elems is all the elements.
Events
Notice that following events are performed for each node that is collapsed/expanded. Also, notice that any post-processing layout is performed after the event.
cy.nodes().on("expandcollapse.beforecollapse", function(event) { var node = this; ... }) Triggered before a node is collapsed
cy.nodes().on("expandcollapse.aftercollapse", function(event) { var node = this; ... }) Triggered after a node is collapsed
cy.nodes().on("expandcollapse.beforeexpand", function(event) { var node = this; ... }) Triggered before a node is expanded
cy.nodes().on("expandcollapse.afterexpand", function(event) { var node = this; ... }) Triggered after a node is expanded
cy.edges().on("expandcollapse.beforecollapseedge", function(event) { var edge = this; ... }) Triggered before an edge is collapsed
cy.edges().on("expandcollapse.aftercollapseedge", function(event) { var edge = this; ... }) Triggered after an edge is collapsed
cy.edges().on("expandcollapse.beforeexpandedge", function(event) { var edge = this; ... }) Triggered before an edge is expanded
cy.edges().on("expandcollapse.afterexpandedge", function(event) { var edge = this; ... }) Triggered after an edge is expanded
All these events can also be listened as cytoscape.js core events e.g.
cy.on("expandcollapse.afterexpandedge", function(event) { var elem = event.target; ... })
Default Options
```javascript var options = { layoutBy: null, // to rearrange after expand/collapse. It's just layout options or whole layout function. Choose your side! // recommended usage: use cose-bilkent layout with randomize: false to preserve mental map upon expand/collapse fisheye: true, // whether to perform fisheye view after expand/collapse you can specify a function too animate: true, // whether to animate on drawing changes you can specify a function too animationDuration: 1000, // when animate is true, the duration in milliseconds of the animation ready: function () { }, // callback when expand/collapse initialized undoable: true, // and if undoRedoExtension exists,
cueEnabled: true, // Whether cues are enabled
expandCollapseCuePosition: 'top-left', // default cue position is top left you can specify a function per node too
expandCollapseCueSize: 12, // size of expand-collapse cue
expandCollapseCueLineSize: 8, // size of lines used for drawing plus-minus icons
expandCueImage: undefined, // image of expand icon if undefined draw regular expand cue
collapseCueImage: undefined, // image of collapse icon if undefined draw regular collapse cue
expandCollapseCueSensitivity: 1, // sensitivity of expand-collapse cues
edgeTypeInfo: "edgeType", // the name of the field that has the edge type, retrieved from edge.data(), can be a function, if reading the field returns undefined the collapsed edge type will be "unknown"
groupEdgesOfSameTypeOnCollapse : false, // if true, the edges to be collapsed will be grouped according to their types, and the created collapsed edges will have same type as their group. if false the collapased edge will have "unknown" type.
allowNestedEdgeCollapse: true, // when you want to collapse a compound edge (edge which contains other edges) and normal edge, should it collapse without expanding the compound first
zIndex: 999 // z-index value of the canvas in which cue ımages are drawn
};
```
Default Undo/Redo Actions
ur.do("collapse", { nodes: eles, options: opts) Equivalent of eles.collapse(opts)
ur.do("expand", { nodes: eles, options: opts) Equivalent of eles.expand(opts)
ur.do("collapseRecursively", { nodes: eles, options: opts) Equivalent of eles.collapseRecursively(opts)
ur.do("expandRecursively", { nodes: eles, options: opts) Equivalent of eles.expandRecursively(opts)
ur.do("collapseAll", { options: opts) Equivalent of cy.collapseAll(opts)
ur.do("expandAll", { options: opts }) Equivalent of cy.expandAll(opts)
ur.do("collapseEdges", { edges: eles, options: opts}) Equivalent of eles.collapseEdges(opts)
ur.do("expandEdges", { edges: eles}) Equivalent of eles.expandEdges()
ur.do("collapseEdgesBetweenNodes", { nodes: eles, options: opts}) Equivalent of eles.collapseEdgesBetweenNodes(opts)
ur.do("expandEdgesBetweenNodes", { nodes: eles}) Equivalent of eles.expandEdgesBetweenNodes()
ur.do("collapseAllEdges", {options: opts)} Equivalent of cy.collapseAllEdges(opts)
ur.do("expandAllEdges")Equivalent of cy.expandAllEdges()
Elements Style
- Collapsed nodes have 'cy-expand-collapse-collapsed-node' class.
- Meta edges (edges from/to collapsed nodes) have 'cy-expand-collapse-meta-edge' class.
- Collapsed edges have 'cy-expand-collapse-collapsed-edge' class.
- Collapsed edges data have 'directionType' field which can be either:
- 'unidirection' if all the edges that are collapsed into this edge have the same direction (all have same source and same target) or
- 'bidirection' if the edges that are collapsed into this edge have different direction (different target and/or source)
- Collapsed edges data have a field that holds the type, the field name is as defined in options but if it is not defined in options or was defined as a function it will be named 'edgeType'
Dependencies
- Cytoscape.js ^3.3.0
- cytoscape-undo-redo.js(optional) ^1.0.1
- cytoscape-cose-bilkent.js(optional/suggested for layout after expand/collapse) ^4.0.0
Usage instructions
Download the library:
* via npm: npm install cytoscape-expand-collapse,
* via bower: bower install cytoscape-expand-collapse, 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 expandCollapse = require('cytoscape-expand-collapse');
expandCollapse( cytoscape ); // register extension ```
AMD:
js
require(['cytoscape', 'cytoscape-expand-collapse'], function( cytoscape, expandCollapse ){
expandCollapse( cytoscape ); // register extension
});
Plain HTML/JS has the extension registered for you automatically, because no require() is needed.
Build targets
npm run build: Build./src/**intocytoscape-expand-collapse.jsin production environment and minimize the file.npm run build:dev: Build./src/**intocytoscape-expand-collapse.jsin development environment without minimizing the file.
Publishing instructions
This project is set up to automatically be published to npm and bower. To publish:
- Build the extension :
npm run build - Commit the build :
git commit -am "Build for release" - Bump the version number and tag:
npm version major|minor|patch - Push to origin:
git push && git push --tags - Publish to npm:
npm publish . - If publishing to bower for the first time, you'll need to run
bower register cytoscape-expand-collapse https://github.com/iVis-at-Bilkent/cytoscape.js-expand-collapse.git
Team
- Hasan Balci, Yusuf Canbaz, Ugur Dogrusoz of i-Vis at Bilkent University and Metin Can Siper of the Demir Lab at OHSU
Alumni
Owner
- Name: i-Vis at Bilkent
- Login: iVis-at-Bilkent
- Kind: organization
- Website: http://www.cs.bilkent.edu.tr/~ivis/
- Twitter: iVisAtBilkent
- Repositories: 50
- Profile: https://github.com/iVis-at-Bilkent
i-Vis Research Lab at Bilkent University
Citation (CITATION.cff)
cff-version: 1.2.0
message: "If you use this software, please cite it as below."
authors:
- family-names: "Dogrusoz"
given-names: "Ugur"
orcid: "https://orcid.org/0000-0002-7153-0784"
- family-names: "Karacelik"
given-names: "Alper"
orcid: "https://orcid.org/0000-0000-0000-0000"
- family-names: "Safarli"
given-names: "Ilkin"
- family-names: "Balci"
given-names: "Hasan"
orcid: "https://orcid.org/0000-0001-8319-7758"
- family-names: "Dervishi"
given-names: "Leonard"
- family-names: "Siper"
given-names: "Metin Can"
title: "cytoscape-expand-collapse"
version: 4.1.0
date-released: 2021-06-16
url: "https://github.com/iVis-at-Bilkent/cytoscape.js-expand-collapse"
preferred-citation:
type: article
authors:
- family-names: "Dogrusoz"
given-names: "Ugur"
orcid: "https://orcid.org/0000-0002-7153-0784"
- family-names: "Karacelik"
given-names: "Alper"
orcid: "https://orcid.org/0000-0000-0000-0000"
- family-names: "Safarli"
given-names: "Ilkin"
- family-names: "Balci"
given-names: "Hasan"
orcid: "https://orcid.org/0000-0001-8319-7758"
- family-names: "Dervishi"
given-names: "Leonard"
- family-names: "Siper"
given-names: "Metin Can"
doi: "10.1371/journal.pone.0197238"
journal: "PLOS ONE"
month: 5
start: 1 # First page number
end: 18 # Last page number
title: "Efficient methods and readily customizable libraries for managing complexity of large networks"
issue: 5
volume: 13
year: 2018
GitHub Events
Total
- Issues event: 1
- Watch event: 11
- Issue comment event: 5
- Push event: 1
- Pull request event: 5
- Fork event: 8
Last Year
- Issues event: 1
- Watch event: 11
- Issue comment event: 5
- Push event: 1
- Pull request event: 5
- Fork event: 8
Committers
Last synced: almost 3 years ago
Top Committers
| Name | Commits | |
|---|---|---|
| metincansiper | m****r@g****m | 71 |
| Hasan Balcı | b****9@g****m | 43 |
| kinimesi | k****i@u****m | 32 |
| mrsfy | m****y@o****m | 30 |
| canbax | y****z@g****m | 28 |
| Nasim Saleh | n****h@g****m | 21 |
| ugurdogrusoz | u****z@g****m | 20 |
| Salih Altun | m****n@g****m | 11 |
| Matt | 1****r@u****m | 4 |
| kinimesi | i****i@s****r | 3 |
| Artem Kozlov | a****v@g****m | 3 |
| Ivan Tadeu Ferreira Antunes Filho | i****a@g****m | 2 |
| Salih Altun | s****n@u****r | 2 |
| Ahmed Fouzan | a****n@g****m | 1 |
| Metin Can Siper | s****m@r****u | 1 |
Committer Domains (Top 20 + Academic)
Issues and Pull Requests
Last synced: 6 months ago
All Time
- Total issues: 81
- Total pull requests: 25
- Average time to close issues: 4 months
- Average time to close pull requests: 3 months
- Total issue authors: 39
- Total pull request authors: 14
- Average comments per issue: 3.69
- Average comments per pull request: 1.64
- Merged pull requests: 12
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 2
- Pull requests: 3
- Average time to close issues: 9 days
- Average time to close pull requests: 7 days
- Issue authors: 2
- Pull request authors: 3
- Average comments per issue: 0.5
- Average comments per pull request: 0.67
- Merged pull requests: 1
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- ugurdogrusoz (10)
- Does666 (8)
- hasanbalci (6)
- utkarshagarwal01 (5)
- Alexithemia (4)
- celine3d (4)
- sashokbg (3)
- bensonnw (3)
- canbax (3)
- mafar (3)
- mkelly1495 (2)
- HochmanEyal (2)
- RosaRomeroGomez (2)
- denglouhen (1)
- asangalli (1)
Pull Request Authors
- sashokbg (5)
- hasanbalci (4)
- metincansiper (3)
- octojedi (2)
- itf (2)
- favorable-mutation (2)
- msalihaltun (2)
- kinimesi (1)
- asterixslashstar (1)
- ZissiTheBee (1)
- abeersaqib (1)
- ahmedfouzan (1)
- nr-nreddy (1)
- mohsom (1)
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 2
-
Total downloads:
- npm 24,734 last-month
- Total docker downloads: 47
-
Total dependent packages: 7
(may contain duplicates) -
Total dependent repositories: 42
(may contain duplicates) - Total versions: 76
- Total maintainers: 6
npmjs.org: cytoscape-expand-collapse
This extension provides an interface to expand-collapse nodes.
- Homepage: https://github.com/iVis-at-Bilkent/cytoscape.js-expand-collapse
- License: MIT
-
Latest release: 4.1.1
published over 1 year ago
Rankings
Maintainers (6)
bower.io: cytoscape-expand-collapse
This extension provides an interface to expand/collapse nodes.
- License: MIT
-
Latest release: v4.1.1
published over 1 year ago
Rankings
Dependencies
- 544 dependencies
- browserify ^11.2.0 development
- gulp ^3.9.0 development
- gulp-derequire ^3.0.0 development
- gulp-jshint ^1.11.2 development
- gulp-prompt ^0.1.2 development
- gulp-replace ^0.5.4 development
- gulp-shell ^0.5.0 development
- gulp-util ^3.0.6 development
- gulp-watch ^5.0.1 development
- jshint-stylish ^2.0.1 development
- node-notifier ^4.3.1 development
- run-sequence ^1.1.4 development
- vinyl-buffer ^1.0.1 development
- vinyl-source-stream ^1.1.2 development


