Skip to content

@graphty/algorithms / index / arcSourceIn

Function: arcSourceIn() ​

arcSourceIn(rowPtr, arc): number

Defined in: indexed/structures/arc-source.ts:13

The source node of an arc, by binary search on rowPtr. GraphSnapshot exposes arcSource(a) (graph-format/src/snapshot/graph-snapshot.ts:544), but an AdjacencyView -- which is what the Port 1 and Port 2 signatures take, so that reverse() works as an input for free -- does not, so the predecessor walk carries its own.

Parameters ​

rowPtr ​

U32

The view's nodeCount + 1 row offsets

arc ​

number

An arc index in [0, arcCount)

Returns ​

number

The node index whose row contains the arc