@xingwangzhe/bfs-rs 0.1.5 → 0.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +74 -141
- package/bfs-rs.darwin-arm64.node +0 -0
- package/bfs-rs.darwin-x64.node +0 -0
- package/bfs-rs.linux-arm64-gnu.node +0 -0
- package/bfs-rs.linux-x64-gnu.node +0 -0
- package/bfs-rs.linux-x64-musl.node +0 -0
- package/bfs-rs.win32-x64-msvc.node +0 -0
- package/index.d.ts +7 -35
- package/index.js +53 -52
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2,203 +2,136 @@
|
|
|
2
2
|
|
|
3
3
|
# @xingwangzhe/bfs-rs
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Fast BFS (Breadth-First Search) for large-scale graphs, written in Rust with Rayon parallelism. Uses CSR (Compressed Sparse Row) adjacency format.
|
|
6
|
+
|
|
7
|
+
- **16-core** parallel `bfsAllHistogram`: 57K nodes in **~3s**
|
|
8
|
+
- **Single-core** auto-fallback: sequential path with zero Rayon overhead
|
|
9
|
+
- **Histogram-only** API: no full distance arrays, O(histogram) memory per source
|
|
6
10
|
|
|
7
11
|
## Installation
|
|
8
12
|
|
|
9
13
|
```bash
|
|
10
14
|
npm install @xingwangzhe/bfs-rs
|
|
11
|
-
# or
|
|
12
|
-
yarn add @xingwangzhe/bfs-rs
|
|
13
15
|
```
|
|
14
16
|
|
|
15
17
|
## Data Format
|
|
16
18
|
|
|
17
|
-
|
|
19
|
+
Uses **CSR (Compressed Sparse Row)**:
|
|
18
20
|
|
|
19
21
|
```
|
|
20
|
-
adj = [1, 2, 0, 2, 0, 1, 3, 2] // all neighbor
|
|
21
|
-
offsets = [0, 2, 4, 7, 8] //
|
|
22
|
+
adj = [1, 2, 0, 2, 0, 1, 3, 2] // all neighbor IDs flattened
|
|
23
|
+
offsets = [0, 2, 4, 7, 8] // node offset range (length = n + 1)
|
|
22
24
|
```
|
|
23
25
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
|
27
|
-
|
|
28
|
-
|
|
|
29
|
-
|
|
|
30
|
-
| 2 | 0, 1, 3 |
|
|
31
|
-
| 3 | 2 |
|
|
32
|
-
|
|
33
|
-
Elements in `adj` from `offsets[i]` to `offsets[i+1]` are the neighbors of node `i`.
|
|
26
|
+
| Node | Neighbors |
|
|
27
|
+
|------|-----------------------|
|
|
28
|
+
| 0 | adj[0..2] = [1, 2] |
|
|
29
|
+
| 1 | adj[2..4] = [0, 2] |
|
|
30
|
+
| 2 | adj[4..7] = [0, 1, 3] |
|
|
31
|
+
| 3 | adj[7..8] = [2] |
|
|
34
32
|
|
|
35
33
|
## API
|
|
36
34
|
|
|
37
|
-
###
|
|
35
|
+
### Full Distance API — when you need per-node distances
|
|
38
36
|
|
|
39
|
-
|
|
37
|
+
#### bfsOne(adj, offsets, n, source)
|
|
38
|
+
|
|
39
|
+
Single-source BFS, returns distances array.
|
|
40
40
|
|
|
41
41
|
```ts
|
|
42
42
|
import { bfsOne } from '@xingwangzhe/bfs-rs';
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
const result = bfsOne(adj, offsets, n, 0);
|
|
49
|
-
// result.distances → [0, 1, 1, 2] // shortest distances from node 0
|
|
50
|
-
// result.maxDistance → 2 // maximum finite distance
|
|
51
|
-
// result.histogram → [2, 1] // 2 nodes at dist 1, 1 node at dist 2
|
|
43
|
+
const r = bfsOne(adj, offsets, n, 0);
|
|
44
|
+
// r.distances → [0, 1, 1, 2]
|
|
45
|
+
// r.maxDistance → 2
|
|
46
|
+
// r.histogram → [2, 1]
|
|
52
47
|
```
|
|
53
48
|
|
|
54
|
-
|
|
55
|
-
| Param | Type | Description |
|
|
56
|
-
|---------|----------|-------------------------------|
|
|
57
|
-
| adj | number[] | Flattened adjacency array |
|
|
58
|
-
| offsets | number[] | Offset array, length = n + 1 |
|
|
59
|
-
| n | number | Total number of nodes |
|
|
60
|
-
| source | number | Source node ID (0-based) |
|
|
61
|
-
|
|
62
|
-
**Returns:** `BfsOneResult`
|
|
63
|
-
| Field | Type | Description |
|
|
64
|
-
|-------------|----------|------------------------------------------|
|
|
65
|
-
| distances | number[] | Shortest distance to each node, -1 = unreachable |
|
|
66
|
-
| maxDistance | number | Maximum distance among reachable nodes |
|
|
67
|
-
| histogram | number[] | histogram[d-1] = nodes at distance d |
|
|
68
|
-
|
|
69
|
-
---
|
|
70
|
-
|
|
71
|
-
### bfsBatch(adj, offsets, n, sources)
|
|
49
|
+
#### bfsBatch(adj, offsets, n, sources)
|
|
72
50
|
|
|
73
|
-
|
|
51
|
+
Parallel BFS from multiple sources.
|
|
74
52
|
|
|
75
53
|
```ts
|
|
76
54
|
import { bfsBatch } from '@xingwangzhe/bfs-rs';
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
const result = bfsBatch(adj, offsets, n, sources);
|
|
80
|
-
|
|
81
|
-
result.processed; // 2 (number of sources processed)
|
|
82
|
-
result.results; // [BfsOneResult, BfsOneResult]
|
|
55
|
+
const r = bfsBatch(adj, offsets, n, [0, 3]);
|
|
56
|
+
// r.processed → 2, r.results → [BfsOneResult, BfsOneResult]
|
|
83
57
|
```
|
|
84
58
|
|
|
85
|
-
|
|
86
|
-
| Param | Type | Description |
|
|
87
|
-
|---------|----------|------------------------------|
|
|
88
|
-
| adj | number[] | Flattened adjacency array |
|
|
89
|
-
| offsets | number[] | Offset array, length = n + 1 |
|
|
90
|
-
| n | number | Total number of nodes |
|
|
91
|
-
| sources | number[] | Source node IDs |
|
|
92
|
-
|
|
93
|
-
**Returns:** `BfsBatchResult`
|
|
94
|
-
| Field | Type | Description |
|
|
95
|
-
|-----------|----------------|--------------------------------|
|
|
96
|
-
| results | BfsOneResult[] | BFS result for each source |
|
|
97
|
-
| processed | number | Number of sources successfully processed |
|
|
98
|
-
|
|
99
|
-
---
|
|
100
|
-
|
|
101
|
-
### bfsAll(adj, offsets, n)
|
|
59
|
+
#### bfsAll(adj, offsets, n)
|
|
102
60
|
|
|
103
|
-
|
|
61
|
+
All-pairs BFS (every node as source).
|
|
104
62
|
|
|
105
63
|
```ts
|
|
106
64
|
import { bfsAll } from '@xingwangzhe/bfs-rs';
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
// computes all-pairs shortest paths, n nodes processed in parallel
|
|
65
|
+
const r = bfsAll(adj, offsets, n);
|
|
66
|
+
// r.results.length === n
|
|
110
67
|
```
|
|
111
68
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
---
|
|
69
|
+
#### bfsPath(adj, offsets, n, source, target)
|
|
115
70
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
Find the **shortest path** between two nodes using BFS + parent backtracking. Stops early when the target is found.
|
|
71
|
+
Shortest path between two nodes. Stops early at target.
|
|
119
72
|
|
|
120
73
|
```ts
|
|
121
74
|
import { bfsPath } from '@xingwangzhe/bfs-rs';
|
|
122
|
-
|
|
123
75
|
const r = bfsPath(adj, offsets, n, 0, 3);
|
|
124
|
-
// r.path
|
|
125
|
-
// r.distance → 2 // number of edges, -1 if unreachable
|
|
76
|
+
// r.path → [0, 2, 3], r.distance → 2
|
|
126
77
|
```
|
|
127
78
|
|
|
128
|
-
|
|
79
|
+
### Histogram-Only API — memory-efficient for large graphs
|
|
129
80
|
|
|
130
|
-
|
|
131
|
-
|----------|----------|----------------------------------------------|
|
|
132
|
-
| path | number[] | Shortest path node sequence (empty if unreachable) |
|
|
133
|
-
| distance | number | Number of edges (-1 if unreachable) |
|
|
81
|
+
These return **only the distance histogram** per source (no full `distances` array), making them ideal for six-degree / diameter stats on graphs with 50K+ nodes.
|
|
134
82
|
|
|
135
|
-
|
|
83
|
+
#### bfsOneHistogram / bfsBatchHistogram / bfsAllHistogram
|
|
136
84
|
|
|
137
|
-
|
|
85
|
+
Same usage as above, but result type is `BfsHistogramResult`:
|
|
138
86
|
|
|
139
87
|
```ts
|
|
140
|
-
import {
|
|
141
|
-
|
|
142
|
-
//
|
|
143
|
-
//
|
|
144
|
-
// | |
|
|
145
|
-
// 3 ------- 4
|
|
146
|
-
//
|
|
147
|
-
// CSR format:
|
|
148
|
-
const adj = [1, 3, 0, 2, 1, 4, 0, 4, 2, 3];
|
|
149
|
-
const offsets = [0, 2, 4, 6, 8, 10];
|
|
150
|
-
const n = 5;
|
|
151
|
-
|
|
152
|
-
// 1. Single-source BFS
|
|
153
|
-
const r1 = bfsOne(adj, offsets, n, 0);
|
|
154
|
-
console.log.'From node 0:', r1.distances);
|
|
155
|
-
// [0, 1, 2, 1, 2]
|
|
156
|
-
|
|
157
|
-
// 2. Batch BFS
|
|
158
|
-
const r2 = bfsBatch(adj, offsets, n, [0, 4]);
|
|
159
|
-
console.log.'Batch count:', r2.processed); // 2
|
|
160
|
-
r2.results.forEach((res, i) => {
|
|
161
|
-
console.log.`Source ${[0, 4][i]}:`, res.distances);
|
|
162
|
-
});
|
|
163
|
-
|
|
164
|
-
// 3. Shortest path
|
|
165
|
-
const r4 = bfsPath(adj, offsets, n, 0, 4);
|
|
166
|
-
console.log."Path 0→4:", r4.path); // [0, 1, 2, 4] or similar
|
|
167
|
-
|
|
168
|
-
// 4. All-pairs BFS
|
|
169
|
-
const r5 = bfsAll(adj, offsets, n);
|
|
170
|
-
console.log.'All-pairs count:', r3.processed); // 5
|
|
88
|
+
import { bfsAllHistogram } from '@xingwangzhe/bfs-rs';
|
|
89
|
+
const r = bfsAllHistogram(adj, offsets, n);
|
|
90
|
+
// r.results[i].histogram → [count_at_dist_1, count_at_dist_2, ...]
|
|
91
|
+
// r.results[i].maxDistance → number
|
|
171
92
|
```
|
|
172
93
|
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
- Written in **Rust**, compiled to native machine code
|
|
176
|
-
- BFS queue powered by [`parallel_frontier`](https://crates.io/crates/parallel_frontier) — lock-free, cache-line-padded frontier
|
|
177
|
-
- Batch/all-pairs BFS uses **Rayon** for parallel scheduling across CPU cores
|
|
178
|
-
- Memory-efficient CSR format optimized for large graphs
|
|
94
|
+
Memory per source: ~(diameter × 4) bytes instead of ~(n × 4) bytes.
|
|
179
95
|
|
|
180
|
-
##
|
|
96
|
+
## Performance
|
|
181
97
|
|
|
182
|
-
|
|
98
|
+
| Platform | 57K nodes × 179K edges | Notes |
|
|
99
|
+
|------------|----------------------|---------------------------|
|
|
100
|
+
| 16-core | **~3s** | Rayon `par_iter` across 16 threads |
|
|
101
|
+
| 1-core | ~70s | auto-fallback to `iter` |
|
|
183
102
|
|
|
184
|
-
|
|
103
|
+
All BFS functions use **dual-`Vec` swap** level traversal with zero allocation per level.
|
|
185
104
|
|
|
186
|
-
|
|
105
|
+
## Full Example
|
|
187
106
|
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
- Yarn
|
|
107
|
+
```ts
|
|
108
|
+
import { bfsOne, bfsBatch, bfsAll, bfsPath, bfsAllHistogram } from '@xingwangzhe/bfs-rs';
|
|
191
109
|
|
|
192
|
-
|
|
110
|
+
// Graph: 0--1--2, 0--3--4--2
|
|
111
|
+
const adj = [1, 3, 0, 2, 1, 4, 0, 4, 2, 3];
|
|
112
|
+
const offsets = [0, 2, 4, 6, 8, 10];
|
|
113
|
+
const n = 5;
|
|
193
114
|
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
115
|
+
// Full distances
|
|
116
|
+
const r1 = bfsOne(adj, offsets, n, 0);
|
|
117
|
+
console.log(r1.distances); // [0, 1, 2, 1, 2]
|
|
118
|
+
|
|
119
|
+
// Shortest path
|
|
120
|
+
const r2 = bfsPath(adj, offsets, n, 0, 4);
|
|
121
|
+
console.log(r2.path); // [0, 1, 2, 4] or [0, 3, 4, 2]
|
|
122
|
+
|
|
123
|
+
// Histogram-only (memory efficient)
|
|
124
|
+
const r3 = bfsAllHistogram(adj, offsets, n);
|
|
125
|
+
// Aggregate in JS:
|
|
126
|
+
const degreeDist = {};
|
|
127
|
+
for (const h of r3.results) {
|
|
128
|
+
for (let d = 0; d < h.histogram.length; d++) {
|
|
129
|
+
degreeDist[d + 1] = (degreeDist[d + 1] || 0) + h.histogram[d];
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
// degreeDist[1] = divide by 2 for undirected pair count
|
|
198
133
|
```
|
|
199
134
|
|
|
200
135
|
## License
|
|
201
136
|
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
Dependency [`parallel_frontier`](https://crates.io/crates/parallel_frontier) is used under the Apache-2.0 option of its license.
|
|
137
|
+
MIT OR Apache-2.0
|
package/bfs-rs.darwin-arm64.node
CHANGED
|
Binary file
|
package/bfs-rs.darwin-x64.node
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/index.d.ts
CHANGED
|
@@ -1,76 +1,48 @@
|
|
|
1
1
|
/* auto-generated by NAPI-RS */
|
|
2
2
|
/* eslint-disable */
|
|
3
|
-
/** 从所有节点并行执行 BFS(全量) */
|
|
4
3
|
export declare function bfsAll(adj: Array<number>, offsets: Array<number>, n: number): BfsBatchResult
|
|
5
4
|
|
|
6
|
-
/** 从所有节点并行执行 BFS(全量),仅返回直方图 */
|
|
7
5
|
export declare function bfsAllHistogram(adj: Array<number>, offsets: Array<number>, n: number): BfsHistogramBatchResult
|
|
8
6
|
|
|
9
|
-
/**
|
|
10
|
-
* 从多个源节点并行执行 BFS
|
|
11
|
-
*
|
|
12
|
-
* # 参数
|
|
13
|
-
* * `adj` - 邻接表,所有邻居节点 ID 平铺
|
|
14
|
-
* * `offsets` - 每个节点在 adj 中的起始偏移,长度为 n + 1,最后一项为 adj 的长度
|
|
15
|
-
* * `n` - 总节点数
|
|
16
|
-
* * `sources` - 需要执行 BFS 的源节点 ID 列表
|
|
17
|
-
*/
|
|
18
7
|
export declare function bfsBatch(adj: Array<number>, offsets: Array<number>, n: number, sources: Array<number>): BfsBatchResult
|
|
19
8
|
|
|
20
|
-
/** 从多个源节点并行执行 BFS,仅返回距离直方图(节省内存) */
|
|
21
9
|
export declare function bfsBatchHistogram(adj: Array<number>, offsets: Array<number>, n: number, sources: Array<number>): BfsHistogramBatchResult
|
|
22
10
|
|
|
23
|
-
/** 批量 BFS 结果 */
|
|
24
11
|
export interface BfsBatchResult {
|
|
25
|
-
/** 每个源节点的 BFS 结果 */
|
|
26
12
|
results: Array<BfsOneResult>
|
|
27
|
-
/** 成功处理的源节点数 */
|
|
28
13
|
processed: number
|
|
29
14
|
}
|
|
30
15
|
|
|
31
|
-
/** 批量直方图结果 */
|
|
32
16
|
export interface BfsHistogramBatchResult {
|
|
33
|
-
/** 每个源节点的直方图结果 */
|
|
34
17
|
results: Array<BfsHistogramResult>
|
|
35
|
-
/** 成功处理的源节点数 */
|
|
36
18
|
processed: number
|
|
37
19
|
}
|
|
38
20
|
|
|
39
|
-
/** 仅直方图结果(不含完整距离数组,节省内存) */
|
|
40
21
|
export interface BfsHistogramResult {
|
|
41
|
-
/** 距离直方图:histogram[d] = 距离为 d 的节点数(不含源节点自身) */
|
|
42
22
|
histogram: Array<number>
|
|
43
|
-
/** 最大有限距离 */
|
|
44
23
|
maxDistance: number
|
|
45
24
|
}
|
|
46
25
|
|
|
47
|
-
|
|
26
|
+
export declare function bfsMergedHistogram(adj: Array<number>, offsets: Array<number>, n: number): MergedHistogram
|
|
27
|
+
|
|
48
28
|
export declare function bfsOne(adj: Array<number>, offsets: Array<number>, n: number, source: number): BfsOneResult
|
|
49
29
|
|
|
50
|
-
/** 从单个源节点执行 BFS,仅返回距离直方图(节省内存) */
|
|
51
30
|
export declare function bfsOneHistogram(adj: Array<number>, offsets: Array<number>, n: number, source: number): BfsHistogramResult
|
|
52
31
|
|
|
53
|
-
/** 单源 BFS 结果 */
|
|
54
32
|
export interface BfsOneResult {
|
|
55
|
-
/** 源节点到每个节点的最短距离(-1 表示不可达) */
|
|
56
33
|
distances: Array<number>
|
|
57
|
-
/** 最大有限距离 */
|
|
58
34
|
maxDistance: number
|
|
59
|
-
/** 距离直方图:histogram[d] = 距离为 d 的节点数(不含源节点自身) */
|
|
60
35
|
histogram: Array<number>
|
|
61
36
|
}
|
|
62
37
|
|
|
63
|
-
/**
|
|
64
|
-
* 计算从 source 到 target 的最短路径(BFS + 父节点回溯)
|
|
65
|
-
*
|
|
66
|
-
* 找到 target 时立即终止,不遍历全图。
|
|
67
|
-
* 不可达时 path 为空数组,distance 为 -1。
|
|
68
|
-
*/
|
|
69
38
|
export declare function bfsPath(adj: Array<number>, offsets: Array<number>, n: number, source: number, target: number): BfsPathResult
|
|
70
39
|
|
|
71
40
|
export interface BfsPathResult {
|
|
72
|
-
/** 从 source 到 target 的最短路径节点序列(含两端),不可达时为空数组 */
|
|
73
41
|
path: Array<number>
|
|
74
|
-
/** 路径长度(边数),不可达时为 -1 */
|
|
75
42
|
distance: number
|
|
76
43
|
}
|
|
44
|
+
|
|
45
|
+
export interface MergedHistogram {
|
|
46
|
+
histogram: Array<number>
|
|
47
|
+
maxDistance: number
|
|
48
|
+
}
|
package/index.js
CHANGED
|
@@ -77,8 +77,8 @@ function requireNative() {
|
|
|
77
77
|
try {
|
|
78
78
|
const binding = require('@xingwangzhe/bfs-rs-android-arm64')
|
|
79
79
|
const bindingPackageVersion = require('@xingwangzhe/bfs-rs-android-arm64/package.json').version
|
|
80
|
-
if (bindingPackageVersion !== '0.1.
|
|
81
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
80
|
+
if (bindingPackageVersion !== '0.1.6' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
81
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
82
82
|
}
|
|
83
83
|
return binding
|
|
84
84
|
} catch (e) {
|
|
@@ -93,8 +93,8 @@ function requireNative() {
|
|
|
93
93
|
try {
|
|
94
94
|
const binding = require('@xingwangzhe/bfs-rs-android-arm-eabi')
|
|
95
95
|
const bindingPackageVersion = require('@xingwangzhe/bfs-rs-android-arm-eabi/package.json').version
|
|
96
|
-
if (bindingPackageVersion !== '0.1.
|
|
97
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
96
|
+
if (bindingPackageVersion !== '0.1.6' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
97
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
98
98
|
}
|
|
99
99
|
return binding
|
|
100
100
|
} catch (e) {
|
|
@@ -114,8 +114,8 @@ function requireNative() {
|
|
|
114
114
|
try {
|
|
115
115
|
const binding = require('@xingwangzhe/bfs-rs-win32-x64-gnu')
|
|
116
116
|
const bindingPackageVersion = require('@xingwangzhe/bfs-rs-win32-x64-gnu/package.json').version
|
|
117
|
-
if (bindingPackageVersion !== '0.1.
|
|
118
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
117
|
+
if (bindingPackageVersion !== '0.1.6' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
118
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
119
119
|
}
|
|
120
120
|
return binding
|
|
121
121
|
} catch (e) {
|
|
@@ -130,8 +130,8 @@ function requireNative() {
|
|
|
130
130
|
try {
|
|
131
131
|
const binding = require('@xingwangzhe/bfs-rs-win32-x64-msvc')
|
|
132
132
|
const bindingPackageVersion = require('@xingwangzhe/bfs-rs-win32-x64-msvc/package.json').version
|
|
133
|
-
if (bindingPackageVersion !== '0.1.
|
|
134
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
133
|
+
if (bindingPackageVersion !== '0.1.6' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
134
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
135
135
|
}
|
|
136
136
|
return binding
|
|
137
137
|
} catch (e) {
|
|
@@ -147,8 +147,8 @@ function requireNative() {
|
|
|
147
147
|
try {
|
|
148
148
|
const binding = require('@xingwangzhe/bfs-rs-win32-ia32-msvc')
|
|
149
149
|
const bindingPackageVersion = require('@xingwangzhe/bfs-rs-win32-ia32-msvc/package.json').version
|
|
150
|
-
if (bindingPackageVersion !== '0.1.
|
|
151
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
150
|
+
if (bindingPackageVersion !== '0.1.6' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
151
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
152
152
|
}
|
|
153
153
|
return binding
|
|
154
154
|
} catch (e) {
|
|
@@ -163,8 +163,8 @@ function requireNative() {
|
|
|
163
163
|
try {
|
|
164
164
|
const binding = require('@xingwangzhe/bfs-rs-win32-arm64-msvc')
|
|
165
165
|
const bindingPackageVersion = require('@xingwangzhe/bfs-rs-win32-arm64-msvc/package.json').version
|
|
166
|
-
if (bindingPackageVersion !== '0.1.
|
|
167
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
166
|
+
if (bindingPackageVersion !== '0.1.6' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
167
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
168
168
|
}
|
|
169
169
|
return binding
|
|
170
170
|
} catch (e) {
|
|
@@ -182,8 +182,8 @@ function requireNative() {
|
|
|
182
182
|
try {
|
|
183
183
|
const binding = require('@xingwangzhe/bfs-rs-darwin-universal')
|
|
184
184
|
const bindingPackageVersion = require('@xingwangzhe/bfs-rs-darwin-universal/package.json').version
|
|
185
|
-
if (bindingPackageVersion !== '0.1.
|
|
186
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
185
|
+
if (bindingPackageVersion !== '0.1.6' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
186
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
187
187
|
}
|
|
188
188
|
return binding
|
|
189
189
|
} catch (e) {
|
|
@@ -198,8 +198,8 @@ function requireNative() {
|
|
|
198
198
|
try {
|
|
199
199
|
const binding = require('@xingwangzhe/bfs-rs-darwin-x64')
|
|
200
200
|
const bindingPackageVersion = require('@xingwangzhe/bfs-rs-darwin-x64/package.json').version
|
|
201
|
-
if (bindingPackageVersion !== '0.1.
|
|
202
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
201
|
+
if (bindingPackageVersion !== '0.1.6' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
202
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
203
203
|
}
|
|
204
204
|
return binding
|
|
205
205
|
} catch (e) {
|
|
@@ -214,8 +214,8 @@ function requireNative() {
|
|
|
214
214
|
try {
|
|
215
215
|
const binding = require('@xingwangzhe/bfs-rs-darwin-arm64')
|
|
216
216
|
const bindingPackageVersion = require('@xingwangzhe/bfs-rs-darwin-arm64/package.json').version
|
|
217
|
-
if (bindingPackageVersion !== '0.1.
|
|
218
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
217
|
+
if (bindingPackageVersion !== '0.1.6' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
218
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
219
219
|
}
|
|
220
220
|
return binding
|
|
221
221
|
} catch (e) {
|
|
@@ -234,8 +234,8 @@ function requireNative() {
|
|
|
234
234
|
try {
|
|
235
235
|
const binding = require('@xingwangzhe/bfs-rs-freebsd-x64')
|
|
236
236
|
const bindingPackageVersion = require('@xingwangzhe/bfs-rs-freebsd-x64/package.json').version
|
|
237
|
-
if (bindingPackageVersion !== '0.1.
|
|
238
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
237
|
+
if (bindingPackageVersion !== '0.1.6' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
238
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
239
239
|
}
|
|
240
240
|
return binding
|
|
241
241
|
} catch (e) {
|
|
@@ -250,8 +250,8 @@ function requireNative() {
|
|
|
250
250
|
try {
|
|
251
251
|
const binding = require('@xingwangzhe/bfs-rs-freebsd-arm64')
|
|
252
252
|
const bindingPackageVersion = require('@xingwangzhe/bfs-rs-freebsd-arm64/package.json').version
|
|
253
|
-
if (bindingPackageVersion !== '0.1.
|
|
254
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
253
|
+
if (bindingPackageVersion !== '0.1.6' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
254
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
255
255
|
}
|
|
256
256
|
return binding
|
|
257
257
|
} catch (e) {
|
|
@@ -271,8 +271,8 @@ function requireNative() {
|
|
|
271
271
|
try {
|
|
272
272
|
const binding = require('@xingwangzhe/bfs-rs-linux-x64-musl')
|
|
273
273
|
const bindingPackageVersion = require('@xingwangzhe/bfs-rs-linux-x64-musl/package.json').version
|
|
274
|
-
if (bindingPackageVersion !== '0.1.
|
|
275
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
274
|
+
if (bindingPackageVersion !== '0.1.6' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
275
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
276
276
|
}
|
|
277
277
|
return binding
|
|
278
278
|
} catch (e) {
|
|
@@ -287,8 +287,8 @@ function requireNative() {
|
|
|
287
287
|
try {
|
|
288
288
|
const binding = require('@xingwangzhe/bfs-rs-linux-x64-gnu')
|
|
289
289
|
const bindingPackageVersion = require('@xingwangzhe/bfs-rs-linux-x64-gnu/package.json').version
|
|
290
|
-
if (bindingPackageVersion !== '0.1.
|
|
291
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
290
|
+
if (bindingPackageVersion !== '0.1.6' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
291
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
292
292
|
}
|
|
293
293
|
return binding
|
|
294
294
|
} catch (e) {
|
|
@@ -305,8 +305,8 @@ function requireNative() {
|
|
|
305
305
|
try {
|
|
306
306
|
const binding = require('@xingwangzhe/bfs-rs-linux-arm64-musl')
|
|
307
307
|
const bindingPackageVersion = require('@xingwangzhe/bfs-rs-linux-arm64-musl/package.json').version
|
|
308
|
-
if (bindingPackageVersion !== '0.1.
|
|
309
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
308
|
+
if (bindingPackageVersion !== '0.1.6' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
309
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
310
310
|
}
|
|
311
311
|
return binding
|
|
312
312
|
} catch (e) {
|
|
@@ -321,8 +321,8 @@ function requireNative() {
|
|
|
321
321
|
try {
|
|
322
322
|
const binding = require('@xingwangzhe/bfs-rs-linux-arm64-gnu')
|
|
323
323
|
const bindingPackageVersion = require('@xingwangzhe/bfs-rs-linux-arm64-gnu/package.json').version
|
|
324
|
-
if (bindingPackageVersion !== '0.1.
|
|
325
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
324
|
+
if (bindingPackageVersion !== '0.1.6' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
325
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
326
326
|
}
|
|
327
327
|
return binding
|
|
328
328
|
} catch (e) {
|
|
@@ -339,8 +339,8 @@ function requireNative() {
|
|
|
339
339
|
try {
|
|
340
340
|
const binding = require('@xingwangzhe/bfs-rs-linux-arm-musleabihf')
|
|
341
341
|
const bindingPackageVersion = require('@xingwangzhe/bfs-rs-linux-arm-musleabihf/package.json').version
|
|
342
|
-
if (bindingPackageVersion !== '0.1.
|
|
343
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
342
|
+
if (bindingPackageVersion !== '0.1.6' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
343
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
344
344
|
}
|
|
345
345
|
return binding
|
|
346
346
|
} catch (e) {
|
|
@@ -355,8 +355,8 @@ function requireNative() {
|
|
|
355
355
|
try {
|
|
356
356
|
const binding = require('@xingwangzhe/bfs-rs-linux-arm-gnueabihf')
|
|
357
357
|
const bindingPackageVersion = require('@xingwangzhe/bfs-rs-linux-arm-gnueabihf/package.json').version
|
|
358
|
-
if (bindingPackageVersion !== '0.1.
|
|
359
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
358
|
+
if (bindingPackageVersion !== '0.1.6' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
359
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
360
360
|
}
|
|
361
361
|
return binding
|
|
362
362
|
} catch (e) {
|
|
@@ -373,8 +373,8 @@ function requireNative() {
|
|
|
373
373
|
try {
|
|
374
374
|
const binding = require('@xingwangzhe/bfs-rs-linux-loong64-musl')
|
|
375
375
|
const bindingPackageVersion = require('@xingwangzhe/bfs-rs-linux-loong64-musl/package.json').version
|
|
376
|
-
if (bindingPackageVersion !== '0.1.
|
|
377
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
376
|
+
if (bindingPackageVersion !== '0.1.6' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
377
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
378
378
|
}
|
|
379
379
|
return binding
|
|
380
380
|
} catch (e) {
|
|
@@ -389,8 +389,8 @@ function requireNative() {
|
|
|
389
389
|
try {
|
|
390
390
|
const binding = require('@xingwangzhe/bfs-rs-linux-loong64-gnu')
|
|
391
391
|
const bindingPackageVersion = require('@xingwangzhe/bfs-rs-linux-loong64-gnu/package.json').version
|
|
392
|
-
if (bindingPackageVersion !== '0.1.
|
|
393
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
392
|
+
if (bindingPackageVersion !== '0.1.6' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
393
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
394
394
|
}
|
|
395
395
|
return binding
|
|
396
396
|
} catch (e) {
|
|
@@ -407,8 +407,8 @@ function requireNative() {
|
|
|
407
407
|
try {
|
|
408
408
|
const binding = require('@xingwangzhe/bfs-rs-linux-riscv64-musl')
|
|
409
409
|
const bindingPackageVersion = require('@xingwangzhe/bfs-rs-linux-riscv64-musl/package.json').version
|
|
410
|
-
if (bindingPackageVersion !== '0.1.
|
|
411
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
410
|
+
if (bindingPackageVersion !== '0.1.6' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
411
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
412
412
|
}
|
|
413
413
|
return binding
|
|
414
414
|
} catch (e) {
|
|
@@ -423,8 +423,8 @@ function requireNative() {
|
|
|
423
423
|
try {
|
|
424
424
|
const binding = require('@xingwangzhe/bfs-rs-linux-riscv64-gnu')
|
|
425
425
|
const bindingPackageVersion = require('@xingwangzhe/bfs-rs-linux-riscv64-gnu/package.json').version
|
|
426
|
-
if (bindingPackageVersion !== '0.1.
|
|
427
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
426
|
+
if (bindingPackageVersion !== '0.1.6' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
427
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
428
428
|
}
|
|
429
429
|
return binding
|
|
430
430
|
} catch (e) {
|
|
@@ -440,8 +440,8 @@ function requireNative() {
|
|
|
440
440
|
try {
|
|
441
441
|
const binding = require('@xingwangzhe/bfs-rs-linux-ppc64-gnu')
|
|
442
442
|
const bindingPackageVersion = require('@xingwangzhe/bfs-rs-linux-ppc64-gnu/package.json').version
|
|
443
|
-
if (bindingPackageVersion !== '0.1.
|
|
444
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
443
|
+
if (bindingPackageVersion !== '0.1.6' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
444
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
445
445
|
}
|
|
446
446
|
return binding
|
|
447
447
|
} catch (e) {
|
|
@@ -456,8 +456,8 @@ function requireNative() {
|
|
|
456
456
|
try {
|
|
457
457
|
const binding = require('@xingwangzhe/bfs-rs-linux-s390x-gnu')
|
|
458
458
|
const bindingPackageVersion = require('@xingwangzhe/bfs-rs-linux-s390x-gnu/package.json').version
|
|
459
|
-
if (bindingPackageVersion !== '0.1.
|
|
460
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
459
|
+
if (bindingPackageVersion !== '0.1.6' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
460
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
461
461
|
}
|
|
462
462
|
return binding
|
|
463
463
|
} catch (e) {
|
|
@@ -476,8 +476,8 @@ function requireNative() {
|
|
|
476
476
|
try {
|
|
477
477
|
const binding = require('@xingwangzhe/bfs-rs-openharmony-arm64')
|
|
478
478
|
const bindingPackageVersion = require('@xingwangzhe/bfs-rs-openharmony-arm64/package.json').version
|
|
479
|
-
if (bindingPackageVersion !== '0.1.
|
|
480
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
479
|
+
if (bindingPackageVersion !== '0.1.6' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
480
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
481
481
|
}
|
|
482
482
|
return binding
|
|
483
483
|
} catch (e) {
|
|
@@ -492,8 +492,8 @@ function requireNative() {
|
|
|
492
492
|
try {
|
|
493
493
|
const binding = require('@xingwangzhe/bfs-rs-openharmony-x64')
|
|
494
494
|
const bindingPackageVersion = require('@xingwangzhe/bfs-rs-openharmony-x64/package.json').version
|
|
495
|
-
if (bindingPackageVersion !== '0.1.
|
|
496
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
495
|
+
if (bindingPackageVersion !== '0.1.6' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
496
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
497
497
|
}
|
|
498
498
|
return binding
|
|
499
499
|
} catch (e) {
|
|
@@ -508,8 +508,8 @@ function requireNative() {
|
|
|
508
508
|
try {
|
|
509
509
|
const binding = require('@xingwangzhe/bfs-rs-openharmony-arm')
|
|
510
510
|
const bindingPackageVersion = require('@xingwangzhe/bfs-rs-openharmony-arm/package.json').version
|
|
511
|
-
if (bindingPackageVersion !== '0.1.
|
|
512
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
511
|
+
if (bindingPackageVersion !== '0.1.6' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
512
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
513
513
|
}
|
|
514
514
|
return binding
|
|
515
515
|
} catch (e) {
|
|
@@ -591,6 +591,7 @@ module.exports.bfsAll = nativeBinding.bfsAll
|
|
|
591
591
|
module.exports.bfsAllHistogram = nativeBinding.bfsAllHistogram
|
|
592
592
|
module.exports.bfsBatch = nativeBinding.bfsBatch
|
|
593
593
|
module.exports.bfsBatchHistogram = nativeBinding.bfsBatchHistogram
|
|
594
|
+
module.exports.bfsMergedHistogram = nativeBinding.bfsMergedHistogram
|
|
594
595
|
module.exports.bfsOne = nativeBinding.bfsOne
|
|
595
596
|
module.exports.bfsOneHistogram = nativeBinding.bfsOneHistogram
|
|
596
597
|
module.exports.bfsPath = nativeBinding.bfsPath
|