cytoscape vs vis-network vs d3-graphviz
Graph Visualization Libraries
cytoscapevis-networkd3-graphvizSimilar Packages:
Graph Visualization Libraries

Graph visualization libraries in JavaScript provide tools for creating interactive and visually appealing representations of data structures such as graphs, networks, and trees. These libraries are essential for applications that require the visualization of relationships between entities, such as social networks, organizational charts, and data flow diagrams. They offer features like customizable nodes and edges, various layout algorithms, and interactivity options, making it easier for developers to create dynamic and informative visualizations. cytoscape is a powerful library for graph theory and network visualization, offering extensive features for analyzing and visualizing complex networks. d3-graphviz integrates Graphviz with D3.js, allowing for the creation of directed and undirected graphs using the DOT language, with a focus on hierarchical layouts and customizable styling. vis-network is a versatile library for visualizing networks and graphs, providing a range of layout algorithms, interactive features, and easy-to-use API for creating dynamic and visually appealing network diagrams.

Npm Package Weekly Downloads Trend
3 Years
Github Stars Ranking
Stat Detail
Package
Downloads
Stars
Size
Issues
Publish
License
cytoscape2,445,21010,7485.67 MB274 months agoMIT
vis-network350,3723,47182.9 MB3403 months ago(Apache-2.0 OR MIT)
d3-graphviz36,3351,7872.92 MB22a year agoBSD-3-Clause
Feature Comparison: cytoscape vs vis-network vs d3-graphviz

Graph Types

  • cytoscape:

    cytoscape supports a wide range of graph types, including directed, undirected, and weighted graphs. It is highly customizable, allowing for the creation of complex network visualizations with various node and edge styles.

  • vis-network:

    vis-network supports various graph types, including directed, undirected, and weighted graphs. It provides multiple layout algorithms and allows for easy customization of nodes and edges, making it versatile for different types of network visualizations.

  • d3-graphviz:

    d3-graphviz focuses on directed and undirected graphs, particularly those that can be represented using the DOT language. It excels at creating hierarchical and flowchart-style diagrams, making it ideal for visualizing structured data.

Interactivity

  • cytoscape:

    cytoscape offers extensive interactivity features, including zooming, panning, and selection. It also supports event handling, allowing developers to create interactive visualizations with tooltips, context menus, and dynamic updates.

  • vis-network:

    vis-network is designed for interactivity, offering built-in support for zooming, panning, dragging, and selection. It also supports events and callbacks, making it easy to create interactive and responsive network visualizations.

  • d3-graphviz:

    d3-graphviz leverages D3.js for interactivity, providing features like zooming, panning, and animated transitions. However, interactivity is more limited compared to cytoscape, and it may require additional coding to implement advanced features.

Layout Algorithms

  • cytoscape:

    cytoscape provides a variety of layout algorithms, including force-directed, circular, grid, and hierarchical layouts. It also supports custom layouts and allows for the integration of third-party layout algorithms, making it highly flexible for different visualization needs.

  • vis-network:

    vis-network offers multiple built-in layout algorithms, including hierarchical, force-directed, and circular layouts. It allows for easy switching between layouts and provides customization options, making it user-friendly for various types of network visualizations.

  • d3-graphviz:

    d3-graphviz primarily uses Graphviz's layout algorithms, such as dot (hierarchical), neato (force-directed), and circo (circular). These algorithms are well-suited for structured and hierarchical data, but the library is less flexible for custom layouts compared to cytoscape.

Integration

  • cytoscape:

    cytoscape integrates well with other data analysis tools and libraries, including Cytoscape.js for web-based applications and Cytoscape desktop for more advanced analysis. It also supports integration with React, Angular, and Vue.js, making it versatile for modern web development.

  • vis-network:

    vis-network is a standalone library but can be easily integrated with other JavaScript frameworks and libraries. It is designed to be lightweight and modular, making it easy to incorporate into existing projects.

  • d3-graphviz:

    d3-graphviz integrates seamlessly with D3.js, allowing for the combination of Graphviz's layout capabilities with D3's powerful data visualization features. This makes it ideal for developers who want to leverage both libraries for more complex and interactive visualizations.

