Skip to content

Lite Component ​

v-network-graph-lite (VNetworkGraphLite) is a lighter version of v-network-graph for networks with thousands of nodes and edges. Where v-network-graph renders each node and edge as its own Vue component, the lite component draws each node and edge as a single SVG element and each node label as one more. This keeps dragging, zooming and force layouts responsive with that many objects.

app.use(VNetworkGraph) registers it along with v-network-graph. It takes the same props except paths and selected-paths, and you can define its configs with vNG.defineLiteConfigs() (import * as vNG from "v-network-graph").

Differences from v-network-graph ​

  • Supported: node shapes and their states (hover, selected), node labels, dragging, selection and hover of nodes and edges, edge markers and margins, multiple edges between the same nodes, self-loop edges, z-order, custom layers, the grid, box selection, the view methods and the SVG export.
  • Not supported: paths, curved edges, summarized edges, edge labels, focus rings, label backgrounds, the slots override-node, override-node-label, edge-overlay, edge-label and edges-label, and transitionWhile().

If you pass one of the unsupported slots, the component ignores it and logs a warning to the console.

Draw a large network ​

The example below lays out 1000 nodes and about 1700 edges with a force layout. You can change the number of nodes up to 2000.

While a force layout runs, the component draws the nodes first and updates the layouts prop up to view.layoutsUpdateInterval milliseconds later (300 by default). To get the positions as they are drawn, for example to save them while the layout is running, call getLayouts().