Skip to content

@graphty/graph-io / @graphty/graph-io / ExplicitWeights

Interface: ExplicitWeights ​

Defined in: common/weights.ts:147

The explicit weights of a snapshot for exporters: the weight role column when present (its validity says which edges had an explicit weight, its dtype how the value is written), else edgeList().weights as f32 for every edge of a weighted snapshot; nothing for an unweighted one. One implementation for every exporter.

Properties ​

dtype ​

readonly dtype: "f32" | "f64"

Defined in: common/weights.ts:151

The dtype the values are read from: the shadow column's, or f32 for the arc array.


weighted ​

readonly weighted: boolean

Defined in: common/weights.ts:149

Whether any edge can have an explicit weight (the snapshot is weighted).

Methods ​

isExplicit() ​

isExplicit(e): boolean

Defined in: common/weights.ts:157

Whether an edge's weight was explicit in the source.

Parameters ​

e ​

number

the logical edge index

Returns ​

boolean

true when the exporter must write it


text() ​

text(e, integral?): string | null

Defined in: common/weights.ts:172

The weight text of an edge: the shortest round-tripping decimal for its dtype, or the integer digits when integral is requested and the value is an integer; null when the weight was defaulted.

Parameters ​

e ​

number

the logical edge index

integral? ​

boolean

write an integral value without a decimal part (formats declaring an int weight)

Returns ​

string | null

the text, or null


value() ​

value(e): number

Defined in: common/weights.ts:163

The weight value of an edge (meaningful when explicit).

Parameters ​

e ​

number

the logical edge index

Returns ​

number

the value