aoc-copilot
Version:
Advent of Code automatic runner for examples and inputs
35 lines • 1.27 kB
TypeScript
/**
* Dijkstra's algorithm
*
* Finds the lengths (summed weights) from a starting vertex to an ending
* vertex or all vertices.
* @param graph - Directed graph of parent to child edges with weights
* @param start - The vertex to start the search from
* @param end - [Optional] End the search when the distance to this vertex is found
* @returns
*/
declare function dijkstra(graph: Map<string, Map<string, number>>, start: string, end?: string): {
distance: number | undefined;
distances: Map<string, number>;
path: string[];
};
/**
* Floyd-Warshall algorithm
*
* Finds the lengths (summed weights) between all pairs of vertices. Suitable
* for relatively small numbers of vertices (V) since there are V**2 pairs,
* requiring V**3 loops to calculate.
* @param graph
* @returns
*/
declare function floydWarshall(graph: Map<string, Map<string, number>>): Map<string, number>;
/**
* Converts a maze-like grid into a graph
* @param grid
* @param pointsOfInterest
* @param unpassables (optional)
* @returns graph
*/
declare function gridToGraph(grid: string[][], pointsOfInterest: string[], unpassables?: string): Map<string, Map<string, number>>;
export { dijkstra, floydWarshall, gridToGraph, };
//# sourceMappingURL=distance.d.ts.map