Skip to content

FloydWarshallResult = { negativeCycle: false; distance: Float64Array; } | { negativeCycle: true; vertex: number; }

Defined in: packages/graph/src/floyd-warshall.ts:10

Every pairwise shortest distance, or a vertex on a negative cycle that makes shortest distances undefined. Exactly one of the two answers holds, and negativeCycle says which.

{ negativeCycle: false; distance: Float64Array; }

readonly negativeCycle: false

readonly distance: Float64Array

Row-major n × n: distance[from * n + to] is the least total weight, or Infinity when unreachable.


{ negativeCycle: true; vertex: number; }

readonly negativeCycle: true

readonly vertex: number

A vertex on a cycle of negative total weight: walking the cycle from it returns to it.