Skip to content

@graphty/algorithms / index / BfsResult

Interface: BfsResult ​

Defined in: indexed/bfs.ts:15

Result of the index-based BFS (graph-format design 14.2 Port 1).

Properties ​

depth ​

readonly depth: U32

Defined in: indexed/bfs.ts:21

Hop depth of every node, INVALID_INDEX for unvisited nodes.


order ​

readonly order: U32

Defined in: indexed/bfs.ts:17

Visit order, one entry per visited node; a subarray of length visitedCount.


parent ​

readonly parent: U32

Defined in: indexed/bfs.ts:19

Parent of every node, INVALID_INDEX for the start node and for unvisited nodes.


predArc ​

readonly predArc: U32

Defined in: indexed/bfs.ts:28

The ARC each node was discovered through (colIdx[predArc[v]] === v), INVALID_INDEX for the start node and for unvisited nodes. arcToEdge[predArc[v]] is the tree edge, the exact one among parallel edges.


visitedCount ​

readonly visitedCount: number

Defined in: indexed/bfs.ts:23

How many nodes were visited.

Methods ​

pathEdges() ​

pathEdges(target): U32

Defined in: indexed/bfs.ts:39

LOGICAL EDGE indices of the tree edges along that path, one fewer than pathTo; empty when target was not visited.

Parameters ​

target ​

NodeRef

The node to walk back from: its index, or { id }

Returns ​

U32


pathTo() ​

pathTo(target): U32

Defined in: indexed/bfs.ts:33

Node indices along the tree from the start to target inclusive; empty when target was not visited.

Parameters ​

target ​

NodeRef

The node to walk back from: its index, or { id }

Returns ​

U32