Skip to content

edgeAttribute

method

Back to Helios Network JS/WASM API

Kind
method
Source
src/js/HeliosNetwork.js:5573

Description

Defines or updates one edge attribute and returns the network for chaining.

Signature

edgeAttribute(name, valueOrFn, options = {}) {

Parameters

NameTypeAttributesDefaultDescription
namestringAttribute identifier.
valueOrFn*|function(*, number, number, HeliosNetwork): *Scalar, array-like values, or callback.
optionsAttributeWriteOptionsoptionalOptional type, dimension, and indexing controls.

Returns

This network.

Type HeliosNetwork

Notes

Array-like values are aligned to the active edge ordinal by default. Pass { indexBy: 'id' } when your values are keyed by stable edge id instead. For bulk streaming writes into existing typed arrays, use the explicit buffer API.

Example

net.edgeAttribute('capacity', [10, 20, 30]);