cytoscape-edge-editing

A Cytoscape.js extension enabling interactive editing of edge anchor (bend or control) points

https://github.com/ivis-at-bilkent/cytoscape.js-edge-editing

Science Score: 65.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
  • Academic email domains
  • Institutional organization owner
    Organization ivis-at-bilkent has institutional domain (www.cs.bilkent.edu.tr)
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (12.2%) to scientific vocabulary

Keywords

cytoscapejs cytoscapejs-extension diagramming editor graph-drawing network-visualization
Last synced: 6 months ago · JSON representation ·

Repository

A Cytoscape.js extension enabling interactive editing of edge anchor (bend or control) points

Basic Info
  • Host: GitHub
  • Owner: iVis-at-Bilkent
  • License: mit
  • Language: JavaScript
  • Default Branch: master
  • Homepage:
  • Size: 3.17 MB
Statistics
  • Stars: 44
  • Watchers: 11
  • Forks: 23
  • Open Issues: 6
  • Releases: 11
Topics
cytoscapejs cytoscapejs-extension diagramming editor graph-drawing network-visualization
Created over 9 years ago · Last pushed over 1 year ago
Metadata Files
Readme License Citation

README.md

cytoscape-edge-editing

Description

A Cytoscape.js extension enabling interactive editing of edge bend and control points for segment and unbundled bezier edges, respectively. It also allows for reconnection of edges to other source/target nodes. The extension is distributed under The MIT License. * The term 'anchor' will be used here and in the code to refer to bend and control points collectively. * To highlight anchor positions of an edge you should select the edge and unselect any other edges. Note that in determining the edge to highlight the anchor positions we assume that the unvisible edges are not selected. * To add an anchor select the edge and unselect any other edge, right click where you want to add the anchor and click 'Add Bend Point' or 'Add Control Point' on the context menu (requires 'cytoscape.js-context-menus' extension). The context menu will distiguish between the edges and it will not be possible to a bend point on an unbundled bezier edge and vice versa. * Bend points or control points can be added to edges which are not of type segments or unbundled bezier. The edge will then become segemetns or unbundled bezier accordingly. * To remove an anchor select the edge and unselect any other edge, right click on the anchor and click 'Remove Bend Point' or 'Remove Control Point' on the context menu (requires 'cytoscape.js-context-menus' extension). * To move an anchor drag and drop it when the edge is the only selected edge. * Alternatively, * You can click anywhere on the edge (if it is the only selected edge) to introduce and relocate an anchor by dragging. * A bend point is removed if it is dropped near the line segment between its two neighbours. * Drag and drop can also be used to quickly create and drag an anchor on a highlighted edge. The anchor type will be decided based on the edge type. This will not work with edges which are not segments or unbundled bezier. * To reconnect an edge, select the handle (source or target), drag and drop on the new (source or target) node.

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.

Here is a demo:

Dependencies

  • Cytoscape.js ^3.3.0
  • Konva ^7.0.3
  • cytoscape-undo-redo.js(optional) ^1.0.1
  • cytoscape-context-menus.js(optional) ^2.0.0

Usage instructions

Download the library: * via npm: npm install cytoscape-edge-editing, * via bower: bower install cytoscape-edge-editing, 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 konva = require('konva'); var edgeEditing = require('cytoscape-edge-editing');

edgeEditing( cytoscape, konva ); // register extension ```

