Vis Network Examples
vis-network · interactive demos

Network graphs you can grab, drag and take apart.

This site mirrors the complete official example set of vis-network, the dynamic network visualisation library from the Vis.js family. Every demo below is live: drag nodes, zoom in, change the physics, then view the page source to see exactly how it is built.

Browse Examples Getting Started Guide

Your first network in three steps

The standalone build bundles everything, including the DataSet. One script tag is enough.

STEP 1

Load the library

Add the standalone script hosted on this site. No build step, no bundler.

STEP 2

Describe nodes & edges

Wrap two arrays in vis.DataSet — nodes with id and label, edges with from and to.

STEP 3

Draw it

Call new vis.Network(container, data, options) and the physics engine lays the graph out for you.

<script src="https://vis.rapporteur.online/standalone/umd/vis-network.min.js"></script>
<div id="mynetwork" style="height: 420px; border: 1px solid #D9E0E4;"></div>
<script>
  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" }
  ]);
  var edges = new vis.DataSet([
    { from: 1, to: 3 }, { from: 1, to: 2 },
    { from: 2, to: 4 }, { from: 2, to: 5 }
  ]);
  var network = new vis.Network(
    document.getElementById("mynetwork"),
    { nodes: nodes, edges: edges }, {});
</script>

Prefer modules or the peer build that shares a DataSet with other Vis libraries? The getting started guide covers all three builds, or open the standalone, peer and legacy basic-usage demos side by side.

All 90 examples, by category

Basic Usage · Basic Usage · Data · Data — DOT Language · Edge Styles · Events · Example Applications · Node Styles — Image Selection · Labels · Layout · Node Styles · Other · Physics · Tests · Version Migration · Version Migration — 5.4.1 to 6.0.0

Basic Usage

1 interactive example — open one, drag the nodes, and read its source.

Basic Usage

4 interactive examples — open one, drag the nodes, and read its source.

Data

7 interactive examples — open one, drag the nodes, and read its source.

Data — DOT Language

3 interactive examples — open one, drag the nodes, and read its source.

Edge Styles

11 interactive examples — open one, drag the nodes, and read its source.

Events

3 interactive examples — open one, drag the nodes, and read its source.

Example Applications

6 interactive examples — open one, drag the nodes, and read its source.

Node Styles — Image Selection

1 interactive example — open one, drag the nodes, and read its source.

Labels

7 interactive examples — open one, drag the nodes, and read its source.

Layout

8 interactive examples — open one, drag the nodes, and read its source.

Node Styles

16 interactive examples — open one, drag the nodes, and read its source.

Other

17 interactive examples — open one, drag the nodes, and read its source.

Physics

3 interactive examples — open one, drag the nodes, and read its source.

Tests

1 interactive example — open one, drag the nodes, and read its source.

Version Migration

1 interactive example — open one, drag the nodes, and read its source.

Version Migration — 5.4.1 to 6.0.0

1 interactive example — open one, drag the nodes, and read its source.

Frequently asked questions

What is vis-network?

An open-source JavaScript library for visualising networks and graphs in the browser. You give it nodes and edges; it renders an interactive canvas graph with zooming, dragging, selection, clustering and a built-in physics simulation. It is part of the Vis.js family and is maintained by the visjs community.

Do the examples run offline or send my data anywhere?

Each demo is a static page that runs entirely in your browser. The graphs you see are drawn from data bundled with the page itself. A few demos load helper libraries (such as Alea or vis-data) from public CDNs, exactly as the upstream examples do.

Which build should I use in my own project?

Start with the standalone build — one file, everything bundled. Use the peer build when you combine vis-network with other Vis packages and want to share one DataSet, and the ESNext build when a bundler handles your dependencies. The guide walks through each option.

Can I reuse the example code?

Yes. vis-network is dual-licensed under Apache-2.0 OR MIT, so the library and its examples can be used in open-source and commercial projects under either licence. Keep the licence notice with your copies, as both licences require.