@graphrs/flow 0.1.0 → 0.2.0

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.
@@ -0,0 +1,19 @@
1
+ import { toWasmGraph } from './chunk-KKDSRV3J.js';
2
+
3
+ // src/max-flow.ts
4
+ async function maxFlow(graph, source, target, _options) {
5
+ const wg = await toWasmGraph(graph);
6
+ try {
7
+ const raw = JSON.parse(wg.maxFlowDetailed(source, target));
8
+ return {
9
+ value: raw.value,
10
+ flow: raw.flow
11
+ };
12
+ } finally {
13
+ wg.free();
14
+ }
15
+ }
16
+
17
+ export { maxFlow };
18
+ //# sourceMappingURL=chunk-6BNREIN2.js.map
19
+ //# sourceMappingURL=chunk-6BNREIN2.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/max-flow.ts"],"names":[],"mappings":";;;AAOA,eAAsB,OAAA,CACpB,KAAA,EACA,MAAA,EACA,MAAA,EACA,QAAA,EACqB;AACrB,EAAA,MAAM,EAAA,GAAK,MAAM,WAAA,CAAY,KAAK,CAAA;AAClC,EAAA,IAAI;AACF,IAAA,MAAM,MAAM,IAAA,CAAK,KAAA,CAAM,GAAG,eAAA,CAAgB,MAAA,EAAQ,MAAM,CAAC,CAAA;AAKzD,IAAA,OAAO;AAAA,MACL,OAAO,GAAA,CAAI,KAAA;AAAA,MACX,MAAM,GAAA,CAAI;AAAA,KACZ;AAAA,EACF,CAAA,SAAE;AACA,IAAA,EAAA,CAAG,IAAA,EAAK;AAAA,EACV;AACF","file":"chunk-6BNREIN2.js","sourcesContent":["import type { Graph, FlowResult } from '@graphrs/core';\nimport { toWasmGraph } from './utils.js';\n\nexport interface MaxFlowOptions {\n algorithm?: 'ford-fulkerson' | 'push-relabel';\n}\n\nexport async function maxFlow(\n graph: Graph,\n source: number,\n target: number,\n _options?: MaxFlowOptions,\n): Promise<FlowResult> {\n const wg = await toWasmGraph(graph);\n try {\n const raw = JSON.parse(wg.maxFlowDetailed(source, target)) as {\n value: number;\n flow: number[];\n cut: boolean[];\n };\n return {\n value: raw.value,\n flow: raw.flow,\n };\n } finally {\n wg.free();\n }\n}\n"]}
@@ -0,0 +1,17 @@
1
+ import { getWasm } from '@graphrs/core';
2
+
3
+ // src/utils.ts
4
+ async function toWasmGraph(graph) {
5
+ const { WasmGraph } = await getWasm();
6
+ const edges = graph._getEdgePairs();
7
+ const flat = new Uint32Array(edges.length * 2);
8
+ for (let i = 0; i < edges.length; i++) {
9
+ flat[i * 2] = edges[i][0];
10
+ flat[i * 2 + 1] = edges[i][1];
11
+ }
12
+ return WasmGraph.fromEdges(flat, graph.directed);
13
+ }
14
+
15
+ export { toWasmGraph };
16
+ //# sourceMappingURL=chunk-KKDSRV3J.js.map
17
+ //# sourceMappingURL=chunk-KKDSRV3J.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/utils.ts"],"names":[],"mappings":";;;AAGA,eAAsB,YAAY,KAAA,EAA0C;AAC1E,EAAA,MAAM,EAAE,SAAA,EAAU,GAAI,MAAM,OAAA,EAAQ;AACpC,EAAA,MAAM,KAAA,GAAQ,MAAM,aAAA,EAAc;AAClC,EAAA,MAAM,IAAA,GAAO,IAAI,WAAA,CAAY,KAAA,CAAM,SAAS,CAAC,CAAA;AAC7C,EAAA,KAAA,IAAS,CAAA,GAAI,CAAA,EAAG,CAAA,GAAI,KAAA,CAAM,QAAQ,CAAA,EAAA,EAAK;AACrC,IAAA,IAAA,CAAK,IAAI,CAAC,CAAA,GAAI,KAAA,CAAM,CAAC,EAAG,CAAC,CAAA;AACzB,IAAA,IAAA,CAAK,IAAI,CAAA,GAAI,CAAC,IAAI,KAAA,CAAM,CAAC,EAAG,CAAC,CAAA;AAAA,EAC/B;AACA,EAAA,OAAO,SAAA,CAAU,SAAA,CAAU,IAAA,EAAM,KAAA,CAAM,QAAQ,CAAA;AACjD","file":"chunk-KKDSRV3J.js","sourcesContent":["import type { Graph, WasmGraphInstance } from '@graphrs/core';\nimport { getWasm } from '@graphrs/core';\n\nexport async function toWasmGraph(graph: Graph): Promise<WasmGraphInstance> {\n const { WasmGraph } = await getWasm();\n const edges = graph._getEdgePairs();\n const flat = new Uint32Array(edges.length * 2);\n for (let i = 0; i < edges.length; i++) {\n flat[i * 2] = edges[i]![0];\n flat[i * 2 + 1] = edges[i]![1];\n }\n return WasmGraph.fromEdges(flat, graph.directed);\n}\n"]}
@@ -0,0 +1,33 @@
1
+ import { toWasmGraph } from './chunk-KKDSRV3J.js';
2
+
3
+ // src/connectivity.ts
4
+ async function vertexConnectivity(graph, _source, _target) {
5
+ const wg = await toWasmGraph(graph);
6
+ try {
7
+ const raw = JSON.parse(wg.vertexConnectivity());
8
+ return raw.value;
9
+ } finally {
10
+ wg.free();
11
+ }
12
+ }
13
+ async function edgeConnectivity(graph) {
14
+ const wg = await toWasmGraph(graph);
15
+ try {
16
+ const raw = JSON.parse(wg.edgeConnectivity());
17
+ return raw.value;
18
+ } finally {
19
+ wg.free();
20
+ }
21
+ }
22
+ async function isConnected(graph) {
23
+ const wg = await toWasmGraph(graph);
24
+ try {
25
+ return wg.isConnected("weak");
26
+ } finally {
27
+ wg.free();
28
+ }
29
+ }
30
+
31
+ export { edgeConnectivity, isConnected, vertexConnectivity };
32
+ //# sourceMappingURL=chunk-MANYZG4L.js.map
33
+ //# sourceMappingURL=chunk-MANYZG4L.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/connectivity.ts"],"names":[],"mappings":";;;AAGA,eAAsB,kBAAA,CACpB,KAAA,EACA,OAAA,EACA,OAAA,EACiB;AACjB,EAAA,MAAM,EAAA,GAAK,MAAM,WAAA,CAAY,KAAK,CAAA;AAClC,EAAA,IAAI;AACF,IAAA,MAAM,GAAA,GAAM,IAAA,CAAK,KAAA,CAAM,EAAA,CAAG,oBAAoB,CAAA;AAC9C,IAAA,OAAO,GAAA,CAAI,KAAA;AAAA,EACb,CAAA,SAAE;AACA,IAAA,EAAA,CAAG,IAAA,EAAK;AAAA,EACV;AACF;AAEA,eAAsB,iBAAiB,KAAA,EAA+B;AACpE,EAAA,MAAM,EAAA,GAAK,MAAM,WAAA,CAAY,KAAK,CAAA;AAClC,EAAA,IAAI;AACF,IAAA,MAAM,GAAA,GAAM,IAAA,CAAK,KAAA,CAAM,EAAA,CAAG,kBAAkB,CAAA;AAC5C,IAAA,OAAO,GAAA,CAAI,KAAA;AAAA,EACb,CAAA,SAAE;AACA,IAAA,EAAA,CAAG,IAAA,EAAK;AAAA,EACV;AACF;AAEA,eAAsB,YAAY,KAAA,EAAgC;AAChE,EAAA,MAAM,EAAA,GAAK,MAAM,WAAA,CAAY,KAAK,CAAA;AAClC,EAAA,IAAI;AACF,IAAA,OAAO,EAAA,CAAG,YAAY,MAAM,CAAA;AAAA,EAC9B,CAAA,SAAE;AACA,IAAA,EAAA,CAAG,IAAA,EAAK;AAAA,EACV;AACF","file":"chunk-MANYZG4L.js","sourcesContent":["import type { Graph } from '@graphrs/core';\nimport { toWasmGraph } from './utils.js';\n\nexport async function vertexConnectivity(\n graph: Graph,\n _source?: number,\n _target?: number,\n): Promise<number> {\n const wg = await toWasmGraph(graph);\n try {\n const raw = JSON.parse(wg.vertexConnectivity()) as { value: number };\n return raw.value;\n } finally {\n wg.free();\n }\n}\n\nexport async function edgeConnectivity(graph: Graph): Promise<number> {\n const wg = await toWasmGraph(graph);\n try {\n const raw = JSON.parse(wg.edgeConnectivity()) as { value: number };\n return raw.value;\n } finally {\n wg.free();\n }\n}\n\nexport async function isConnected(graph: Graph): Promise<boolean> {\n const wg = await toWasmGraph(graph);\n try {\n return wg.isConnected('weak');\n } finally {\n wg.free();\n }\n}\n"]}
@@ -0,0 +1,30 @@
1
+ import { toWasmGraph } from './chunk-KKDSRV3J.js';
2
+
3
+ // src/min-cut.ts
4
+ async function minCut(graph, source, target) {
5
+ const wg = await toWasmGraph(graph);
6
+ try {
7
+ const raw = JSON.parse(wg.stMincut(source, target));
8
+ const partitionSet = new Set(raw.partition);
9
+ const allNodes = graph.nodes();
10
+ const otherPartition = allNodes.filter((n) => !partitionSet.has(n));
11
+ const edgePairs = graph._getEdgePairs();
12
+ const cutEdges = [];
13
+ for (const [u, v] of edgePairs) {
14
+ if (partitionSet.has(u) && !partitionSet.has(v) || !partitionSet.has(u) && partitionSet.has(v)) {
15
+ cutEdges.push([u, v]);
16
+ }
17
+ }
18
+ return {
19
+ value: raw.value,
20
+ partition: [raw.partition, otherPartition],
21
+ cutEdges
22
+ };
23
+ } finally {
24
+ wg.free();
25
+ }
26
+ }
27
+
28
+ export { minCut };
29
+ //# sourceMappingURL=chunk-PEP5ZDF4.js.map
30
+ //# sourceMappingURL=chunk-PEP5ZDF4.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/min-cut.ts"],"names":[],"mappings":";;;AASA,eAAsB,MAAA,CAAO,KAAA,EAAc,MAAA,EAAgB,MAAA,EAAuC;AAChG,EAAA,MAAM,EAAA,GAAK,MAAM,WAAA,CAAY,KAAK,CAAA;AAClC,EAAA,IAAI;AACF,IAAA,MAAM,MAAM,IAAA,CAAK,KAAA,CAAM,GAAG,QAAA,CAAS,MAAA,EAAQ,MAAM,CAAC,CAAA;AAKlD,IAAA,MAAM,YAAA,GAAe,IAAI,GAAA,CAAI,GAAA,CAAI,SAAS,CAAA;AAC1C,IAAA,MAAM,QAAA,GAAW,MAAM,KAAA,EAAM;AAC7B,IAAA,MAAM,cAAA,GAAiB,SAAS,MAAA,CAAO,CAAC,MAAM,CAAC,YAAA,CAAa,GAAA,CAAI,CAAC,CAAC,CAAA;AAElE,IAAA,MAAM,SAAA,GAAY,MAAM,aAAA,EAAc;AACtC,IAAA,MAAM,WAA+B,EAAC;AACtC,IAAA,KAAA,MAAW,CAAC,CAAA,EAAG,CAAC,CAAA,IAAK,SAAA,EAAW;AAC9B,MAAA,IACG,aAAa,GAAA,CAAI,CAAC,CAAA,IAAK,CAAC,aAAa,GAAA,CAAI,CAAC,CAAA,IAC1C,CAAC,aAAa,GAAA,CAAI,CAAC,KAAK,YAAA,CAAa,GAAA,CAAI,CAAC,CAAA,EAC3C;AACA,QAAA,QAAA,CAAS,IAAA,CAAK,CAAC,CAAA,EAAG,CAAC,CAAC,CAAA;AAAA,MACtB;AAAA,IACF;AAEA,IAAA,OAAO;AAAA,MACL,OAAO,GAAA,CAAI,KAAA;AAAA,MACX,SAAA,EAAW,CAAC,GAAA,CAAI,SAAA,EAAW,cAAc,CAAA;AAAA,MACzC;AAAA,KACF;AAAA,EACF,CAAA,SAAE;AACA,IAAA,EAAA,CAAG,IAAA,EAAK;AAAA,EACV;AACF","file":"chunk-PEP5ZDF4.js","sourcesContent":["import type { Graph } from '@graphrs/core';\nimport { toWasmGraph } from './utils.js';\n\nexport interface MinCutResult {\n value: number;\n partition: [number[], number[]];\n cutEdges: [number, number][];\n}\n\nexport async function minCut(graph: Graph, source: number, target: number): Promise<MinCutResult> {\n const wg = await toWasmGraph(graph);\n try {\n const raw = JSON.parse(wg.stMincut(source, target)) as {\n value: number;\n cut: number[];\n partition: number[];\n };\n const partitionSet = new Set(raw.partition);\n const allNodes = graph.nodes();\n const otherPartition = allNodes.filter((n) => !partitionSet.has(n));\n\n const edgePairs = graph._getEdgePairs();\n const cutEdges: [number, number][] = [];\n for (const [u, v] of edgePairs) {\n if (\n (partitionSet.has(u) && !partitionSet.has(v)) ||\n (!partitionSet.has(u) && partitionSet.has(v))\n ) {\n cutEdges.push([u, v]);\n }\n }\n\n return {\n value: raw.value,\n partition: [raw.partition, otherPartition],\n cutEdges,\n };\n } finally {\n wg.free();\n }\n}\n"]}
@@ -1,6 +1,6 @@
1
1
  import { Graph } from '@graphrs/core';