AMD: js require(['cytoscape', 'cytoscape-edge-editing', 'konva'], function( cytoscape, edge-editing, konva ){ edge-editing( cytoscape, konva ); // register extension });

Plain HTML/JS has the extension registered for you automatically, because no require() is needed.

API

js var instance = cy.edgeEditing( options );

An instance has a number of functions available:

js /* * Get anchors of the given edge in an array A, * A[2 * i] is the x coordinate and A[2 * i + 1] is the y coordinate * of the ith anchor. (Returns undefined if the curve style is not segments nor unbundled bezier) */ instance.getAnchorsAsArray(ele); // Initilize anchors for the given edges using 'options.bendPositionsFunction' and 'options.controlPositionsFunction' instance.initAnchorPoints(eles); // Removes anchor with some index from an edge instance.deleteSelectedAnchor(ele, index); // Get type of an edge as `bend`, `control` or `none` instance.getEdgeType(ele);

You can also get an existing instance:

js cy.edgeEditing('get'); // Returns undefined if the extension is not initialized yet

Or you can check if the extension is initilized before js cy.edgeEditing('initialized');

Default Options

js var options = { // A function parameter to get bend point positions, should return positions of bend points bendPositionsFunction: function(ele) { return ele.data('bendPointPositions'); }, // Return true to draw rounded corners for the bend points. Requires Cytoscape^3.29.0 bendCornersIsRoundFunction: function(ele) { return false; }, // A function parameter to get control point positions, should return positions of control points controlPositionsFunction: function(ele) { return ele.data('controlPointPositions'); }, // A function parameter to set bend point positions bendPointPositionsSetterFunction: function(ele, bendPointPositions) { ele.data('bendPointPositions', bendPointPositions); }, // A function parameter to set bend point positions controlPointPositionsSetterFunction: function(ele, controlPointPositions) { ele.data('controlPointPositions', controlPointPositions); }, // whether to initilize bend and control points on creation of this extension automatically initAnchorsAutomatically: true, // the classes of those edges that should be ignored ignoredClasses: [], // whether the bend editing operations are undoable (requires cytoscape-undo-redo.js) undoable: false, // the size of bend and control point shape is obtained by multipling width of edge with this parameter anchorShapeSizeFactor: 3, // z-index value of the canvas in which bend points are drawn zIndex: 999, /*An option that controls the distance (in pixels) within which a bend point is considered near the line segment between its two neighbors and will be automatically removed min value = 0 , max value = 20 , values less than 0 are set to 0 and values greater than 20 are set to 20 */ bendRemovalSensitivity : 8, // to not show a menu item, pass `false` for corresponding menu item title. Below are 6 menu item titles. // title of add bend point menu item (User may need to adjust width of menu items according to length of this option) addBendMenuItemTitle: "Add Bend Point", // title of remove bend point menu item (User may need to adjust width of menu items according to length of this option) removeBendMenuItemTitle: "Remove Bend Point", // title of remove all bend points menu item removeAllBendMenuItemTitle: "Remove All Bend Points", // title of add control point menu item (User may need to adjust width of menu items according to length of this option) addControlMenuItemTitle: "Add Control Point", // title of remove control point menu item (User may need to adjust width of menu items according to length of this option) removeControlMenuItemTitle: "Remove Control Point", // title of remove all control points menu item removeAllControlMenuItemTitle: "Remove All Control Points", // whether the bend and control points can be moved by arrows moveSelectedAnchorsOnKeyEvents: function () { return true; }, // Can be a function or boolean. If `false`, edge reconnection won't be active. If `true`, connects edge to its new source/target as usual. // If a function is given, the function will be called with parameters: newSource.id(), newTarget.id(), edge.data(), location handleReconnectEdge: true, // Can be `false` or `true`. If `false`, it won't interact with anchors (control and bend points). If `false`, it won't show any context menu items as well. handleAnchors: true, // this function checks validation of the edge and its new source/target validateEdge: function (edge, newSource, newTarget) { return 'valid'; }, // this function is called with reconnected edge if reconnected edge is not valid according to `validateEdge` function actOnUnsuccessfulReconnection: undefined, // specifically for edge-editing menu items, whether trailing dividers should be used useTrailingDividersAfterContextMenuOptions: false, // Enable / disable drag creation of anchor points when there is at least one anchor already on the edge enableCreateAnchorOnDrag: true, // size of anchor point can be auto changed to compensate the impact of zoom enableFixedAnchorSize: false, // automatically remove anchor (bend point) if its previous segment and next segment is almost in a same line enableRemoveAnchorMidOfNearLine: true, // edge reconnection handles can be shown with select or hover events isShowHandleOnHover: false, anchorColor: '#000000', // default anchor color is black endPointColor: '#000000' // default endpoint color is black };

Build targets

  • npm run build : Build ./src/** into cytoscape-edge-editing.js in production environment and minimize the file.
  • npm run build:dev : Build ./src/** into cytoscape-edge-editing.js in development environment without minimizing the file.

Publishing instructions

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

  1. Build the extension : npm run build
  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-edge-editing https://github.com/iVis-at-Bilkent/cytoscape.js-edge-editing.git

Team

Alumni

Owner

  • Name: i-Vis at Bilkent
  • Login: iVis-at-Bilkent
  • Kind: organization

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-edge-editing"
version: 4.0.0
date-released: 2021-06-16
url: "https://github.com/iVis-at-Bilkent/cytoscape.js-edge-editing"
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
  • Watch event: 2
Last Year
  • Watch event: 2

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 60
  • Total pull requests: 18
  • Average time to close issues: 3 months
  • Average time to close pull requests: about 1 month
  • Total issue authors: 29
  • Total pull request authors: 10
  • Average comments per issue: 3.2
  • Average comments per pull request: 1.28
  • Merged pull requests: 9
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 2
  • Average time to close issues: N/A
  • Average time to close pull requests: less than a minute
  • Issue authors: 0
  • Pull request authors: 1
  • Average comments per issue: 0
  • Average comments per pull request: 0.0
  • Merged pull requests: 2
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • ugurdogrusoz (8)
  • hasanbalci (7)
  • msalihaltun (6)
  • metincansiper (5)
  • Hoogkamer (3)
  • arthabus (2)
  • karchjd (2)
  • canbax (2)
  • kunalganglani (2)
  • nikhilkharbas (2)
  • gledis69 (2)
  • leolumicrosoft (1)
  • rkdover (1)
  • maxkfranz (1)
  • limexp (1)
Pull Request Authors
  • hasanbalci (6)
  • leolumicrosoft (3)
  • Hoogkamer (3)
  • aleneum (2)
  • msalihaltun (2)
  • Jaskaranbir (1)
  • nasimsaleh (1)
  • Flui (1)
  • AsmaJodeiri (1)
  • gledis69 (1)
Top Labels
Issue Labels
bug (11) Low (5) enhancement (3) wontfix (2) feature (2) High (1) Critical (1)
Pull Request Labels

Packages

  • Total packages: 2
  • Total downloads:
    • npm 4,208 last-month
  • Total dependent packages: 4
    (may contain duplicates)
  • Total dependent repositories: 19
    (may contain duplicates)
  • Total versions: 40
  • Total maintainers: 1
npmjs.org: cytoscape-edge-editing

A Cytoscape.js extension that enables editing edges by adding and modifying anchor points

  • Versions: 7
  • Dependent Packages: 4
  • Dependent Repositories: 19
  • Downloads: 4,208 Last month
Rankings
Dependent repos count: 2.8%
Dependent packages count: 4.5%
Average: 4.9%
Forks count: 5.1%
Downloads: 5.6%
Stargazers count: 6.6%
Maintainers (1)
Last synced: 6 months ago
bower.io: cytoscape-edge-editing

A Cytoscape.js extension enables editing edge bend points

  • License: MIT
  • Latest release: v5.0.0
    published over 1 year ago
  • Versions: 33
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent packages count: 5.1%
Forks count: 10.9%
Stargazers count: 14.0%
Average: 16.9%
Dependent repos count: 37.5%
Last synced: 6 months ago

Dependencies

bower.json bower
  • cytoscape ^2.7.0
package-lock.json npm
  • 244 dependencies
package.json npm
  • babel-core ^6.26.3 development
  • babel-loader ^7.1.5 development
  • babel-preset-env ^1.7.0 development
  • camelcase ^6.0.0 development
  • cross-env ^7.0.2 development
  • webpack ^5.36.1 development
  • webpack-cli ^4.6.0 development