algorithms

algorithms.kShortestPaths

kShortestPaths(options: KShortestPathsOptions): Promise<KPathResult>

Find the k shortest simple paths between two nodes.

Dispatched to the background worker (Yen's algorithm). Emits the standard algorithm lifecycle events. Not undoable (results are returned but never written to the store by default).

optionsKShortestPathsOptionsKShortestPathsOptions including source, target, and k.

Returns: Promise<KPathResult>

Example

const paths = await api.algorithms.kShortestPaths({ source: "s1", target: "s5", k: 3 });