Skip to content

@graphty/algorithms / index / indexed / bidirectionalDijkstra

Function: bidirectionalDijkstra() ​

bidirectionalDijkstra(s, sourceNode, targetNode, options?): PathResult

Defined in: indexed/point-to-point.ts:57

Bidirectional Dijkstra between two nodes: one search forward from the source, one backward from the target over reverse(), each step taken by the side whose next key is smaller, stopping once the two next keys sum to at least the best path found. That is the point-to-point query legacy dijkstraPath answers. The path is recorded as ARCS, so a parallel edge on it is the exact edge.

Parameters ​

s ​

GraphSnapshot

The snapshot to search

sourceNode ​

NodeRef

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

targetNode ​

NodeRef

The node to reach: its index, or { id }

options? ​

PathOptions = {}

Per-arc weight override

Returns ​

PathResult

The distance, the node path and the logical edges on it

Throws ​

Error when any weight is negative