Ease of Use: Code Examples

  • cytoscape:

    Simple graph visualization with cytoscape

    import cytoscape from 'cytoscape';
    const cy = cytoscape({
      container: document.getElementById('cy'),
      elements: [
        { data: { id: 'a' } },
        { data: { id: 'b' } },
        { data: { id: 'ab', source: 'a', target: 'b' } }
      ],
      style: [
        { selector: 'node', style: { 'background-color': '#666', 'label': 'data(id)' } },
        { selector: 'edge', style: { 'width': 3, 'line-color': '#ccc' } }
      ],
      layout: { name: 'grid' }
    });
    
  • vis-network:

    Simple graph visualization with vis-network

    import { Network } from 'vis-network';
    const nodes = new vis.DataSet([
      { id: 1, label: 'Node 1' },
      { id: 2, label: 'Node 2' },
      { id: 3, label: 'Node 3' }
    ]);
    const edges = new vis.DataSet([
      { from: 1, to: 2 },
      { from: 2, to: 3 }
    ]);
    const container = document.getElementById('network');
    const data = { nodes, edges };
    const options = {};
    const network = new Network(container, data, options);
    
  • d3-graphviz:

    Simple graph visualization with d3-graphviz

    import { graphviz } from 'd3-graphviz';
    const graph = `
      digraph G {
        A -> B;
        B -> C;
        C -> A;
      }
    `;
    d3.select('#graph').graphviz().renderDot(graph);
    
How to Choose: cytoscape vs vis-network vs d3-graphviz
  • cytoscape:

    Choose cytoscape if you need a comprehensive solution for visualizing and analyzing complex networks. It is ideal for applications that require advanced features like clustering, filtering, and integration with other data analysis tools.

  • vis-network:

    Choose vis-network if you need a flexible and easy-to-use library for creating interactive network visualizations. It is suitable for applications that require quick setup and a variety of layout options, including hierarchical, circular, and force-directed layouts.

  • d3-graphviz:

    Choose d3-graphviz if you are familiar with the Graphviz DOT language and need to create hierarchical or flowchart-style diagrams. It is particularly useful for visualizing directed graphs and offers seamless integration with D3.js for added interactivity.

README for cytoscape

GitHub repo Ask a question with Phind News and tutorials License npm DOI npm installs Automated tests Extensions Cloudflare

Created at the University of Toronto and published in Oxford Bioinformatics (2016, 2023).
Authored by: Max Franz, Christian Lopes, Dylan Fong, Mike Kucera, ..., Gary Bader

Cytoscape.js

Graph theory (network) library for visualisation and analysis : https://js.cytoscape.org

Description

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.

You can get started with Cytoscape.js with one line:

var cy = cytoscape({ elements: myElements, container: myDiv });

Learn more about the features of Cytoscape.js by reading its documentation.

Example

The Tokyo railway stations network can be visualised with Cytoscape:

A live demo and source code are available for the Tokyo railway stations graph. More demos are available in the documentation.

Documentation

You can find the documentation and downloads on the project website.

Roadmap

Future versions of Cytoscape.js are planned in the milestones of the Github issue tracker. You can use the milestones to see what's currently planned for future releases.

Contributing to Cytoscape.js

Would you like to become a Cytoscape.js contributor? You can contribute in technical roles (e.g. features, testing) or non-technical roles (e.g. documentation, outreach), depending on your interests. Get in touch with us by posting a GitHub discussion.

For the mechanics of contributing a pull request, refer to CONTRIBUTING.md.

Feature releases are made monthly, while patch releases are made weekly. This allows for rapid releases of first- and third-party contributions.

Citation

To cite Cytoscape.js in a paper, please cite the Oxford Bioinformatics issue:

Cytoscape.js: a graph theory library for visualisation and analysis

Franz M, Lopes CT, Huck G, Dong Y, Sumer O, Bader GD

Bioinformatics (2016) 32 (2): 309-311 first published online September 28, 2015 doi:10.1093/bioinformatics/btv557 (PDF)

Build dependencies

Install node and npm. Run npm install before using npm run.

Build instructions

Run npm run <target> in the console. The main targets are:

Building:

  • 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.

Testing:

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.

  • 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

Release instructions

Background

  • Ensure that a milestone exists for the release you want to make, with all the issues for that release assigned in the milestone.
  • Bug fixes should be applied to both the master and unstable branches. PRs can go on either branch, with the patch applied to the other branch after merging.
  • When a patch release is made concurrently with a feature release, the patch release should be made first. Wait 5 minutes after the patch release completes before starting the feature release -- otherwise Zenodo doesn't pick up releases properly.

Patch version

  1. Go to Actions > Patch release
  2. Go to the 'Run workflow' dropdown
  3. [Optional] The 'master' branch should be preselected for you
  4. Press the green 'Run workflow' button
  5. Close the milestone for the release

Feature version

  1. Go to Actions > Feature release
  2. Go to the 'Run workflow' dropdown
  3. [Optional] The 'unstable' branch should be preselected for you
  4. Press the green 'Run workflow' button
  5. Close the milestone for the release
  6. Make the release announcement on the blog

Notes on GitHub Actions UI

  • 'Use workflow from' in the GitHub UI selects the branch from which the workflow YML file is selected. Since the workflow files should usually be the same on the master and unstable branches, it shouldn't matter what's selected.
  • 'Branch to run the action on' in the GitHub UI is preselected for you. You don't need to change it.

Tests

Mocha tests are found in the test directory. The tests can be run in the browser or they can be run via Node.js (npm run test:js).