Skip to content

Latest commit

 

History

History
86 lines (53 loc) · 3.58 KB

File metadata and controls

86 lines (53 loc) · 3.58 KB

quick-dijkstra / Exports

quick-dijkstra

Table of contents

Type aliases

Functions

Type aliases

GraphLink

Ƭ GraphLink: [nodeId1: number, nodeId2: number, weight: number]

3-tuple of integers that represents an undirected, weighted link in the graph. The format of the 3-tuple is [nodeId1, nodeId2, weight]. The nodeIds in the graph need to be sequential integers [0, 1, 2, ..., N] as the nodeIds are used directly as array indices in the C++ algorithms

Defined in: quickdijkstra.d.ts:9


QuickDijkstraResult

Ƭ QuickDijkstraResult: { averageDistance: number ; distances: number[][] ; longestShortestPath: number[] ; maximumDistance: number ; maximumPathHops: number ; pathHops: number[][] }

Type declaration:

Name Type Description
averageDistance number Average distance between a pair of nodes on the fastest paths in the graph
distances number[][] The distance matrix from each node to every other node in the graph on the fastest paths. For example, distances[3][7] is the distance from node 3 to node 7 on the fastest path in the graph. As the graphs are treated as undirected, the condition distances[x][y] === distances[y][x] always holds.
longestShortestPath number[] The longest (measured in number of hops) of the fastest paths in the graph
maximumDistance number Maximum distance between a pair of nodes on the fastest paths in the graph
maximumPathHops number Maximum number of hops between a pair of nodes on the fastest paths in the graph
pathHops number[][] The matrix containing the number of hops from each node to every other node in the graph on the fastest paths. For example, pathHops[3][7] is the number of hops from node 3 to node 7 on the fastest path in the graph. As the graphs are treated as undirected, the condition pathHops[x][y] === pathHops[y][x] always holds.

Defined in: quickdijkstra.d.ts:11

Functions

calculateShortestPaths

calculateShortestPaths(links: GraphLink[]): QuickDijkstraResult

Calculates all the shortest paths in a integer-weighted graph. Takes as its argument an array of GraphLink

Parameters:

Name Type
links GraphLink[]

Returns: QuickDijkstraResult

Defined in: quickdijkstra.d.ts:42


calculateShortestPathsFromNode

calculateShortestPathsFromNode(links: GraphLink[], nodeId: number): QuickDijkstraResult

Calculates the shortest paths from node i in a integer-weighted graph. Takes as its argument an array of GraphLink

Parameters:

Name Type
links GraphLink[]
nodeId number

Returns: QuickDijkstraResult

Defined in: quickdijkstra.d.ts:47