@graphty/algorithms / index / ApspResult
Interface: ApspResult ​
Defined in: indexed/all-pairs.ts:42
All-pairs shortest paths as a dense row-major matrix.
Properties ​
dist ​
readonlydist:F64
Defined in: indexed/all-pairs.ts:44
dist[i * n + j] = distance from i to j; +Infinity unreachable, 0 on the diagonal, NaN under a negative cycle.
hasNegativeCycle ​
readonlyhasNegativeCycle:boolean
Defined in: indexed/all-pairs.ts:48
True when a negative cycle exists; dist is then all NaN and the path accessors throw.
method ​
readonlymethod:"floyd-warshall"|"bfs"|"dijkstra"
Defined in: indexed/all-pairs.ts:50
The strategy that ran.
n ​
readonlyn:number
Defined in: indexed/all-pairs.ts:46
The side of the matrix, s.nodeCount.
predArc ​
readonlypredArc:U32|null
Defined in: indexed/all-pairs.ts:52
The arc ending each shortest path, row-major; INVALID_INDEX on the diagonal and when unreachable. Null unless paths: true.
Methods ​
pathEdges() ​
pathEdges(
source,target):U32
Defined in: indexed/all-pairs.ts:64
Logical edge indices along that path; empty when unreachable or when source === target.
Parameters ​
source ​
NodeRef
The row's node: its index, or { id }
target ​
NodeRef
The column's node: its index, or { id }
Returns ​
U32
pathTo() ​
pathTo(
source,target):U32
Defined in: indexed/all-pairs.ts:58
Node indices from source to target inclusive; empty when unreachable.
Parameters ​
source ​
NodeRef
The row's node: its index, or { id }
target ​
NodeRef
The column's node: its index, or { id }
Returns ​
U32