2
2
 
3
- declare function vertexConnectivity(graph: Graph, source?: number, target?: number): Promise<number>;
3
+ declare function vertexConnectivity(graph: Graph, _source?: number, _target?: number): Promise<number>;
4
4
  declare function edgeConnectivity(graph: Graph): Promise<number>;
5
5
  declare function isConnected(graph: Graph): Promise<boolean>;
6
6
 
@@ -1,3 +1,4 @@
1
- export { edgeConnectivity, isConnected, vertexConnectivity } from './chunk-OBZGP47R.js';
1
+ export { edgeConnectivity, isConnected, vertexConnectivity } from './chunk-MANYZG4L.js';
2
+ import './chunk-KKDSRV3J.js';
2
3
  //# sourceMappingURL=connectivity.js.map
3
4
  //# sourceMappingURL=connectivity.js.map
package/dist/index.js CHANGED
@@ -1,5 +1,6 @@
1
- export { edgeConnectivity, isConnected, vertexConnectivity } from './chunk-OBZGP47R.js';
2
- export { maxFlow } from './chunk-OWHZXLI2.js';
3
- export { minCut } from './chunk-VBVHPYJK.js';
1
+ export { edgeConnectivity, isConnected, vertexConnectivity } from './chunk-MANYZG4L.js';
2
+ export { maxFlow } from './chunk-6BNREIN2.js';
3
+ export { minCut } from './chunk-PEP5ZDF4.js';
4
+ import './chunk-KKDSRV3J.js';
4
5
  //# sourceMappingURL=index.js.map
