Skip to content

NodeRadiusSpec

NodeRadiusSpec = number | Float32Array | ((value, index, graph) => number) | { by: NodeMetric; scale: (value) => number; }

Defined in: network/glyphs.ts:31

How node radius is determined. Resolves once (per style() call) to a per-node Float32Array, which is already a per-instance GPU attribute — so any of these forms is free at draw time.

  • number — one constant radius for every node.
  • Float32Array — caller-supplied per-node radii (length must equal nodeCount); used as-is.
  • function — (value, index, graph) => radius, where value is the node’s degree. A bare d3 scale fits here directly: scaleSqrt().domain([1, maxDegree]).range([2, 20]).
  • { by, scale } — feed a chosen metric through any scale: { by: "strength", scale }. Use this to size by strength/flow (or a custom accessor) with a reusable scale instead of degree.