Skip to content

@graphty/layout / index / resolveWeights

Function: resolveWeights() ​

resolveWeights(spec, s): F32 | null

Defined in: simulation/inputs.ts:88

Resolves per-arc weights: true -> s.weights (null when unweighted); a string -> a one-component f32 / f64 / u32 / i32 edge column expanded to arcs; false / null / undefined -> null. The same dtype discipline as the GPU package's resolveWeights: a u8, bool or dict column is rejected before gpuView, whose packed words / codes are not per-edge values, and a string / list / json column is rejected as non-numeric.

Parameters ​

spec ​

string | boolean | null | undefined

the option value

s ​

GraphSnapshot

the snapshot

Returns ​

F32 | null

arcCount weights, or null for "every weight is 1"