Skip to content

@graphty/graphty-element / format / foldArcs

Function: foldArcs() ​

foldArcs<T>(snapshot, perArc, reducer, out?): T

Defined in: graph-format/dist/src/snapshot/views.d.ts:262

Reduce a per-arc vector (arcCount entries) to a per-edge vector (edgeCount entries) through arcToEdge (design section 7.5): "first" takes the value of the arc holding the declared orientation (edgeToArc[e]), "sum" / "max" / "min" combine both arcs of an undirected edge. Returns perArc itself when the permutation is the identity and no out is given.

Type Parameters ​

T ​

T extends NumericVector

Parameters ​

snapshot ​

GraphSnapshot

the snapshot the vector is aligned to

perArc ​

T

the per-arc values, arcCount entries

reducer ​

"min" | "max" | "first" | "sum"

how the arcs of one edge combine

out? ​

T

an optional destination of edgeCount entries

Returns ​

T

the per-edge vector