algorithms

algorithms.shortestPath

shortestPath(options: ShortestPathOptions & PathfindingResultOptions): object

Find the shortest path between two nodes using Dijkstra's algorithm.

Runs synchronously on the main thread. When selectResult is true the resulting nodes and edges are immediately selected via SelectionApi (not recorded in history as a separate step). Not undoable.

optionsShortestPathOptions & PathfindingResultOptionsShortestPathOptions extended with PathfindingResultOptions. Must include source and target node ids.

Returns: object

Example

const path = api.algorithms.shortestPath({ source: "s1", target: "s5", selectResult: true });