5
6
  //# sourceMappingURL=index.js.map
@@ -3,6 +3,6 @@ import { Graph, FlowResult } from '@graphrs/core';
3
3
  interface MaxFlowOptions {
4
4
  algorithm?: 'ford-fulkerson' | 'push-relabel';
5
5
  }
6
- declare function maxFlow(graph: Graph, source: number, target: number, options?: MaxFlowOptions): Promise<FlowResult>;
6
+ declare function maxFlow(graph: Graph, source: number, target: number, _options?: MaxFlowOptions): Promise<FlowResult>;
7
7
 
8
8
  export { type MaxFlowOptions, maxFlow };
package/dist/max-flow.js CHANGED
@@ -1,3 +1,4 @@
1
- export { maxFlow } from './chunk-OWHZXLI2.js';
1
+ export { maxFlow } from './chunk-6BNREIN2.js';
2
+ import './chunk-KKDSRV3J.js';
2
3
  //# sourceMappingURL=max-flow.js.map
3
4
  //# sourceMappingURL=max-flow.js.map
package/dist/min-cut.js CHANGED
@@ -1,3 +1,4 @@
1
- export { minCut } from './chunk-VBVHPYJK.js';
1
+ export { minCut } from './chunk-PEP5ZDF4.js';
2
+ import './chunk-KKDSRV3J.js';
2
3
  //# sourceMappingURL=min-cut.js.map
