cytoscape.js | Graph theory library for visualisation

 by   cytoscape JavaScript Version: v3.25.0 License: MIT

kandi X-RAY | cytoscape.js Summary

kandi X-RAY | cytoscape.js Summary

cytoscape.js is a JavaScript library typically used in User Interface applications. cytoscape.js has no bugs, it has no vulnerabilities, it has a Permissive License and it has medium support. You can install using 'npm i try-cytoscape' or download it from GitHub, npm.

Cytoscape.js is a fully featured graph theory library. Do you need to model and/or visualise relational data, like biological data or social networks? If so, Cytoscape.js is just what you need. Cytoscape.js contains a graph theory model and an optional renderer to display interactive graphs. This library was designed to make it as easy as possible for programmers and scientists to use graph theory in their apps, whether it's for server-side analysis in a Node.js app or for a rich user interface.
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              cytoscape.js has a medium active ecosystem.
              It has 9140 star(s) with 1624 fork(s). There are 231 watchers for this library.
              There were 3 major release(s) in the last 12 months.
              There are 8 open issues and 2659 have been closed. On average issues are closed in 41 days. There are 1 open pull requests and 0 closed requests.
              It has a neutral sentiment in the developer community.
              The latest version of cytoscape.js is v3.25.0

            kandi-Quality Quality

              cytoscape.js has 0 bugs and 0 code smells.

            kandi-Security Security

              cytoscape.js has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
              cytoscape.js code analysis shows 0 unresolved vulnerabilities.
              There are 0 security hotspots that need review.

            kandi-License License

              cytoscape.js is licensed under the MIT License. This license is Permissive.
              Permissive licenses have the least restrictions, and you can use them in most projects.

            kandi-Reuse Reuse

              cytoscape.js releases are available to install and integrate.
              Deployable package is available in npm.
              Installation instructions, examples and code snippets are available.

            Top functions reviewed by kandi - BETA

            kandi's functional review helps you automatically verify the functionalities of the libraries and avoid rework.
            Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of cytoscape.js
            Get all kandi verified functions for this library.

            cytoscape.js Key Features

            No Key Features are available at this moment for cytoscape.js.

            cytoscape.js Examples and Code Snippets

            Usage cytoscape-popper extension in Angular 5
            Lines of Code : 4dot img1License : Strong Copyleft (CC BY-SA 4.0)
            copy iconCopy
            import * as cytoscape from 'cytoscape';
            import * as popper from 'cytoscape-popper';
            cytoscape.use( popper );
            
            cytoscape js multiline label - different css rule for second line
            Lines of Code : 153dot img2License : Strong Copyleft (CC BY-SA 4.0)
            copy iconCopy
            document.addEventListener("DOMContentLoaded", function() {
              var sampleDataset = [{
                group: "nodes",
                data: {
                  id: "16150999",
                  name: "xps plrmr",
                  type: 0,
                  code: "7704322293"
                },
                classes: "class1
            Hign CPU usage when using Angular5 + cytoscapeJS
            Lines of Code : 10dot img3License : Strong Copyleft (CC BY-SA 4.0)
            copy iconCopy
            export class MyComponent implements OnInit {
                constructor(private zone: NgZone) {}
                ngOnInit() {
                    this.zone.runOutsideAngular(() => {
                        // Initialize cytoscape
                        cytoscape({...});
                    });
                }
            }
            
            Multiple networks integrated into one network in Cytoscape
            Lines of Code : 72dot img4License : Strong Copyleft (CC BY-SA 4.0)
            copy iconCopy
            // Initialize cytoscape
            cy = window.cy = cytoscape({
               container: $('#diagram'),
               boxSelectionEnabled: false,
               autounselectify: true,
            
               layout: {
                  name: 'random'
               },
            
               elements: L,
            
               style: [
                {
                  selector: 'node',
            Cytoscape JS node thickness
            Lines of Code : 56dot img5License : Strong Copyleft (CC BY-SA 4.0)
            copy iconCopy
                // Initialize cytoscape
                cy = window.cy = cytoscape({
                    container: $('.cy'),
                    boxSelectionEnabled: false,
                    autounselectify: true,
                    layout: {
                        name: 'yourLayout'
                    },
                    style: [
                 

            Community Discussions

            QUESTION

            Cytoscape Integration with Neo4j
            Asked 2022-Jan-13 at 16:27

            I'm trying to build a webpage on which embed a visualization window for my local graph database. The graph database I'm using is Neo4j and for visualization I'm trying to use Cytoscape. Until now, I embedded a test graph in a webpage thanks to Cytoscape.js by putting some nodes and relationships directly in the JavaScript code. The only thing I still have problem with is the connection between Cytoscape and my local Neo4j Database. Which would be the best way to do this?

            ...

            ANSWER

            Answered 2022-Jan-13 at 16:27

            Typically, I answer Cytoscape desktop (not Cytoscape.js) questions, but I have built a web site (see https://spoke.rbvi.ucsf.edu) that does exactly what you are proposing. For a number of reasons, we implemented it with an intermediate REST interface so that we don't have to expose our Neo4J database. The REST interface does all of the queries and spits out cytoscape.js JSON formatted networks...

            -- scooter

            Source https://stackoverflow.com/questions/70686168

            QUESTION

            How to automatically change the width of a preview edge according to the zoom level in cytoscape.js-edgehandles?
            Asked 2022-Jan-12 at 14:23

            I am using cytoscape.js and the edgehandles extension (https://github.com/cytoscape/cytoscape.js-edgehandles). Currently I am automatically resizing the line width of my edge using the event 'zoom':

            ...

            ANSWER

            Answered 2022-Jan-12 at 14:23

            You can give a function for a style. The drawback is the functions are not JSON serializable. So If you need to import/export a graph with cy.json() you should also apply the function styles.

            Source https://stackoverflow.com/questions/70680388

            QUESTION

            Basic Grid Layout not Initializing or Running
            Asked 2022-Jan-03 at 18:17

            I'm trying to use cytoscape.js to display a graph on my page and I'm having a hard time just getting a basic instance to display properly.

            Code Breakdown:

            I get the graph elements via an AJAX call, pass the elements into the cytoscape constructor, and display the instance in a Bootstrap modal.

            Here's my JavaScript:

            ...

            ANSWER

            Answered 2022-Jan-03 at 18:17

            Ok, OP here. I think my problem is with Bootstrap.

            I started by noticing that I call $('#cyModal').modal('show'); after I've finished initializing the Cytoscape instance. I realized that before I call $('#cyModal').modal('show'); the div container for my Cytoscape instance has no size and is invisible. So I tried calling $('#cyModal').modal('show'); before initializing Cytoscape, but that still didn't work. Furthermore, I noticed that the modal wasn't actually showing until after Cytoscape initialized.

            Apparently, for this sort of thing, I need to wait for the Bootstrap modal to fire the 'shown' event before setting my Cytoscape layout to be sure that the div is visible and has a size. So I put my layout setter in a listener for shown.bs.modal:

            Source https://stackoverflow.com/questions/70568493

            QUESTION

            html input with cytoscape.js fails to open the dialog window
            Asked 2021-Nov-20 at 07:36

            I am building an interactive graph app where the user would upload a data file. The app would then build the graph from the input file.

            I am having problems with making the input work with the cytoscape . More specifically, the file dialog window does not pop up when I include the div. That is, the input button is not responsive unless I comment out the cytoscape .

            Please see the code below. I guess, this is not cytoscape specific. However, I could not get to the bottom of this, so I am posting the complete instance of the problem.

            ...

            ANSWER

            Answered 2021-Nov-20 at 07:36

            It's related with the z-index of the divs. In your case, because you don't assign z-indexes to the divs and add cy div at the end, it is rendered on top, so you cannot interact with the buttons.

            You can assign a z-index to cy div such as -1 to send it to the background:

            Source https://stackoverflow.com/questions/70032566

            QUESTION

            How to export a Cytoscape.js graph to image?
            Asked 2021-Sep-24 at 12:12

            I am learning Cytoscape.js. I successfully make a HTML file containing this basic graph. I try to export the graph to image using:

            ...

            ANSWER

            Answered 2021-Sep-24 at 12:12

            If you have the following (make sure the DOM is loaded before trying to query for elements):

            HTML:

            Source https://stackoverflow.com/questions/69304985

            QUESTION

            Cytoscape.js combine multiple edges into one (thicker) edge
            Asked 2021-Sep-07 at 08:09

            I'm using cytoscape.js 3.19.1 and I cannot figure out how to combine multiple edges into one, and have the weight increased of that one edge.

            Current view

            I am now looking for a solution where 2 edges get combined into one with a width of 2, 3 edges combined into one with a width of 3, etc.

            I am changing the color of the nodes with this code:

            ...

            ANSWER

            Answered 2021-Sep-07 at 08:09

            Actually, you might achieve this using some different styles on the edges. "haystack" or "straight" might be useful. Check them https://js.cytoscape.org/demos/edge-types/

            Or you might use https://github.com/iVis-at-Bilkent/cytoscape.js-expand-collapse

            Check its demo and collapse the edges.

            Source https://stackoverflow.com/questions/68995868

            QUESTION

            Is there a way to display a node label at the top inside the node?
            Asked 2021-Jun-30 at 03:05

            I am creating a graph using cytoscape.js and I have compounded nodes which are inside the parent node. I would like to have the title of the main/parent node at the top of the node but inside the node. Is that possible in cytoscape?

            I have tried using using halign and valign. Whenever I use top value, it shows outside the box.

            Is there a extension or a plugin that lets us do it?

            Example with child node: https://stackblitz.com/edit/cytoscape-call-method-child-efmbaj?file=src%2Fapp%2FstylesheetObject.ts

            ...

            ANSWER

            Answered 2021-Jun-25 at 08:46

            As you can read here, you can only place labels inside a node with the center option, a good configuration (label inside at the top) requires a margin to be added to your label:

            Source https://stackoverflow.com/questions/68121302

            QUESTION

            Select elements in cytoscape.js using "or" operator
            Asked 2021-Jun-19 at 06:21

            I want to select nodes in cytoscape using operators "and" and "or".

            Based on the [cytoscape.js][1] document

            [1]: https://js.cytoscape.org/#selectors, the users can use the below syntax for "and" operator, but i couldn't find any syntax for "or" operator.

            ...

            ANSWER

            Answered 2021-Jun-19 at 06:21

            Below should work. Give attention to the COMMA. Comma is used for logical OR

            cy.nodes("[weight >= 50],[height < 180]");

            Source https://stackoverflow.com/questions/68037037

            QUESTION

            events on core do not get captured in cytoscape.js / react
            Asked 2021-Apr-26 at 06:46

            I'm refactoring old code with react-cytoscapejs. In the past it was possible to identify clicks on empty space in cytoscape.

            ...

            ANSWER

            Answered 2021-Apr-24 at 09:25

            You can just use the normal tap event without specifying the target. That way, you get all events and you can filter from there:

            Source https://stackoverflow.com/questions/67229469

            QUESTION

            Cytoscape.js - Toggle Dark-Mode
            Asked 2021-Mar-30 at 11:22

            I understand that I can edit the color of nodes and edges in cytoscape.js

            What selector should I use for the background color? I want to toggle between a light and dark background (like a toggle for light/dark mode).

            Thank you very much for anyone who can answer.

            ...

            ANSWER

            Answered 2021-Mar-30 at 09:40

            You can toggle the background color with some simple js code. I implemented this functionality with .addEventListener() on a button click:

            Source https://stackoverflow.com/questions/66851129

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install cytoscape.js

            Install node and npm. Run npm install before using npm run.
            Run npm run <target> in the console. The main targets are:. The default test scripts run directly against the source code. Tests can alternatively be run on a built bundle. The library can be built on node>=6, but the library's bundle can be tested on node>=0.10.
            build: do all builds of the library (umd, min, umd, esm)
            build:min : do the unminified build with bundled dependencies (for simple html pages, good for novices)
            build:umd : do the umd (cjs/amd/globals) build
            build:esm : do the esm (ES 2015 modules) build
            clean : clean the build directory
            docs : build the docs into documentation
            release : build all release artifacts
            watch : automatically build lib for debugging (with sourcemap, no babel, very quick) good for general testing on debug/index.html served on http://localhost:8080 or the first available port thereafter, with livereload on debug/index.html
            watch:babel : automatically build lib for debugging (with sourcemap, with babel, a bit slower) good for testing performance or for testing out of date browsers served on http://localhost:8080 or the first available port thereafter, with livereload on debug/index.html
            watch:umd : automatically build prod umd bundle (no sourcemap, with babel) good for testing cytoscape in another project (with a "cytoscape": "file:./path/to/cytoscape" reference in your project's package.json) no http server
            dist : update the distribution js for npm etc.
            test : run all testing & linting
            test:js : run the mocha tests on the public API of the lib (directly on source files) npm run test:js -- -g "my test name" runs tests on only the matching test cases
            test:build : run the mocha tests on the public API of the lib (on a built bundle) npm run build should be run beforehand on a recent version of node npm run test:build -- -g "my test name" runs build tests on only the matching test cases
            test:modules : run unit tests on private, internal API npm run test:modules -- -g "my test name" runs modules tests on only the matching test cases
            lint : lint the js sources via eslint
            benchmark : run all benchmarks
            benchmark:single : run benchmarks only for the suite specified in benchmark/single

            Support

            You can find the documentation and downloads on the project website.
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
            CLONE
          • HTTPS

            https://github.com/cytoscape/cytoscape.js.git

          • CLI

            gh repo clone cytoscape/cytoscape.js

          • sshUrl

            git@github.com:cytoscape/cytoscape.js.git

          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link

            Explore Related Topics

            Consider Popular JavaScript Libraries

            freeCodeCamp

            by freeCodeCamp

            vue

            by vuejs

            react

            by facebook

            bootstrap

            by twbs

            Try Top Libraries by cytoscape

            cytoscape

            by cytoscapeShell

            cytoscape-tutorials

            by cytoscapeHTML

            ipycytoscape

            by cytoscapePython

            cytoscape.js-dagre

            by cytoscapeJavaScript

            py2cytoscape

            by cytoscapePython