vis-network vs cytoscape vs d3-graphviz
Graph Visualization Libraries
vis-networkcytoscaped3-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
vis-network583,8433,59682.7 MB3442 months ago(Apache-2.0 OR MIT)
cytoscape011,0875.7 MB13a month agoMIT
d3-graphviz01,8062.92 MB232 years agoBSD-3-Clause

Feature Comparison: vis-network vs cytoscape vs d3-graphviz

Graph Types

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

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

  • 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

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

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

  • 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

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

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

  • 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

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

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

  • 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

  • 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);
    
  • 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' }
    });
    
  • 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: vis-network vs cytoscape vs d3-graphviz

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

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

  • 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 vis-network

vis-network

example chart

Network is a visualization to display networks and networks consisting of nodes and edges. The visualization is easy to use and supports custom shapes, styles, colors, sizes, images, and more. The network visualization works smooth on any modern browser for up to a few thousand nodes and edges. To handle a larger amount of nodes, Network has clustering support. Network uses HTML canvas for rendering.

Badges

semantic-release Renovate npm

dependencies Status devDependencies Status peerDependencies Status

GitHub contributors Backers on Open Collective Sponsors on Open Collective

Install

Install via npm:

$ npm install vis-network

Example

A basic example on loading a Network is shown below. More examples can be found in the examples directory of the project.

<!DOCTYPE html>
<html lang="en">
  <head>
    <title>Network</title>
    <script
      type="text/javascript"
      src="https://unpkg.com/vis-network/standalone/umd/vis-network.min.js"
    ></script>
    <style type="text/css">
      #mynetwork {
        width: 600px;
        height: 400px;
        border: 1px solid lightgray;
      }
    </style>
  </head>
  <body>
    <div id="mynetwork"></div>
    <script type="text/javascript">
      // create an array with nodes
      var nodes = new vis.DataSet([
        { id: 1, label: "Node 1" },
        { id: 2, label: "Node 2" },
        { id: 3, label: "Node 3" },
        { id: 4, label: "Node 4" },
        { id: 5, label: "Node 5" },
      ]);

      // create an array with edges
      var edges = new vis.DataSet([
        { from: 1, to: 3 },
        { from: 1, to: 2 },
        { from: 2, to: 4 },
        { from: 2, to: 5 },
        { from: 3, to: 3 },
      ]);

      // create a network
      var container = document.getElementById("mynetwork");
      var data = {
        nodes: nodes,
        edges: edges,
      };
      var options = {};
      var network = new vis.Network(container, data, options);
    </script>
  </body>
</html>

Build

To build the library from source, clone the project from github

$ git clone git://github.com/visjs/vis-network.git

The source code uses the module style of node (require and module.exports) to organize dependencies. To install all dependencies and build the library, run npm install in the root of the project.

$ cd vis-network
$ npm install

Then, the project can be build running:

$ npm run build

Test

To test the library, install the project dependencies once:

$ npm install

Then run the tests:

$ npm run test

Contribute

Contributions to the vis.js library are very welcome! We can't do this alone!

Backers

Thank you to all our backers! 🙏

Sponsors

Support this project by becoming a sponsor. Your logo will show up here with a link to your website.

License

Copyright (C) 2010-2018 Almende B.V. and Contributors Copyright (c) 2018-2021 Vis.js contributors

Vis.js is dual licensed under both

and

Vis.js may be distributed under either license.