What it is and how it works
Load order: netflow-scene.js, then netflow-hierarchy.js, then netflow-circular.js (this module draws through netflow-scene).
The circular views of Netflow Map as an add-on for netflow-engine: Chord and Bundles.
- Chord: arcs around a circle, one per item or per group, and bands as wide as what each link carries. The order around the circle can be searched for fewer crossing bands.
- Bundles: items on a circle and each link bent along the tree between its ends, so links that go the same way run together (Holten 2006).
layout(view, G, options)andscene(L, options, NetflowScene)work as in netflow-hierarchy, which this module builds on (load it first).
Why it exists
Who sends how much to whom, and which parts of a map talk to each other, read best around a circle. Kept here, the app and any other page use one tested copy. Netflow Map keeps the views built in.
Where it helps
- Flows between groups or items (Chord).
- Many links on a tree-shaped map without a tangle (Bundles).
Not for: maps where position along a route matters; use the layered views.
How it compares
Against d3-chord 3.0.1, measured by Netflow Map on its own copy of this code (the same layouts to the last digit) in the cloud test browsers, random flows with 4 links per item: with the order kept (no search, like d3) it takes 0.3 to 1.0 of d3's time. With the crossing search it takes 3.5 to 15 times d3's time and its bands cross 53%, 16% and 3% less at 20, 60 and 200 items (weighted: two crossing bands count the smaller amount); d3-chord keeps the order it is given. The crossing count was made 3 to 4 times faster before this release.
How to use it
Use
// netflow-scene.js, netflow-hierarchy.js, then netflow-circular.js
var L = NetflowCircular.layout('chord', { nodes: nodes, edges: edges }, { chordBy: 'auto' }); // searches the order; chordOrder: 'fast' keeps it
var S = NetflowCircular.scene(L, { theme: 'dark' }, NetflowScene);
- Views:
chord,bundles(NetflowCircular.VIEWS). - Options:
chordBy(auto,itemsorgroups; auto gives one arc per group above 60 items),chordOrder(fastkeeps the group order, about d3-chord's work; left out or anything else searches the order for fewer crossing bands, up to 3,000 bands),typed(Chord, since 1.5.0:trueleaves out the object for each band and returns them as typed arrays inchart.flowsT(n,s,t,v,sa0,sa1,ta0,ta1,firstEdge,nextEdge,count) instead ofchart.flows;scene()draws either; 400 items with 80,000 links lay out in about 15 to 25 ms, against 40 to 55 ms with objects),nest(Bundles: the tree it bends along),beta(Bundles: how tightly links follow the tree, default 0.85). - Title block (optional, off unless given):
title(bold, top left),subtitle(under it) andsource(small, under the picture), set in thescene()options. The block sits outside the picture, so nothing in the picture moves, and the SVG export draws it. bsplineToBezier(points)is exported for drawing smooth curves.
Use with netflow-engine: load the files as page scripts (or keep the folders side by side in Node) and the views join NetflowEngine.VIEWS; or hand them over with NetflowEngine.use('circular', NetflowCircular). Then NetflowEngine.build(graph, { view: 'chord' }) lays the map out and NetflowCircular.scene(L, options, NetflowScene) draws it.
Use
// netflow-scene.js, netflow-hierarchy.js, then netflow-circular.js
var L = NetflowCircular.layout('chord', { nodes: nodes, edges: edges }, { chordBy: 'auto' }); // searches the order; chordOrder: 'fast' keeps it
var S = NetflowCircular.scene(L, { theme: 'dark' }, NetflowScene);
- Views:
chord,bundles(NetflowCircular.VIEWS). - Options:
chordBy(auto,itemsorgroups; auto gives one arc per group above 60 items),chordOrder(fastkeeps the group order, about d3-chord's work; left out or anything else searches the order for fewer crossing bands, up to 3,000 bands),typed(Chord, since 1.5.0:trueleaves out the object for each band and returns them as typed arrays inchart.flowsT(n,s,t,v,sa0,sa1,ta0,ta1,firstEdge,nextEdge,count) instead ofchart.flows;scene()draws either; 400 items with 80,000 links lay out in about 15 to 25 ms, against 40 to 55 ms with objects),nest(Bundles: the tree it bends along),beta(Bundles: how tightly links follow the tree, default 0.85). - Title block (optional, off unless given):
title(bold, top left),subtitle(under it) andsource(small, under the picture), set in thescene()options. The block sits outside the picture, so nothing in the picture moves, and the SVG export draws it. bsplineToBezier(points)is exported for drawing smooth curves.
Use with netflow-engine: load the files as page scripts (or keep the folders side by side in Node) and the views join NetflowEngine.VIEWS; or hand them over with NetflowEngine.use('circular', NetflowCircular). Then NetflowEngine.build(graph, { view: 'chord' }) lays the map out and NetflowCircular.scene(L, options, NetflowScene) draws it.
Speed and efficiency numbers
Against d3-chord, cloud-browser runs
Chord layout of a dense random matrix (400 x 400, 79,795 links), a fresh page for every library, alternating pages (7 in Chromium and Firefox, 2 in WebKitGTK; d3-chord from the same test), shared 4-core cloud machine. Each library gets its native input (matrix for d3-chord, links for netflow-circular, fast order). Lower is faster.
Compared: netflow-circular against d3-chord 3.0.2 (chord layout, 400 x 400 matrix, ms).
These are the default settings. The band objects (chart.flows) are made the first time they are read, and drawing with scene() does not need them; the optional typed: true setting, which returns the bands as typed arrays, takes about the same time (18.7, 15.4 and 24 ms). The work is not identical: d3-chord makes one ribbon per pair (79,795 chords) and netflow-circular one band per direction with drawing geometry (158,061 bands), about twice the output. netflow-circular also offers bundles, grouped arcs, drawing lists and an order search that d3-chord does not. The WebKitGTK number for netflow-circular is from 2 pages only, so treat it as direction. A 150 x 150 matrix was not re-measured.
Size (esbuild minified, gzip -9, measured at 1.5.2): d3-chord 3.0.1 is 1.6 KB gzipped (2.7 KB with d3-path 3.1.0); netflow-circular is 6.4 KB (it also has Bundles and the crossing search), or 20.7 KB with netflow-hierarchy that it builds on (14.3 KB).
Source: Against d3-chord, cloud-browser runs.
Credits
The code is Netflow Map's own (LFC Foundry), cut out for this module; no code from other projects. d3-chord was the speed comparison only.
Original sources (links checked 2026-11-14; ideas only):
- Bundles: Danny Holten, "Hierarchical Edge Bundles", IEEE TVCG, 2006
- Crossing counting in n log n: Barth, Junger and Mutzel, "Simple and Efficient Bilayer Cross Counting", JGAA 2004, with a Fenwick tree (Peter Fenwick, "A new data structure for cumulative frequency tables", 1994)
Original sources (links checked 2026-11-14; ideas only unless the section above says code is included):
- Bundles: Danny Holten, "Hierarchical Edge Bundles", IEEE TVCG, 2006
- Crossing counting in n log n: Barth, Junger and Mutzel, "Simple and Efficient Bilayer Cross Counting", JGAA 2004, with a Fenwick tree (Peter Fenwick, "A new data structure for cumulative frequency tables", 1994)