@graphty/algorithms
Version:
Graph algorithms library for browser environments implemented in TypeScript
29 lines • 1.48 kB
TypeScript
import type { Graph } from "../../core/graph.js";
import type { DijkstraOptions, NodeId, ShortestPathResult } from "../../types/index.js";
/**
* Dijkstra's algorithm implementation for single-source shortest paths
*
* Finds shortest paths from a source node to all other nodes in a weighted graph
* with non-negative edge weights using a priority queue for efficiency.
*/
/**
* Find shortest paths from source to all reachable nodes using Dijkstra's algorithm
*/
export declare function dijkstra(graph: Graph, source: NodeId, options?: DijkstraOptions): Map<NodeId, ShortestPathResult>;
/**
* Find shortest path between two specific nodes using optimized Dijkstra's algorithm
*
* Uses bidirectional search by default for improved performance on point-to-point queries.
* Automatically falls back to standard Dijkstra for very small graphs or when explicitly disabled.
*/
export declare function dijkstraPath(graph: Graph, source: NodeId, target: NodeId, options?: DijkstraOptions): ShortestPathResult | null;
/**
* Single-source shortest paths with early termination optimization
*/
export declare function singleSourceShortestPath(graph: Graph, source: NodeId, cutoff?: number): Map<NodeId, number>;
/**
* All-pairs shortest paths using repeated Dijkstra
* Note: For dense graphs, consider Floyd-Warshall algorithm instead
*/
export declare function allPairsShortestPath(graph: Graph): Map<NodeId, Map<NodeId, number>>;
//# sourceMappingURL=dijkstra.d.ts.map