3
4
  //# sourceMappingURL=min-cut.js.map
package/package.json CHANGED
@@ -1,53 +1,24 @@
1
1
  {
2
2
  "name": "@graphrs/flow",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "description": "Network flow and connectivity algorithms (max-flow, min-cut) for @graphrs",
7
- "keywords": [
8
- "graph",
9
- "max-flow",
10
- "min-cut",
11
- "connectivity",
12
- "network-flow"
13
- ],
7
+ "keywords": ["graph", "max-flow", "min-cut", "connectivity", "network-flow"],
14
8
  "author": "Totoro-jam <moqiuchen66@gmail.com>",
15
9
  "homepage": "https://github.com/Totoro-jam/graphrs#readme",
16
- "bugs": {
17
- "url": "https://github.com/Totoro-jam/graphrs/issues"
18
- },
19
- "repository": {
20
- "type": "git",
21
- "url": "https://github.com/Totoro-jam/graphrs",
22
- "directory": "packages/flow"
23
- },
10
+ "bugs": { "url": "https://github.com/Totoro-jam/graphrs/issues" },
11
+ "repository": { "type": "git", "url": "https://github.com/Totoro-jam/graphrs", "directory": "packages/flow" },
24
12
  "sideEffects": false,
25
13
  "exports": {
26
- ".": {
27
- "types": "./dist/index.d.ts",
28
- "import": "./dist/index.js"
29
- },
30
- "./max-flow": {
31
- "types": "./dist/max-flow.d.ts",
32
- "import": "./dist/max-flow.js"
33
- },
34
- "./min-cut": {
35
- "types": "./dist/min-cut.d.ts",
36
- "import": "./dist/min-cut.js"
37
- },
38
- "./connectivity": {
39
- "types": "./dist/connectivity.d.ts",
40
- "import": "./dist/connectivity.js"
41
- }
14
+ ".": { "types": "./dist/index.d.ts", "import": "./dist/index.js" },
15
+ "./max-flow": { "types": "./dist/max-flow.d.ts", "import": "./dist/max-flow.js" },
16
+ "./min-cut": { "types": "./dist/min-cut.d.ts", "import": "./dist/min-cut.js" },
17
+ "./connectivity": { "types": "./dist/connectivity.d.ts", "import": "./dist/connectivity.js" }
42
18
  },
43
19
  "main": "./dist/index.js",
44
20
  "types": "./dist/index.d.ts",
45
- "files": [
46
- "dist"
47
- ],
48
- "peerDependencies": {
49
- "@graphrs/core": "^0.1.0"
50
- },
21
+ "files": ["dist"],
51
22
  "scripts": {
52
23
  "build": "tsup",
53
24
  "test": "vitest run --passWithNoTests",
@@ -55,5 +26,6 @@
55
26
  "lint": "tsc --noEmit",
56
27
  "typecheck": "tsc --noEmit",
57
28
  "clean": "rm -rf dist"
58
- }
59
- }
29
+ },
30
+ "peerDependencies": { "@graphrs/core": "workspace:^" }
31
+ }
package/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2024-present Totoro-jam
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
@@ -1,22 +0,0 @@
1
- import { getWasm } from '@graphrs/core';
2
-
3
- // src/connectivity.ts
4
- async function vertexConnectivity(graph, source, target) {
5
- await getWasm();
6
- void graph._getEdgePairs();
7
- throw new Error("Not yet implemented \u2014 WASM bindings pending");
8
- }
9
- async function edgeConnectivity(graph) {
10
- await getWasm();
11
- void graph._getEdgePairs();
12
- throw new Error("Not yet implemented \u2014 WASM bindings pending");
13
- }
14
- async function isConnected(graph) {
15
- await getWasm();
16
- void graph._getEdgePairs();
17
- throw new Error("Not yet implemented \u2014 WASM bindings pending");
18
- }
19
-
20
- export { edgeConnectivity, isConnected, vertexConnectivity };
21
- //# sourceMappingURL=chunk-OBZGP47R.js.map
22
- //# sourceMappingURL=chunk-OBZGP47R.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/connectivity.ts"],"names":[],"mappings":";;;AAEA,eAAsB,kBAAA,CACpB,KAAA,EACA,MAAA,EACA,MAAA,EACiB;AACjB,EAAc,MAAM,OAAA;AAIpB,EAAA,KAAK,MAAM,aAAA,EAAc;AACzB,EAAA,MAAM,IAAI,MAAM,kDAA6C,CAAA;AAC/D;AACA,eAAsB,iBAAiB,KAAA,EAA+B;AACpE,EAAc,MAAM,OAAA;AAEpB,EAAA,KAAK,MAAM,aAAA,EAAc;AACzB,EAAA,MAAM,IAAI,MAAM,kDAA6C,CAAA;AAC/D;AACA,eAAsB,YAAY,KAAA,EAAgC;AAChE,EAAc,MAAM,OAAA;AAEpB,EAAA,KAAK,MAAM,aAAA,EAAc;AACzB,EAAA,MAAM,IAAI,MAAM,kDAA6C,CAAA;AAC/D","file":"chunk-OBZGP47R.js","sourcesContent":["import { getWasm, type Graph } from '@graphrs/core';\n\nexport async function vertexConnectivity(\n graph: Graph,\n source?: number,\n target?: number,\n): Promise<number> {\n const _wasm = await getWasm();\n void _wasm;\n void source;\n void target;\n void graph._getEdgePairs();\n throw new Error('Not yet implemented — WASM bindings pending');\n}\nexport async function edgeConnectivity(graph: Graph): Promise<number> {\n const _wasm = await getWasm();\n void _wasm;\n void graph._getEdgePairs();\n throw new Error('Not yet implemented — WASM bindings pending');\n}\nexport async function isConnected(graph: Graph): Promise<boolean> {\n const _wasm = await getWasm();\n void _wasm;\n void graph._getEdgePairs();\n throw new Error('Not yet implemented — WASM bindings pending');\n}\n"]}
@@ -1,12 +0,0 @@
1
- import { getWasm } from '@graphrs/core';
2
-
3
- // src/max-flow.ts
4
- async function maxFlow(graph, source, target, options) {
5
- await getWasm();
6
- void graph._getEdgePairs();
7
- throw new Error("Not yet implemented \u2014 WASM bindings pending");
8
- }
9
-
10
- export { maxFlow };
11
- //# sourceMappingURL=chunk-OWHZXLI2.js.map
12
- //# sourceMappingURL=chunk-OWHZXLI2.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/max-flow.ts"],"names":[],"mappings":";;;AAMA,eAAsB,OAAA,CACpB,KAAA,EACA,MAAA,EACA,MAAA,EACA,OAAA,EACqB;AACrB,EAAc,MAAM,OAAA;AAKpB,EAAA,KAAK,MAAM,aAAA,EAAc;AACzB,EAAA,MAAM,IAAI,MAAM,kDAA6C,CAAA;AAC/D","file":"chunk-OWHZXLI2.js","sourcesContent":["import { getWasm, type Graph, type FlowResult } from '@graphrs/core';\n\nexport interface MaxFlowOptions {\n algorithm?: 'ford-fulkerson' | 'push-relabel';\n}\n\nexport async function maxFlow(\n graph: Graph,\n source: number,\n target: number,\n options?: MaxFlowOptions,\n): Promise<FlowResult> {\n const _wasm = await getWasm();\n void _wasm;\n void source;\n void target;\n void options;\n void graph._getEdgePairs();\n throw new Error('Not yet implemented — WASM bindings pending');\n}\n"]}
@@ -1,12 +0,0 @@
1
- import { getWasm } from '@graphrs/core';
2
-
3
- // src/min-cut.ts
4
- async function minCut(graph, source, target) {
5
- await getWasm();
6
- void graph._getEdgePairs();
7
- throw new Error("Not yet implemented \u2014 WASM bindings pending");
8
- }
9
-
10
- export { minCut };
11
- //# sourceMappingURL=chunk-VBVHPYJK.js.map
12
- //# sourceMappingURL=chunk-VBVHPYJK.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/min-cut.ts"],"names":[],"mappings":";;;AAQA,eAAsB,MAAA,CAAO,KAAA,EAAc,MAAA,EAAgB,MAAA,EAAuC;AAChG,EAAc,MAAM,OAAA;AAIpB,EAAA,KAAK,MAAM,aAAA,EAAc;AACzB,EAAA,MAAM,IAAI,MAAM,kDAA6C,CAAA;AAC/D","file":"chunk-VBVHPYJK.js","sourcesContent":["import { getWasm, type Graph } from '@graphrs/core';\n\nexport interface MinCutResult {\n value: number;\n partition: [number[], number[]];\n cutEdges: [number, number][];\n}\n\nexport async function minCut(graph: Graph, source: number, target: number): Promise<MinCutResult> {\n const _wasm = await getWasm();\n void _wasm;\n void source;\n void target;\n void graph._getEdgePairs();\n throw new Error('Not yet implemented — WASM bindings pending');\n}\n"]}