Skip to content

Commit 96debf3

Browse files
committed
✨ feat: refactor dijkstra and dijkstra-bigint
1 parent 099ad26 commit 96debf3

17 files changed

+235
-697
lines changed

Diff for: MIGRATION.md

+36
Original file line numberDiff line numberDiff line change
@@ -71,3 +71,39 @@ No breaking changes.
7171

7272
1. Renamed to `@algorithm.ts/calculator`.
7373
2. Use `calculator.calculate(<expression>)` instead of `calculate(<expression>)`.
74+
75+
76+
### @algorithm.ts/dijkstra
77+
78+
1. `dijkstra` returns a structured result instead of a number array.
79+
80+
```typescript
81+
export interface IDijkstraResult<C extends number | bigint> {
82+
/**
83+
* A big number, representing the unreachable cost.
84+
*/
85+
INF: C
86+
/**
87+
* Source point
88+
*/
89+
source: number
90+
/**
91+
* Record the shortest path parent source point to the specified point.
92+
* For example: bestFrom[x] represents the previous position of x in the shortest path
93+
* parent the source point to x.
94+
*/
95+
bestFrom: ReadonlyArray<number>
96+
/**
97+
* An array recording the shortest distance to the source point.
98+
*/
99+
dist: ReadonlyArray<C>
100+
}
101+
```
102+
103+
### @algorithm.ts/dijkstra-bigint
104+
105+
Removed, use `@algorithm.ts/dijkstra` instead.
106+
107+
```typescript
108+
import { dijkstraBigint } from '@algorithm.ts/dijkstra'
109+
```

Diff for: packages/dijkstra-bigint/README.md

-198
This file was deleted.

Diff for: packages/dijkstra-bigint/__test__/dijkstra.spec.ts

-34
This file was deleted.

Diff for: packages/dijkstra-bigint/__test__/oj/maximum-path-quality-of-a-graph.ts

-48
This file was deleted.

Diff for: packages/dijkstra-bigint/__test__/oj/number-of-ways-to-arrive-at-destination.ts

-52
This file was deleted.

0 commit comments

Comments
 (0)