Network
Defined in: network/network.ts:1174
The network rendering engine (epic #98). A dedicated engine — nodes, links,
layout, and LOD are one coupled system — built on the shared BaseEngine
host/transform/zoom/interaction shell, rendering through the instanced lane (#100)
rather than the retained Scene path.
N2.1 draws nodes as instanced circles. Links (#100 N2.2), the layout contract proper (#101), and LOD (#103) build on this.
Extends
Section titled “Extends”BaseEngine
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new Network(
host,opts?):Network
Defined in: network/network.ts:1584
Parameters
Section titled “Parameters”HTMLElement
NetworkOptions = {}
Returns
Section titled “Returns”Network
Overrides
Section titled “Overrides”BaseEngine.constructor
Accessors
Section titled “Accessors”declutterStats
Section titled “declutterStats”Get Signature
Section titled “Get Signature”get declutterStats():
NetworkDeclutterStats|null
Defined in: network/network.ts:4191
What the last LOD declutter pass cost: the frontier glyphs it thinned, the distance tests and grid
cells it ran, and how many grid cells the engine’s reused scratch holds. null until LOD with
declutter has drawn a frame. Introspection for debugging and tests: the per-frame guards read it
after each setTransform to assert the declutter’s cost signature through the real trigger.
Returns
Section titled “Returns”NetworkDeclutterStats | null
holderStats
Section titled “holderStats”Get Signature
Section titled “Get Signature”get holderStats():
object
Defined in: network/network.ts:4223
The holders of the node selection under LOD (#538): the modules a selected node is collapsed into, which
the cut rings faintly and keeps undimmed where it draws them. builds counts how often they were marked
(once per selection or tree change, never per frame), holders how many the last marking found.
Introspection for debugging and tests: a zoom sweep under an unchanged selection leaves builds as it was.
Returns
Section titled “Returns”object
builds
Section titled “builds”builds:
number
holders
Section titled “holders”holders:
number
layoutTransport
Section titled “layoutTransport”Get Signature
Section titled “Get Signature”get layoutTransport():
"none"|"copy"|"gpu"|"shared"
Defined in: network/network.ts:4244
Which position transport the active layout uses:
"gpu"— running on the WebGL GPU path (the handle’stransportfield is"gpu")."shared"— CPU worker, positions stream zero-copy via aSharedArrayBuffer(cross-origin isolated page)."copy"— CPU worker, positions are posted as per-frame snapshots (no COOP/COEP isolation, or the worker fell back to a synchronous solve)."none"— no layout active (force/positionsbackends, or beforelayout()).
It reports the live transport (#297): a worker error that falls back to a synchronous solve turns
"shared" into "copy", and a backend: "gpu" / "auto" layout that resolves to the worker (#351,
#375) reports the worker’s transport. For a "gpu" / "auto" layout it resolves asynchronously:
it is "copy" until the device promise settles, then "gpu" or the fallback worker’s
"shared"/"copy". A GPU run whose programs compile in parallel first (#385) reads "gpu" while they
compile, and moves to the worker’s transport if a link, the float-blend probe or the context then fails.
Read it after await net.whenSettled() for the value the run ended on. The environment’s capability (independent of any run) is
sharedMemoryAvailable.
Returns
Section titled “Returns”"none" | "copy" | "gpu" | "shared"
lodSource
Section titled “lodSource”Get Signature
Section titled “Get Signature”get lodSource():
"main"|"none"|"spatial"|"worker"|"modules"
Defined in: network/network.ts:4169
Which tree currently drives LOD rendering: "worker" when the active tree is the one a layout
worker built and streams — the worker backend’s, or the GPU layout’s LOD worker’s (#377) — so the main
thread does no coarsening or O(N) geometry pass,
"modules" when it’s a module hierarchy (N6 / #104 — data(graph, { modules }) or
lod({ modules }), #326), "spatial" when it’s the spatial tree the main thread built over the
node positions (source: "spatial" or an edge-less graph, #343), "main" when it’s the coarsening tree
built on the main thread (force/positions backends, the worker fallback, a GPU run whose LOD worker
failed, or LOD enabled after a streaming run), or
"none" when LOD is off or no geometry exists yet — including while a worker is about to stream
its tree and while a build lod() deferred to the end of the call chain is pending. Introspection
for debugging and tests; reading it never builds anything.
Returns
Section titled “Returns”"main" | "none" | "spatial" | "worker" | "modules"
lumped
Section titled “lumped”Get Signature
Section titled “Get Signature”get lumped():
LumpedStateNetwork|null
Defined in: network/network.ts:2127
The lumped network the state and both views draw while lumped (#529, lump): their hits’ ids are its
lump ids, which its lumpToState maps to state nodes and stateToLump back. Null while they draw the state
nodes as given, and without a state network.
Returns
Section titled “Returns”LumpedStateNetwork | null
positions
Section titled “positions”Get Signature
Section titled “Get Signature”get positions():
Float32Array<ArrayBufferLike> |null
Defined in: network/network.ts:2217
The positions of the nodes the engine draws, interleaved [x, y, …] in world units, indexed by the ids its
hits carry: the graph’s own positions for a plain network; in a state network the active view’s (#495) —
the physical graph’s, the state graph’s, or in the both view the state nodes’, which no graph holds: under
sizeMode: "world" where they are drawn, their physical node’s position plus their packed offset; under
"screen" their physical node’s position, since their offset is in px and the GPU adds it at every zoom
(#509). Live: read it when needed (a layout writes into it, and may replace it).
Null without data.
Returns
Section titled “Returns”Float32Array<ArrayBufferLike> | null
stateView
Section titled “stateView”Get Signature
Section titled “Get Signature”get stateView():
"state"|"physical"|"both"|null
Defined in: network/network.ts:2204
Whether a state network is loaded, and which of its three views is active (#171).
Returns
Section titled “Returns”"state" | "physical" | "both" | null
superEdgeStats
Section titled “superEdgeStats”Get Signature
Section titled “Get Signature”get superEdgeStats(): {
entries:number;hits:number;leafEntries:number;leafLinks:number;leafRows:number;misses:number;visits:number; } |null
Defined in: network/network.ts:4211
What the last super-edge gather on a spatial tree did (#343, lod({ source: "spatial" })): the kept
glyphs whose links the per-tree row memo answered (hits), the rows it rebuilt from the graph’s edges
under a glyph (misses), and the edge incidences those rebuilds walked (visits); on a tree a layout
streamed with its worker-built rows (#433), the row entries — plus the kept leaves’ own graph edges — it
read from them instead (entries): at the view the rows were built for, a repaint rebuilds nothing
(misses: 0, visits: 0); and the links it drew as graph edges between two kept leaves (leafLinks, #447),
which bypass the gather as the full-detail path draws them, with the CSR entries a separate walk read to list
them (leafEntries: 0 where the gather listed them), and the kept leaves’ rows it built from their edges
(leafRows, #463: 0 on a held view, whose rows the memo answers). null until a spatial tree has drawn links.
Introspection for debugging and tests: a re-emit of an unchanged view reports misses: 0, visits: 0.
Returns
Section titled “Returns”{ entries: number; hits: number; leafEntries: number; leafLinks: number; leafRows: number; misses: number; visits: number; } | null
Methods
Section titled “Methods”clearStyle()
Section titled “clearStyle()”clearStyle(
name,ids?):this
Defined in: map/base-engine.ts:1201
Remove overrides (all of the layer’s when ids is omitted) and restore base styles.
Parameters
Section titled “Parameters”string
string | number | readonly (string | number)[]
Returns
Section titled “Returns”this
Inherited from
Section titled “Inherited from”BaseEngine.clearStyle
data()
Section titled “data()”data(
graph,opts?):this
Defined in: network/network.ts:1604
Set the graph to render (built via buildGraph / parseEdgeList), optionally with its module
hierarchy (#326): data(graph, { modules, moduleLinks }). The engine owns the hierarchy as data,
like the graph — the LOD cut draws it by default, layout({ nested }) and the GPU module seed lay it
out, and picks report each target’s NetworkHit.path — whether LOD is on, off, or cutting
the graph structurally (lod({ source: "structure" })). lod(false) keeps it. data(graph)
without it clears any previous hierarchy (it belongs to the previous data).
The records are checked against the graph here, once (every node exactly once), and so are the module links’ endpoints (each a module or leaf of that hierarchy) — a bad hierarchy throws here, leaving the engine unchanged; the module tree is built lazily, once, when first needed. Leaves any state-network mode (stateNetwork) — a plain graph replaces it.
Parameters
Section titled “Parameters”NetworkDataOptions = {}
Returns
Section titled “Returns”this
destroy()
Section titled “destroy()”destroy():
void
Defined in: network/network.ts:4145
Tear down the engine, cancelling any worker layout first.
Returns
Section titled “Returns”void
Overrides
Section titled “Overrides”BaseEngine.destroy
disableInteraction()
Section titled “disableInteraction()”disableInteraction():
this
Defined in: map/base-engine.ts:1561
Detach the current pan/zoom or rotation interaction (no-op if none).
Returns
Section titled “Returns”this
Inherited from
Section titled “Inherited from”BaseEngine.disableInteraction
enableZoom()
Section titled “enableZoom()”enableZoom(
extent?,onTransform?):this
Defined in: map/base-engine.ts:2064
Enable scroll-to-zoom / drag-to-pan via d3-zoom, clamped to extent. The optional
onTransform callback fires once per drawn gesture frame, with the view just drawn — use it to
keep an HTML overlay (e.g. a LabelLayer) aligned with the GPU geometry as the view changes.
Wheel ticks and pan moves draw once per animation frame, however many arrive in it (#367): the
latest transform wins, and the gesture’s end draws its last one before it settles. It also fires
once here, with the view current at enable time (the one last passed to setTransform, identity
by default), so the overlay starts in step. It does not fire for a later programmatic
setTransform: the caller already knows that view.
A drag that starts on a draggable glyph moves the glyph instead (#140). Holding ⌘ (Ctrl on
Windows/Linux) makes any drag pan, even over a glyph (#178).
Parameters
Section titled “Parameters”extent?
Section titled “extent?”[number, number] = ...
onTransform?
Section titled “onTransform?”(t) => void
Returns
Section titled “Returns”this
Inherited from
Section titled “Inherited from”BaseEngine.enableZoom
highlight()
Section titled “highlight()”Call Signature
Section titled “Call Signature”highlight(
name,idOrIds,style?):this
Defined in: map/base-engine.ts:1347
Highlight one drawable / a set of drawables of name by drawing them into a tiny
internal overlay layer on top (inheriting the source’s clipTo/sizeMode) — the base
layer’s buffers are untouched, so the per-change cost is tessellating the
highlighted items only. styleOrDraw falls back to the layer’s hover option,
then to the default white outline. null clears.
The draw-fn overload is generic over the layer’s datum type D (caller-asserted,
like select’s predicate) so a custom highlight draw sees a typed datum.
Parameters
Section titled “Parameters”string
idOrIds
Section titled “idOrIds”string | number | readonly (string | number)[] | null
style?
Section titled “style?”Returns
Section titled “Returns”this
Inherited from
Section titled “Inherited from”BaseEngine.highlight
Call Signature
Section titled “Call Signature”highlight<
D>(name,idOrIds,draw):this
Defined in: map/base-engine.ts:1348
Highlight one drawable / a set of drawables of name by drawing them into a tiny
internal overlay layer on top (inheriting the source’s clipTo/sizeMode) — the base
layer’s buffers are untouched, so the per-change cost is tessellating the
highlighted items only. styleOrDraw falls back to the layer’s hover option,
then to the default white outline. null clears.
The draw-fn overload is generic over the layer’s datum type D (caller-asserted,
like select’s predicate) so a custom highlight draw sees a typed datum.
Type Parameters
Section titled “Type Parameters”D = unknown
Parameters
Section titled “Parameters”string
idOrIds
Section titled “idOrIds”string | number | readonly (string | number)[] | null
Returns
Section titled “Returns”this
Inherited from
Section titled “Inherited from”BaseEngine.highlight
interactive()
Section titled “interactive()”interactive(
opts):this
Defined in: network/network.ts:2631
Opt nodes/aggregates into the visual hover ring + click-selection (#105 N7c-2). This is
separate from on("hover" | "click"): those callbacks fire on every pick regardless of this call
(use them for your own readout/side-effects); interactive() is what draws the hover/selection
ring overlay on the glyphs and manages the selection set (selection(), on("select")).
Options (each off by default — interactive() is itself opt-in; omit it entirely and nodes are
pick-only, with no ring and no managed selection):
selectable— click to select:true/{}= single (click replaces),{ multi: true }= shift/cmd/ctrl-click toggles add/remove.hover— draw a ring on the hovered node/aggregate.tooltip: (datum, id) => content— shown for the hovered node/aggregate.draggable— grab a node/aggregate and drag it (#140): the held set tracks the cursor with no lag while the layout reheats around it and re-cools on release. Grab a selected node to drag the whole selection together; grab a collapsed module to drag its whole subtree. Works on theforce,worker,gpuandautolayout backends (reheat) andpositions(translate-only); on a landednestedmap its module and the ones above re-solve around it (seelayout({ nested })). Pair withenableZoom()and the drag takes precedence over panning when it starts on a glyph. Hold ⌘ (Ctrl on Windows/Linux) while dragging to pan instead, even over a node (#178). That is how you navigate a dense graph where almost every press lands on a node.selection: { selected, others }—selected.strokeoverrides the select ring colour (default#dc2626red); the hover ring defaults to the same red (override via ahoverHighlightStyle’sstroke). A subtract-marquee preview rings the to-be-removed glyphs#eab308yellow.others.opacity(default0.3) fades the glyphs that are NOT selected — node discs (LOD aggregates included), links/arrows and the physical-view pies — while the selected ones keep full opacity and get a ring, plus their outgoing links. Not dimmed: the LOD aggregate halos and theboth-view physical container discs (#315). With LOD off a selection change is a shader uniform plus an in-place flag write (no geometry rebuild); under LOD it re-emits only the visible frontier. A colour inothersis ignored on these instanced glyphs.hover: { others: { opacity } }opts into the same fade while hovering (a uniform push, no re-emit, with LOD on or off).
The hit’s datum is a NetworkHit ({ aggregate, count }); its members() lists the leaf
node ids the target covers (1 for a leaf, the whole subtree for an aggregate). Observe selection
via on("select", (hits) => …) or read it back with selection(); both carry members().
Open modules (#476). With lod({ moduleBoundary }), a module the cut has opened is hovered,
clicked and selected by its boundary ring: a pointer on the ring’s stroke (widened to 6 px when the
ring is thinner) picks the module exactly as it would pick it collapsed — the same id, datum and
members(), plus datum.open === true. A glyph drawn over the ring wins, the deepest of overlapping
rings wins, and a pointer inside the disc but off the ring picks no module (so a click there still
clears the selection). Its hover / selection highlight is drawn on the ring, its drawn members stay
undimmed, and a selected module keeps its highlight as it opens and collapses. With draggable, the ring
is also a drag handle (#479): a drag starting on it moves the module exactly as a drag of the same module
collapsed does. A press inside the disc but off the ring, or with ⌘ / Ctrl held, pans.
Pass false to disable (clears any current selection).
Parameters
Section titled “Parameters”false | InteractiveLayerOptions<NetworkHit>
Returns
Section titled “Returns”this
labels()
Section titled “labels()”labels(
opts):this
Defined in: network/network.ts:2680
Show text labels on the LOD frontier (#105 N7b) — leaf/aggregate centroids, re-placed on pan/zoom.
No cap by default (every visible labelled glyph, thinned by collision); set
NetworkLabelOptions.max to keep only the top-k by importance. The engine owns the
frontier→rank→placement wiring; you supply labelOf (return null to skip a glyph) + styling.
Rendered by the active backend: WebGL → an HTML overlay (crisp + accessible; styled by a
built-in default — dark 11px sans-serif + white halo — with style for inline overrides and
className as the full-CSS path); SVG/Canvas → native <text>/fillText (styled via
font/color/halo, defaulted to the same look). Labels appear in toSVG()/toPNG() on
every backend — WebGL composites the placed set into the export at export time (#219).
Pass false to remove.
Parameters
Section titled “Parameters”false | NetworkLabelOptions
Returns
Section titled “Returns”this
layout()
Section titled “layout()”layout(
opts):this
Defined in: network/network.ts:2926
Configure layout / supply positions (the pluggable contract proper lands in #101).
In state-network mode (stateNetwork, #495) this lays out the active view’s graph like a plain
network’s: the physical graph in the physical and both views, the state graph — with its modules, so
nested lays it out by module — in the state view. "positions" supplies that graph’s positions (one
[x, y] per node of it), and omitting backend runs "force". As for a plain network, the positions are the
layout’s own, on every backend (#401): fit: true frames them with the camera. The options are remembered:
a view never laid out runs them when it is first shown.
Parameters
Section titled “Parameters”Returns
Section titled “Returns”this
lod(
options):this
Defined in: network/network.ts:2495
Enable (or, with false, disable) level-of-detail rendering (#103) — an adaptive hierarchy cut
that draws dense regions as aggregate glyphs and expands them into members as you zoom, so
per-frame work tracks the visible frontier rather than the whole graph. Works on every render
backend: the WebGL lane re-cuts live as you zoom, while Canvas/SVG draw the frontier as retained
geometry that re-cuts when a gesture ends or after a setTransform with zoom enabled (#138; see
syncScreenGeometry). The tree’s geometry follows the layout as it converges.
Call this before layout({ backend: "worker" }) (or "gpu" / "auto") to get the full win: a
worker then builds and streams the LOD tree itself (#103; for the GPU solve its LOD worker, #377), so
the main thread never coarsens or runs the O(N) geometry pass. Enabling it after a streaming run (or
on the force/positions backends) falls back to building the tree on the main thread from the
current positions.
Until a layout has run on the graph data() set, lod() cannot know what comes next, so a tree it
would build from scratch waits for the end of the current call chain: a streaming layout() in the same
chain still gets its structural tree off-thread, a layout({ nested }) on a streaming backend and a
GPU layout’s module seed get the module tree built on a worker (#428), and every other path (no layout,
positions, force) has the tree before the next frame — and a synchronous read that needs it
(pick(), toSVG()/toPNG(), selection()) builds it at once. With a worker building the tree those
reads see what they see during any worker-streamed load: no cut until the worker’s tree lands.
select(), highlight() and setStyle()/clearStyle() never build it: while no tree is drawn they
keep their state, and the cut draws it when its tree lands, exactly as if they were called then.
With a module hierarchy (data(graph, { modules }), #326) the cut draws the module tree by
default; { source: "structure" } coarsens the graph structurally instead. { source: "spatial" }
(#343) groups nodes by position — on the worker and GPU backends a worker rebuilds that tree on every
streamed frame, so call this before layout() there too. lod(false) turns LOD off but keeps the
hierarchy, so re-enabling reuses its tree.
In state-network mode (stateNetwork, #494) the request holds across view switches and applies to the state view only: the physical view draws in full, every pie with it, until pies are LOD-aware (#174), and the both view’s containers hold every state node. Call it once, in any view. A new stateNetwork drops it.
Parameters
Section titled “Parameters”options
Section titled “options”false | NetworkLODOptions
Returns
Section titled “Returns”this
lump()
Section titled “lump()”lump(
on):this
Defined in: network/network.ts:2052
Lump the state network’s state nodes (#529), or draw them as given: with on, the state and both views draw one
node per (leaf module, physical node), as the map equation codes them (lumpStateGraph). The physical
view, its layout and its pies are the same either way. Without modules every state node is in the root module,
so each physical node’s state nodes are one node. No-op without a stateNetwork.
The state view keeps one picture across the toggle: once it has been laid out, the new form starts where the
current one’s nodes are — each lump at its state nodes’ centroid, or a lump’s state nodes on a rosette around it —
and the state view settles it with a warm run of the app’s last layout options as it shows it (at once in
the state view). Before that, the state view starts from a rosette around the physical nodes, as ever. The
selection follows the toggle (a state node becomes its lump, a lump its
state nodes, a container stays), and on("select") hears it; the hover is cleared. The state and both views’
hits carry lump ids while lumped: lumped maps them to state nodes. O(state nodes + state links) the
first time, O(nodes) after.
Parameters
Section titled “Parameters”boolean
Returns
Section titled “Returns”this
Call Signature
Section titled “Call Signature”on(
event,cb):this
Defined in: map/base-engine.ts:2166
Parameters
Section titled “Parameters”"click" | "hover"
((hit, ev) => void) | null
Returns
Section titled “Returns”this
Inherited from
Section titled “Inherited from”BaseEngine.on
Call Signature
Section titled “Call Signature”on(
event,cb):this
Defined in: map/base-engine.ts:2167
Parameters
Section titled “Parameters”"select"
((selected, ev?) => void) | null
Returns
Section titled “Returns”this
Inherited from
Section titled “Inherited from”BaseEngine.on
pick()
Section titled “pick()”pick(
x,y,exact?):HoverHit|null
Defined in: network/network.ts:5012
BaseEngine.pick, plus the module-boundary rings on Canvas/SVG (#476). On WebGL the node lane tests the rings itself, after the glyphs and before the links. On Canvas/SVG the retained Scene picks the glyphs and links, and the rings (a decorative layer, never in a hit index) are tested here with the same shared pickBoundaryRing, in the same order: a glyph wins, then a ring, then a link.
Parameters
Section titled “Parameters”number
number
exact?
Section titled “exact?”boolean = true
Returns
Section titled “Returns”HoverHit | null
Overrides
Section titled “Overrides”BaseEngine.pick
pickLinks()
Section titled “pickLinks()”pickLinks(
enabled?):this
Defined in: network/network.ts:2660
Enable (or, with false, disable) pixel-exact link picking (#141) — WebGL only. Nodes are always
pickable (CPU, exact on circles); links are thin strips / half-arrows, so resolving “the link you see”
needs a GPU pass: the link instances are drawn id-encoded into an offscreen FBO and the pixel under the
cursor is read back. Off by default because it adds a per-link-layer pick model + an offscreen readback
— opt in only when you handle link hits.
Once enabled, on("hover" | "click") and Network.pick resolve a link as a HoverHit
with layer: "links" and a NetworkLinkHit datum (when the cursor is over a link and not over
a node — nodes are drawn on top and win). Hover uses a stall-free async readback (the result can lag the
cursor by one pointer event); clicks read synchronously. There is no per-frame readback stall.
Parameters
Section titled “Parameters”enabled?
Section titled “enabled?”boolean = true
Returns
Section titled “Returns”this
recolor()
Section titled “recolor()”recolor(
name):this
Defined in: map/base-engine.ts:1172
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”this
Inherited from
Section titled “Inherited from”BaseEngine.recolor
render()
Section titled “render()”render():
this
Defined in: map/base-engine.ts:2245
Returns
Section titled “Returns”this
Inherited from
Section titled “Inherited from”BaseEngine.render
select()
Section titled “select()”Call Signature
Section titled “Call Signature”select(
name,set):this
Defined in: map/base-engine.ts:1254
Select a set of drawables: style members with the layer’s selection.selected
(default: keep base style) and the complement with selection.others (default
{ opacity: 0.3 }). One O(n) compose + one styles-only push — click-time cost
only, nothing per frame. null clears. NOTE: selection rewrites the layer’s
whole override map, so it replaces earlier setStyle overrides (one table, last
write wins) — and select(null) restores plain base styles.
Also updates the managed selection set and fires on("select") with ev = undefined
(programmatic — no PointerEvent), so callers can observe programmatic selection the
same way they observe gesture selection.
On a layer the engine has yet to draw (awaitedLayer, e.g. a network waiting for its LOD tree) the selection is kept and observed at once, and styled when the layer is drawn.
The predicate overload is generic over the layer’s datum type D — annotate the
parameter ((d: MyDatum) => …) or pass select<MyDatum>(…) to get a typed datum,
mirroring d3-selection’s caller-asserted datum generics. Prefer the layer handle’s
LayerHandle.select, which already knows D from registration.
Parameters
Section titled “Parameters”string
readonly (string | number)[] | null
Returns
Section titled “Returns”this
Inherited from
Section titled “Inherited from”BaseEngine.select
Call Signature
Section titled “Call Signature”select<
D>(name,predicate):this
Defined in: map/base-engine.ts:1255
Select a set of drawables: style members with the layer’s selection.selected
(default: keep base style) and the complement with selection.others (default
{ opacity: 0.3 }). One O(n) compose + one styles-only push — click-time cost
only, nothing per frame. null clears. NOTE: selection rewrites the layer’s
whole override map, so it replaces earlier setStyle overrides (one table, last
write wins) — and select(null) restores plain base styles.
Also updates the managed selection set and fires on("select") with ev = undefined
(programmatic — no PointerEvent), so callers can observe programmatic selection the
same way they observe gesture selection.
On a layer the engine has yet to draw (awaitedLayer, e.g. a network waiting for its LOD tree) the selection is kept and observed at once, and styled when the layer is drawn.
The predicate overload is generic over the layer’s datum type D — annotate the
parameter ((d: MyDatum) => …) or pass select<MyDatum>(…) to get a typed datum,
mirroring d3-selection’s caller-asserted datum generics. Prefer the layer handle’s
LayerHandle.select, which already knows D from registration.
Type Parameters
Section titled “Type Parameters”D = unknown
Parameters
Section titled “Parameters”string
predicate
Section titled “predicate”(d, i) => boolean
Returns
Section titled “Returns”this
Inherited from
Section titled “Inherited from”BaseEngine.select
selection()
Section titled “selection()”selection():
HoverHit[]
Defined in: map/base-engine.ts:2676
Flatten the retained selection into HoverHit[], resolving datums + members() via the layer’s
Scene spec or its interactive lane (so a selected aggregate’s leaf ids are reachable, #105 N7c-2).
Returns
Section titled “Returns”HoverHit[]
Inherited from
Section titled “Inherited from”BaseEngine.selection
setBackend()
Section titled “setBackend()”setBackend(
type):this
Defined in: map/base-engine.ts:1548
Parameters
Section titled “Parameters”Returns
Section titled “Returns”this
Inherited from
Section titled “Inherited from”BaseEngine.setBackend
setClip()
Section titled “setClip()”setClip(
name,clipTo?):this
Defined in: map/base-engine.ts:1532
Parameters
Section titled “Parameters”string
clipTo?
Section titled “clipTo?”string
Returns
Section titled “Returns”this
Inherited from
Section titled “Inherited from”BaseEngine.setClip
setSize()
Section titled “setSize()”setSize(
width,height):this
Defined in: map/base-engine.ts:607
Resize the engine in place to a new CSS size (px) — no teardown. Resizes the live backend, runs the subclass onResize hook (e.g. GeoMap refits its projection), then re-renders and repaints pass-through layers. Layers, view transform, and interaction state are preserved. A no-op when the size is unchanged or either axis is zero (a collapsed/hidden layout). In responsive modes the ResizeObserver calls this automatically; callers in fixed mode use it to apply a new explicit size without recreating the engine.
Parameters
Section titled “Parameters”number
height
Section titled “height”number
Returns
Section titled “Returns”this
Inherited from
Section titled “Inherited from”BaseEngine.setSize
setStyle()
Section titled “setStyle()”setStyle(
name,ids,override):this
Defined in: map/base-engine.ts:1187
Override the style of one drawable or a set (replaces any previous override for those ids — last write wins). O(ids) compose + one styles-only push.
Parameters
Section titled “Parameters”string
string | number | readonly (string | number)[]
override
Section titled “override”Returns
Section titled “Returns”this
Inherited from
Section titled “Inherited from”BaseEngine.setStyle
setTransform()
Section titled “setTransform()”setTransform(
t):this
Defined in: map/base-engine.ts:1602
Parameters
Section titled “Parameters”Returns
Section titled “Returns”this
Inherited from
Section titled “Inherited from”BaseEngine.setTransform
stateNetwork()
Section titled “stateNetwork()”stateNetwork(
graph,opts?):this
Defined in: network/network.ts:1978
Render a state (higher-order / memory) network (#171). The engine ingests the state network (state graph + its engine-derived physical graph, from buildStateGraph) and a per-state-node module assignment, then lets you toggle between three views (view):
- the physical view — the aggregated physical network, where a physical node whose state nodes span ≥2 modules renders as a pie chart (wedges ∝ per-module flow/count, module-coloured) and a single-module node as a solid disc;
- the state view — the state graph as an ordinary network with its modules, exactly what
data(stateGraph, { modules })gives (#495): lod cuts its module tree by default, with module boundary rings,layout({ nested })lays it out by module, and hits carry NetworkHit.path; - the both view — the state nodes inside their physical node’s container disc, with state-level links.
Each view keeps its own layout (#495): layout lays out the active view’s graph — the physical graph in the physical and both views, which share that layout, the state graph in the state view — and a view switch keeps every view’s positions. A view whose layout never ran is laid out when it is first shown, with the app’s last layout options, from where its nodes are: the state view from a rosette of the state nodes around their physical node, the physical view from its state nodes’ centroids. In the both view each state node keeps its place in its container, which follows the physical layout. Colours + pie wedges + container radii are derived once here.
modules are checked against the state graph here, as data() checks its hierarchy: a record for every
state node, exactly once, and every moduleLinks endpoint a module or leaf of it (#533), or this throws with
the engine unchanged. The app’s lod request holds
(data() keeps it too); an explicit modules in it named the previous network’s, so the new network’s own
modules take its place.
Parameters
Section titled “Parameters”StateNetworkOptions = {}
Returns
Section titled “Returns”this
stopLayout()
Section titled “stopLayout()”stopLayout():
this
Defined in: network/network.ts:4094
Stop a running worker layout or position transition (no-op if none). The last computed — or
eased — positions are kept, and so is the camera: a fit ends with its layout, where it stopped
(#427). A nested layout’s transition stopped mid-ease leaves the nodes between
two layouts, so its discs no longer hold: the modules (and their rings) fall back to their members’
centroid + extent (#329). A spatial LOD tree, refit through the transition, is rebuilt where the
nodes stopped (#343), and any tree’s crowding (#426), held through it, is recomputed there.
In a state network it stops every view’s layout (#495): no view goes on with a run on its own afterwards, and a drag then moves the nodes it holds, as after a plain network’s stop. A view never laid out is still laid out when it is first shown.
Returns
Section titled “Returns”this
style()
Section titled “style()”style(
style):this
Defined in: network/network.ts:2447
Set visual style (node radius/fill/sizeMode; link & arrow appearance).
Parameters
Section titled “Parameters”Returns
Section titled “Returns”this
syncScreenGeometry()
Section titled “syncScreenGeometry()”syncScreenGeometry():
this
Defined in: network/network.ts:6151
Re-bake the SVG/Canvas screen-sizeMode half-arrow geometry to the current zoom, so a vector
backend reproduces the WebGL screen look at any zoom (the retained Scene can’t recompute a
screen-space shape per frame, so it’s baked into world coords at the active transform; see
registerNetworkScene). No-op on WebGL (the shader does it live) and when not drawing
screen-mode half-arrows. Called automatically on backend switch, at interaction-end, and after a
programmatic setTransform while zoom is enabled; call it explicitly for a “refit” button, after a
setTransform without zoom, or before a programmatic export at a chosen transform.
Returns
Section titled “Returns”this
toPNG()
Section titled “toPNG()”toPNG():
string
Defined in: map/base-engine.ts:2255
Returns
Section titled “Returns”string
Inherited from
Section titled “Inherited from”BaseEngine.toPNG
toSVG()
Section titled “toSVG()”toSVG():
string
Defined in: map/base-engine.ts:2254
Returns
Section titled “Returns”string
Inherited from
Section titled “Inherited from”BaseEngine.toSVG
update()
Section titled “update()”update(
opts):this
Defined in: network/network.ts:1648
Change the flow and the modules of the network the engine holds (#547), keeping its nodes, links, weights and
positions: what a re-clustering gives. net.update({ flow, modules, moduleLinks }) — a field left out is
unchanged, modules: null removes the modules and their links. Everything is checked first, as data
checks its hierarchy, and a bad change throws with the engine unchanged; so does a call with no network loaded.
Kept: the positions and the layout state, the camera, the selected nodes (the same ids), and the style options —
spec styles ({ by: "flow" }, { by: "module" }) re-resolve against the new flow and modules. Rebuilt: the
resolved style and module colours, the module tree (and so a LOD cut drawn from it, with its module links), the
module springs and the nested discs. A structural or spatial LOD tree is kept, with its sizes and colours
recomputed. New modules without moduleLinks clear the held module links: those name the old modules’ paths.
New modules also drop a selected module (a LOD aggregate) of the old ones, and on("select") hears the selection
left; an aggregate of a kept tree stays. The hover is cleared, as lump clears it.
A running layout stops, as data() stops it, and the positions stay where it left them: continue it warm with
layout if you want to. update() itself never lays out. The caller’s arrays are never written.
O(nodes + total module path length + module links) for the checks and the copied flow — no topology rebuild, no
layout — plus the module tree build when a LOD cut draws modules. That build takes the path a reload takes, so
the main thread blocks no longer than on one: on a plain network it runs at the end of the call chain, as
lod builds one after data, so a layout chained after update() that builds the tree on a
worker (#428) builds this one there too; nothing is drawn until it lands. On a state network the state view
builds it on the main thread, as stateNetwork and a view switch do.
On a stateNetwork the change is indexed per state node. The physical flow is its state nodes’ sum, and
the pies, module colours, the state view’s modules and module links, and the both view’s packing follow the new
flow and modules. Every view keeps its positions, its camera and its layout state. The runs stop: the active
view’s is the caller’s to continue, and a parked view whose run had not settled runs again, warm, when it is
shown, from full heat (the heat it had reached belonged to the old flow and modules); a settled parked run is
stopped. Lumped (lump), the lumps are made again from the new modules: each starts at its state nodes’
centroid in the state view’s picture. update() starts no layout, so in a lumped state view on screen the new
lumps stay there until the caller’s warm layout; a state view shown later settles them with a warm run of
the app’s last layout options, as after lump(true). The selected nodes are kept, a lump’s mapped
through its state nodes, a both-view container’s to the same physical node’s.
Parameters
Section titled “Parameters”Returns
Section titled “Returns”this
view()
Section titled “view()”view(
view):this
Defined in: network/network.ts:2024
Toggle the active view of the ingested state network (#171): "physical" (aggregated network with
overlapping-module pie glyphs), "state" (the state graph with its modules, #495), or "both" (state nodes
confined inside their physical container disc, state-level links). No-op without stateNetwork.
The selection follows the switch (#316, #494): a physical node becomes all its state nodes, a state node
(or a both-view container’s state nodes) its physical node, and on("select") hears the mapped
selection. The hover is cleared. The app’s lod carries over: the state view draws it, the others in full.
Each view keeps its layout (#495): the switch keeps the positions of every view, and a settled layout stays
alive for a drag to reheat when its view is shown again. A layout still running when its view is left stops
there and goes on, warm, when the view is shown again; a view never laid out is laid out with the app’s
last layout options as it is first shown (whenSettled follows that run). Each layout keeps its
camera too: a view shown again comes back at the view (pan and zoom) it was left at; the physical and both
views, which draw the same physical layout, share theirs. A view shown for the first time keeps the current
camera, or is framed by its first layout when the app’s layout options have fit.
Parameters
Section titled “Parameters”"state" | "physical" | "both"
Returns
Section titled “Returns”this
whenReady()
Section titled “whenReady()”whenReady():
Promise<void>
Defined in: map/base-engine.ts:627
Returns
Section titled “Returns”Promise<void>
Inherited from
Section titled “Inherited from”BaseEngine.whenReady
whenSettled()
Section titled “whenSettled()”whenSettled():
Promise<void>
Defined in: network/network.ts:4140
Resolves when the current worker layout converges — or its position transition ends (#328) — or is stopped (immediately if none runs).
Returns
Section titled “Returns”Promise<void>