vis-network vs react-graph-vis
Graph Visualization Libraries
vis-networkreact-graph-vis
Graph Visualization Libraries

Graph visualization libraries in JavaScript provide tools for creating interactive and visually appealing representations of networks, graphs, and relationships between data points. These libraries are essential for applications that require visualizing complex structures such as social networks, organizational charts, or data flow diagrams. They offer features like customizable nodes and edges, various layout algorithms, and interactivity options such as zooming, panning, and event handling. These libraries help developers create intuitive and engaging visualizations that can aid in data analysis, presentation, and user interaction. react-graph-vis is a React wrapper for the vis.js library, providing an easy way to integrate network, timeline, and graph visualizations into React applications. It leverages the powerful features of vis.js while offering a React-friendly API. vis-network is a standalone library for creating interactive network visualizations. It is part of the vis.js suite but can be used independently. It provides extensive customization options, various layout algorithms, and supports large datasets, making it suitable for complex network visualizations.

Npm Package Weekly Downloads Trend
3 Years
Github Stars Ranking
Stat Detail
Package
Downloads
Stars
Size
Issues
Publish
License
vis-network450,7673,51182.9 MB3415 months ago(Apache-2.0 OR MIT)
react-graph-vis20,133989-605 years agoMIT
Feature Comparison: vis-network vs react-graph-vis

Integration with React

  • vis-network:

    vis-network is a standalone library that can be used with any JavaScript framework or vanilla JS. It does not have built-in React integration, so developers need to handle the integration manually if used within a React application.

  • react-graph-vis:

    react-graph-vis is designed specifically for React applications, providing a seamless integration with React's component-based architecture. It allows developers to use React's state and props to control the visualization, making it easy to update and manage the graph dynamically.

Customization

  • vis-network:

    vis-network offers extensive customization options for nodes, edges, and the overall network. It provides more flexibility for advanced customization, including custom shapes, styles, and behaviors, making it suitable for complex visualizations.

  • react-graph-vis:

    react-graph-vis inherits the customization capabilities of vis.js, allowing developers to customize nodes, edges, and overall graph appearance. However, the customization is somewhat limited by the React wrapper, which may not expose all the underlying features of vis.js.

Interactivity

  • vis-network:

    vis-network offers more advanced interactivity features, including dynamic manipulation of the network, real-time updates, and more granular control over events. It is better suited for applications that require complex interactions and real-time data visualization.

  • react-graph-vis:

    react-graph-vis provides basic interactivity features such as zooming, panning, and event handling (e.g., click, hover) through the React component. It is easy to use and integrates well with React's event system.

Performance

  • vis-network:

    vis-network is optimized for handling large networks and provides better performance for visualizing large datasets. It includes features like clustering and hierarchical layouts to improve performance and readability.

  • react-graph-vis:

    react-graph-vis is suitable for small to medium-sized graphs. Performance may be impacted when dealing with very large datasets, especially within the React rendering cycle.

Ease of Use: Code Examples

  • vis-network:

    vis-network has comprehensive documentation and examples that cover a wide range of features. However, it may require more time to learn and implement advanced features compared to react-graph-vis.

  • react-graph-vis:

    react-graph-vis provides a simple API for integrating network visualizations into React applications. It is easy to use for developers familiar with React, and the documentation includes examples and guides for common use cases.

How to Choose: vis-network vs react-graph-vis
  • vis-network:

    Choose vis-network if you need a standalone solution for creating highly customizable and interactive network visualizations. It is suitable for projects that require more control over the visualization and can be used with any JavaScript framework or vanilla JS.

  • react-graph-vis:

    Choose react-graph-vis if you are working within a React application and want a simple way to integrate network visualizations. It is ideal for projects where you need to quickly add interactive graphs without dealing with the underlying implementation details.

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.