Package: effect
Module: Graph
Result of a shortest path computation.
When to use
Use to read the successful source-to-target shortest path returned by path-finding algorithms, including the ordered node indices, total distance, and traversed edge data.
Details
Contains the node-index path, the total numeric distance, and the edge data encountered along the path.
Gotchas
costs contains original edge data, not the numeric output of the cost
function unless the edge data is numeric.
See
dijkstra for shortest paths with non-negative edge costsastar for heuristic shortest-path searchbellmanFord for shortest paths that may include negative edge weightsAllPairsResult for the all-pairs shortest-path result shapeSignature
export interface PathResult<E> {
readonly path: Array<NodeIndex>
readonly distance: number
readonly costs: Array<E>
}
Since v3.18.0