@graphty/graph-io 0.3.19 → 0.3.21
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 +49 -4
- package/dist/chunks/{escape-CWExcecC.js → escape-B-tkk_Cl.js} +74 -16
- package/dist/chunks/escape-B-tkk_Cl.js.map +1 -0
- package/dist/chunks/{writer-DQiKgQJc.js → export-Bh60Dv-n.js} +5 -79
- package/dist/chunks/export-Bh60Dv-n.js.map +1 -0
- package/dist/chunks/{exporter-CbMZyVt-.js → exporter-BGrsWamJ.js} +7 -6
- package/dist/chunks/{exporter-CbMZyVt-.js.map → exporter-BGrsWamJ.js.map} +1 -1
- package/dist/chunks/exporter-DIeGJXAZ.js +834 -0
- package/dist/chunks/exporter-DIeGJXAZ.js.map +1 -0
- package/dist/chunks/{importer-BNFuV1-K.js → importer-BWY2FFc5.js} +28 -7
- package/dist/chunks/importer-BWY2FFc5.js.map +1 -0
- package/dist/chunks/importer-DD-xv9_Y.js +1471 -0
- package/dist/chunks/importer-DD-xv9_Y.js.map +1 -0
- package/dist/chunks/{importer-BAP4PrxR.js → importer-DET1tg6s.js} +30 -20
- package/dist/chunks/importer-DET1tg6s.js.map +1 -0
- package/dist/chunks/{importer-ByPGO-09.js → importer-DEcKhsmQ.js} +2 -2
- package/dist/chunks/{importer-ByPGO-09.js.map → importer-DEcKhsmQ.js.map} +1 -1
- package/dist/chunks/{importer-BW-Ft2ps.js → importer-DIrbbnAf.js} +6 -5
- package/dist/chunks/{importer-BW-Ft2ps.js.map → importer-DIrbbnAf.js.map} +1 -1
- package/dist/chunks/importer-D_e7e7LX.js +3055 -0
- package/dist/chunks/importer-D_e7e7LX.js.map +1 -0
- package/dist/chunks/{importer-Bm1_5vPS.js → importer-eUREhBGj.js} +11 -8
- package/dist/chunks/importer-eUREhBGj.js.map +1 -0
- package/dist/chunks/{importer-DOepkgnG.js → importer-vi3bSdtw.js} +4 -4
- package/dist/chunks/{importer-DOepkgnG.js.map → importer-vi3bSdtw.js.map} +1 -1
- package/dist/chunks/{importer-BVGtU1NA.js → importer-zGLo8Dg_.js} +6 -5
- package/dist/chunks/{importer-BVGtU1NA.js.map → importer-zGLo8Dg_.js.map} +1 -1
- package/dist/chunks/{json-elements-CZY1wiZh.js → json-elements-DDS8N2Dd.js} +2 -2
- package/dist/chunks/{json-elements-CZY1wiZh.js.map → json-elements-DDS8N2Dd.js.map} +1 -1
- package/dist/chunks/{records-BzNicMsf.js → records-dbRkxwaq.js} +2 -2
- package/dist/chunks/{records-BzNicMsf.js.map → records-dbRkxwaq.js.map} +1 -1
- package/dist/chunks/{report-BcWboivV.js → report-B1z4WT9e.js} +143 -111
- package/dist/chunks/{report-BcWboivV.js.map → report-B1z4WT9e.js.map} +1 -1
- package/dist/chunks/{weights-CwISIpCP.js → weights-Dzba96G3.js} +5 -5
- package/dist/chunks/{weights-CwISIpCP.js.map → weights-Dzba96G3.js.map} +1 -1
- package/dist/chunks/writer-C7flM-Ih.js +77 -0
- package/dist/chunks/writer-C7flM-Ih.js.map +1 -0
- package/dist/csv.js +6 -5
- package/dist/csv.js.map +1 -1
- package/dist/cx.js +1 -1
- package/dist/cx2.js +2 -2
- package/dist/cys.d.ts +1 -0
- package/dist/cys.js +6 -0
- package/dist/cys.js.map +1 -0
- package/dist/dot.js +1 -1
- package/dist/gexf.js +5 -4
- package/dist/gexf.js.map +1 -1
- package/dist/gml.js +12 -14
- package/dist/gml.js.map +1 -1
- package/dist/graph-io.js +288 -141
- package/dist/graph-io.js.map +1 -1
- package/dist/graphml.js +1 -1
- package/dist/json.js +1 -1
- package/dist/neo4j.js +6 -5
- package/dist/neo4j.js.map +1 -1
- package/dist/obo.js +1 -1
- package/dist/pajek.js +1 -1
- package/dist/src/common/cell-budget.d.ts +84 -0
- package/dist/src/common/cell-budget.d.ts.map +1 -0
- package/dist/src/common/cell-budget.js +138 -0
- package/dist/src/common/cell-budget.js.map +1 -0
- package/dist/src/common/input.d.ts +10 -0
- package/dist/src/common/input.d.ts.map +1 -1
- package/dist/src/common/input.js +39 -0
- package/dist/src/common/input.js.map +1 -1
- package/dist/src/common/options.d.ts +6 -0
- package/dist/src/common/options.d.ts.map +1 -1
- package/dist/src/common/options.js +1 -1
- package/dist/src/common/options.js.map +1 -1
- package/dist/src/common/xml.d.ts +37 -3
- package/dist/src/common/xml.d.ts.map +1 -1
- package/dist/src/common/xml.js +86 -6
- package/dist/src/common/xml.js.map +1 -1
- package/dist/src/common/zip.d.ts +92 -0
- package/dist/src/common/zip.d.ts.map +1 -0
- package/dist/src/common/zip.js +399 -0
- package/dist/src/common/zip.js.map +1 -0
- package/dist/src/formats/cx/importer.d.ts.map +1 -1
- package/dist/src/formats/cx/importer.js +26 -17
- package/dist/src/formats/cx/importer.js.map +1 -1
- package/dist/src/formats/cys/constants.d.ts +68 -0
- package/dist/src/formats/cys/constants.d.ts.map +1 -0
- package/dist/src/formats/cys/constants.js +76 -0
- package/dist/src/formats/cys/constants.js.map +1 -0
- package/dist/src/formats/cys/importer.d.ts +38 -0
- package/dist/src/formats/cys/importer.d.ts.map +1 -0
- package/dist/src/formats/cys/importer.js +830 -0
- package/dist/src/formats/cys/importer.js.map +1 -0
- package/dist/src/formats/cys/index.d.ts +7 -0
- package/dist/src/formats/cys/index.d.ts.map +1 -0
- package/dist/src/formats/cys/index.js +7 -0
- package/dist/src/formats/cys/index.js.map +1 -0
- package/dist/src/formats/cys/session.d.ts +132 -0
- package/dist/src/formats/cys/session.d.ts.map +1 -0
- package/dist/src/formats/cys/session.js +315 -0
- package/dist/src/formats/cys/session.js.map +1 -0
- package/dist/src/formats/cys/tables.d.ts +90 -0
- package/dist/src/formats/cys/tables.d.ts.map +1 -0
- package/dist/src/formats/cys/tables.js +293 -0
- package/dist/src/formats/cys/tables.js.map +1 -0
- package/dist/src/formats/dot/exporter.d.ts +2 -0
- package/dist/src/formats/dot/exporter.d.ts.map +1 -1
- package/dist/src/formats/dot/exporter.js +12 -0
- package/dist/src/formats/dot/exporter.js.map +1 -1
- package/dist/src/formats/dot/importer.js +6 -2
- package/dist/src/formats/dot/importer.js.map +1 -1
- package/dist/src/formats/gexf/importer.d.ts +2 -2
- package/dist/src/formats/gexf/importer.d.ts.map +1 -1
- package/dist/src/formats/gexf/importer.js +1 -1
- package/dist/src/formats/gexf/importer.js.map +1 -1
- package/dist/src/formats/gml/exporter.d.ts +0 -8
- package/dist/src/formats/gml/exporter.d.ts.map +1 -1
- package/dist/src/formats/gml/exporter.js +7 -17
- package/dist/src/formats/gml/exporter.js.map +1 -1
- package/dist/src/formats/json/exporter.d.ts.map +1 -1
- package/dist/src/formats/json/exporter.js +3 -1
- package/dist/src/formats/json/exporter.js.map +1 -1
- package/dist/src/formats/json/importer.d.ts.map +1 -1
- package/dist/src/formats/json/importer.js +3 -2
- package/dist/src/formats/json/importer.js.map +1 -1
- package/dist/src/formats/xgmml/columns.d.ts +152 -0
- package/dist/src/formats/xgmml/columns.d.ts.map +1 -0
- package/dist/src/formats/xgmml/columns.js +593 -0
- package/dist/src/formats/xgmml/columns.js.map +1 -0
- package/dist/src/formats/xgmml/constants.d.ts +196 -0
- package/dist/src/formats/xgmml/constants.d.ts.map +1 -0
- package/dist/src/formats/xgmml/constants.js +197 -0
- package/dist/src/formats/xgmml/constants.js.map +1 -0
- package/dist/src/formats/xgmml/document.d.ts +361 -0
- package/dist/src/formats/xgmml/document.d.ts.map +1 -0
- package/dist/src/formats/xgmml/document.js +695 -0
- package/dist/src/formats/xgmml/document.js.map +1 -0
- package/dist/src/formats/xgmml/emit.d.ts +341 -0
- package/dist/src/formats/xgmml/emit.d.ts.map +1 -0
- package/dist/src/formats/xgmml/emit.js +1275 -0
- package/dist/src/formats/xgmml/emit.js.map +1 -0
- package/dist/src/formats/xgmml/exporter.d.ts +24 -0
- package/dist/src/formats/xgmml/exporter.d.ts.map +1 -0
- package/dist/src/formats/xgmml/exporter.js +999 -0
- package/dist/src/formats/xgmml/exporter.js.map +1 -0
- package/dist/src/formats/xgmml/importer.d.ts +58 -0
- package/dist/src/formats/xgmml/importer.d.ts.map +1 -0
- package/dist/src/formats/xgmml/importer.js +360 -0
- package/dist/src/formats/xgmml/importer.js.map +1 -0
- package/dist/src/formats/xgmml/index.d.ts +8 -0
- package/dist/src/formats/xgmml/index.d.ts.map +1 -0
- package/dist/src/formats/xgmml/index.js +8 -0
- package/dist/src/formats/xgmml/index.js.map +1 -0
- package/dist/src/formats/xgmml/values.d.ts +60 -0
- package/dist/src/formats/xgmml/values.d.ts.map +1 -0
- package/dist/src/formats/xgmml/values.js +148 -0
- package/dist/src/formats/xgmml/values.js.map +1 -0
- package/dist/src/index.d.ts +2 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +2 -0
- package/dist/src/index.js.map +1 -1
- package/dist/src/registry.d.ts +7 -0
- package/dist/src/registry.d.ts.map +1 -1
- package/dist/src/registry.js +25 -10
- package/dist/src/registry.js.map +1 -1
- package/dist/src/sniff.d.ts +1 -1
- package/dist/src/sniff.d.ts.map +1 -1
- package/dist/src/sniff.js +2 -0
- package/dist/src/sniff.js.map +1 -1
- package/dist/xgmml.d.ts +1 -0
- package/dist/xgmml.js +9 -0
- package/dist/xgmml.js.map +1 -0
- package/package.json +15 -2
- package/src/common/cell-budget.ts +170 -0
- package/src/common/input.ts +40 -0
- package/src/common/options.ts +1 -1
- package/src/common/xml.ts +127 -6
- package/src/common/zip.ts +472 -0
- package/src/formats/cx/importer.ts +27 -19
- package/src/formats/cys/constants.ts +99 -0
- package/src/formats/cys/importer.ts +1100 -0
- package/src/formats/cys/index.ts +7 -0
- package/src/formats/cys/session.ts +428 -0
- package/src/formats/cys/tables.ts +400 -0
- package/src/formats/dot/exporter.ts +17 -0
- package/src/formats/dot/importer.ts +6 -2
- package/src/formats/gexf/importer.ts +0 -1
- package/src/formats/gml/exporter.ts +7 -18
- package/src/formats/json/exporter.ts +3 -1
- package/src/formats/json/importer.ts +3 -2
- package/src/formats/xgmml/columns.ts +747 -0
- package/src/formats/xgmml/constants.ts +265 -0
- package/src/formats/xgmml/document.ts +975 -0
- package/src/formats/xgmml/emit.ts +1563 -0
- package/src/formats/xgmml/exporter.ts +1215 -0
- package/src/formats/xgmml/importer.ts +491 -0
- package/src/formats/xgmml/index.ts +8 -0
- package/src/formats/xgmml/values.ts +183 -0
- package/src/index.ts +9 -0
- package/src/registry.ts +41 -15
- package/src/sniff.ts +5 -1
- package/dist/chunks/escape-CWExcecC.js.map +0 -1
- package/dist/chunks/importer-BAP4PrxR.js.map +0 -1
- package/dist/chunks/importer-BNFuV1-K.js.map +0 -1
- package/dist/chunks/importer-Bm1_5vPS.js.map +0 -1
- package/dist/chunks/writer-DQiKgQJc.js.map +0 -1
package/dist/graph-io.js
CHANGED
|
@@ -1,37 +1,173 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { A,
|
|
1
|
+
import { ag as describe, w as ImportReportBuilder, y as throwIfAborted } from "./chunks/report-B1z4WT9e.js";
|
|
2
|
+
import { A, m, n, Z, ah, B, C, a5, ai, l, j, aj, ak, D, a, i, c, al, d, J, a4, u, E, am, G, an, I, a8, b, a2, r, s, K, ao, ap, e, f, af, M, a9, aq, aa, N, $, O, ar, ab, h, as, P, at, a6, ac, R, S, p, o, a3, au, g, t, ae, ad, a1, T, k, Y, q, U, av, a7, W, a0, aw, ax, H, ay, az, aA, L, aB, aC, aD, aE, aF, X, aG, F, z, V, v, x } from "./chunks/report-B1z4WT9e.js";
|
|
3
3
|
import { C as C2, c as c2, a as a10 } from "./chunks/children-CL3Cy0ez.js";
|
|
4
4
|
import { GraphFormatError, GraphBuilder } from "@graphty/graph-format";
|
|
5
5
|
import { csvImporter, csvExporter } from "./csv.js";
|
|
6
6
|
import { CSV_CAPABILITIES, CSV_ISSUE, CSV_LOSS } from "./csv.js";
|
|
7
|
-
import { c as cxImporter } from "./chunks/importer-
|
|
8
|
-
import { C as C3 } from "./chunks/importer-
|
|
9
|
-
import { c as cx2Exporter } from "./chunks/exporter-
|
|
10
|
-
import { C as C4, a as a11 } from "./chunks/exporter-
|
|
11
|
-
import { c as cx2Importer } from "./chunks/importer-
|
|
12
|
-
import { C as C5 } from "./chunks/importer-
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
7
|
+
import { c as cxImporter } from "./chunks/importer-DET1tg6s.js";
|
|
8
|
+
import { C as C3 } from "./chunks/importer-DET1tg6s.js";
|
|
9
|
+
import { c as cx2Exporter } from "./chunks/exporter-BGrsWamJ.js";
|
|
10
|
+
import { C as C4, a as a11 } from "./chunks/exporter-BGrsWamJ.js";
|
|
11
|
+
import { c as cx2Importer } from "./chunks/importer-vi3bSdtw.js";
|
|
12
|
+
import { C as C5 } from "./chunks/importer-vi3bSdtw.js";
|
|
13
|
+
import { c as cysImporter } from "./chunks/importer-DD-xv9_Y.js";
|
|
14
|
+
import { C as C6 } from "./chunks/importer-DD-xv9_Y.js";
|
|
15
|
+
import { b as dotImporter, d as dotExporter } from "./chunks/importer-BWY2FFc5.js";
|
|
16
|
+
import { D as D2, a as a12 } from "./chunks/importer-BWY2FFc5.js";
|
|
15
17
|
import { gexfImporter, gexfExporter } from "./gexf.js";
|
|
16
18
|
import { GEXF_1_2_CAPABILITIES, GEXF_ISSUE, GEXF_LOSS } from "./gexf.js";
|
|
17
19
|
import { gmlImporter, gmlExporter } from "./gml.js";
|
|
18
20
|
import { GML_ISSUE, GML_LOSS } from "./gml.js";
|
|
19
|
-
import { b as graphmlImporter, g as graphmlExporter } from "./chunks/importer-
|
|
20
|
-
import { G as G2, a as a13 } from "./chunks/importer-
|
|
21
|
-
import { r as rankFormats, S as SNIFF_HEAD_BYTES, e as jsonImporter, c as jsonExporter } from "./chunks/importer-
|
|
22
|
-
import { G as G3, J as J2, a as a14, b as b2, d as d2, f as f2, h as h2, j as j2, n as n2, s as s2, g as g2 } from "./chunks/importer-
|
|
21
|
+
import { b as graphmlImporter, g as graphmlExporter } from "./chunks/importer-DIrbbnAf.js";
|
|
22
|
+
import { G as G2, a as a13 } from "./chunks/importer-DIrbbnAf.js";
|
|
23
|
+
import { r as rankFormats, S as SNIFF_HEAD_BYTES, e as jsonImporter, c as jsonExporter } from "./chunks/importer-eUREhBGj.js";
|
|
24
|
+
import { G as G3, J as J2, a as a14, b as b2, d as d2, f as f2, h as h2, j as j2, n as n2, s as s2, g as g2 } from "./chunks/importer-eUREhBGj.js";
|
|
23
25
|
import { neo4jImporter, neo4jExporter } from "./neo4j.js";
|
|
24
26
|
import { ID_SPACE_COLUMN, LABELS_COLUMN, NEO4J_CAPABILITIES, NEO4J_ISSUE, NEO4J_LOSS, ORIGINAL_ID_COLUMN, TYPE_COLUMN } from "./neo4j.js";
|
|
25
|
-
import { o as oboImporter } from "./chunks/importer-
|
|
26
|
-
import { O as O2 } from "./chunks/importer-
|
|
27
|
-
import { b as pajekImporter, p as pajekExporter } from "./chunks/importer-
|
|
28
|
-
import { P as P2, a as a15 } from "./chunks/importer-
|
|
29
|
-
import {
|
|
30
|
-
import {
|
|
31
|
-
import {
|
|
32
|
-
import {
|
|
27
|
+
import { o as oboImporter } from "./chunks/importer-DEcKhsmQ.js";
|
|
28
|
+
import { O as O2 } from "./chunks/importer-DEcKhsmQ.js";
|
|
29
|
+
import { b as pajekImporter, p as pajekExporter } from "./chunks/importer-zGLo8Dg_.js";
|
|
30
|
+
import { P as P2, a as a15 } from "./chunks/importer-zGLo8Dg_.js";
|
|
31
|
+
import { x as xgmmlExporter } from "./chunks/exporter-DIeGJXAZ.js";
|
|
32
|
+
import { x as xgmmlImporter } from "./chunks/importer-D_e7e7LX.js";
|
|
33
|
+
import { X as X2, a as a16 } from "./chunks/importer-D_e7e7LX.js";
|
|
34
|
+
import { L as L2, N as N2, c as c3, a as a17, i as i2, m as m2, s as s3 } from "./chunks/export-Bh60Dv-n.js";
|
|
35
|
+
import { e as e2, b as b3, f as f3, a as a18, c as c4, d as d3, i as i3, p as p2 } from "./chunks/weights-Dzba96G3.js";
|
|
36
|
+
import { T as T2, W as W2, i as i4, a as a19, p as p3 } from "./chunks/text-Dr0Ifpag.js";
|
|
37
|
+
import { D as D3, c as c5, d as d4, e as e3, j as j3, t as t2 } from "./chunks/writer-C7flM-Ih.js";
|
|
38
|
+
import { X as X3, b as b4, h as h3, t as t3, x as x2 } from "./chunks/escape-B-tkk_Cl.js";
|
|
39
|
+
const TOO_MANY_EMPTY_CELLS_CODE = "E_TOO_MANY_EMPTY_CELLS";
|
|
40
|
+
const DEFAULT_MAX_EMPTY_CELLS = 2 ** 24;
|
|
41
|
+
function maxEmptyCellsOption(value) {
|
|
42
|
+
if (value === void 0) {
|
|
43
|
+
return DEFAULT_MAX_EMPTY_CELLS;
|
|
44
|
+
}
|
|
45
|
+
if (typeof value === "number" && value >= 0 && (Number.isInteger(value) || value === Infinity)) {
|
|
46
|
+
return value;
|
|
47
|
+
}
|
|
48
|
+
throw new GraphFormatError(
|
|
49
|
+
"E_UNSUPPORTED",
|
|
50
|
+
`option maxEmptyCells: ${describe(value)} is not a non-negative integer or Infinity`,
|
|
51
|
+
{ option: "maxEmptyCells", found: value }
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
class CellBudgetBuilder extends GraphBuilder {
|
|
55
|
+
/**
|
|
56
|
+
* Create a builder with a limit.
|
|
57
|
+
* @param options - the builder options
|
|
58
|
+
* @param format - the format being read, for the error's report
|
|
59
|
+
* @param maxEmptyCells - the most empty slots allowed
|
|
60
|
+
*/
|
|
61
|
+
constructor(options, format, maxEmptyCells) {
|
|
62
|
+
super(options);
|
|
63
|
+
this.format = format;
|
|
64
|
+
this.maxEmptyCells = maxEmptyCells;
|
|
65
|
+
this.nodeColumns = /* @__PURE__ */ new Set();
|
|
66
|
+
this.edgeColumns = /* @__PURE__ */ new Set();
|
|
67
|
+
this.values = 0;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Add a node, then check the limit (its row adds a slot to every node column).
|
|
71
|
+
* @param id - the node id
|
|
72
|
+
* @returns the node index
|
|
73
|
+
*/
|
|
74
|
+
addNode(id) {
|
|
75
|
+
const index = super.addNode(id);
|
|
76
|
+
this.checkBudget();
|
|
77
|
+
return index;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Add an edge, then check the limit (its row adds a slot to every edge column).
|
|
81
|
+
* @param source - source id
|
|
82
|
+
* @param target - target id
|
|
83
|
+
* @param weight - the weight
|
|
84
|
+
* @returns the edge index
|
|
85
|
+
*/
|
|
86
|
+
addEdge(source, target, weight) {
|
|
87
|
+
const edge = super.addEdge(source, target, weight);
|
|
88
|
+
this.checkBudget();
|
|
89
|
+
return edge;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Declare a node column, then check the limit.
|
|
93
|
+
* @param decl - the declaration
|
|
94
|
+
* @returns the column handle
|
|
95
|
+
*/
|
|
96
|
+
declareNodeColumn(decl) {
|
|
97
|
+
const handle = super.declareNodeColumn(decl);
|
|
98
|
+
this.nodeColumns.add(handle);
|
|
99
|
+
this.checkBudget();
|
|
100
|
+
return handle;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Declare an edge column, then check the limit.
|
|
104
|
+
* @param decl - the declaration
|
|
105
|
+
* @returns the column handle
|
|
106
|
+
*/
|
|
107
|
+
declareEdgeColumn(decl) {
|
|
108
|
+
const handle = super.declareEdgeColumn(decl);
|
|
109
|
+
this.edgeColumns.add(handle);
|
|
110
|
+
this.checkBudget();
|
|
111
|
+
return handle;
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Set a node cell (a new name declares a column), then check the limit.
|
|
115
|
+
* @param column - the handle or name
|
|
116
|
+
* @param index - the node index
|
|
117
|
+
* @param value - the value
|
|
118
|
+
*/
|
|
119
|
+
setNodeValue(column, index, value) {
|
|
120
|
+
super.setNodeValue(column, index, value);
|
|
121
|
+
this.nodeColumns.add(typeof column === "string" ? this.nodeColumn(column) : column);
|
|
122
|
+
this.count(value);
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Set an edge cell (a new name declares a column), then check the limit.
|
|
126
|
+
* @param column - the handle or name
|
|
127
|
+
* @param edge - the edge index
|
|
128
|
+
* @param value - the value
|
|
129
|
+
*/
|
|
130
|
+
setEdgeValue(column, edge, value) {
|
|
131
|
+
super.setEdgeValue(column, edge, value);
|
|
132
|
+
this.edgeColumns.add(typeof column === "string" ? this.edgeColumn(column) : column);
|
|
133
|
+
this.count(value);
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Count a written value and check the budget.
|
|
137
|
+
* @param value - the value; null and undefined unset a slot and do not count
|
|
138
|
+
*/
|
|
139
|
+
count(value) {
|
|
140
|
+
if (value !== null && value !== void 0) {
|
|
141
|
+
this.values++;
|
|
142
|
+
}
|
|
143
|
+
this.checkBudget();
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Throw when the columns' slots minus the values written pass the limit.
|
|
147
|
+
* @throws ImportError E_TOO_MANY_EMPTY_CELLS
|
|
148
|
+
*/
|
|
149
|
+
checkBudget() {
|
|
150
|
+
const slots = this.nodeColumns.size * this.nodeBound + this.edgeColumns.size * this.edgeBound;
|
|
151
|
+
const empty = slots - this.values;
|
|
152
|
+
if (empty > this.maxEmptyCells) {
|
|
153
|
+
new ImportReportBuilder(this.format, Infinity).fail(
|
|
154
|
+
TOO_MANY_EMPTY_CELLS_CODE,
|
|
155
|
+
`the attributes are too sparse: ${this.nodeColumns.size} node and ${this.edgeColumns.size} edge attribute column(s) over ${this.nodeBound} node(s) and ${this.edgeBound} edge(s) would allocate more than ${this.maxEmptyCells} slots that hold no value; pass a larger maxEmptyCells (or Infinity) to read the file anyway`,
|
|
156
|
+
void 0,
|
|
157
|
+
{ emptyCells: empty, maxEmptyCells: this.maxEmptyCells }
|
|
158
|
+
);
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
}
|
|
33
162
|
const UNKNOWN_FORMAT_CODE = "E_UNKNOWN_FORMAT";
|
|
34
|
-
const REGISTRY_KEYS = /* @__PURE__ */ new Set([
|
|
163
|
+
const REGISTRY_KEYS = /* @__PURE__ */ new Set([
|
|
164
|
+
"format",
|
|
165
|
+
"filename",
|
|
166
|
+
"mimeType",
|
|
167
|
+
"builder",
|
|
168
|
+
"freeze",
|
|
169
|
+
"maxEmptyCells"
|
|
170
|
+
]);
|
|
35
171
|
class FormatRegistry {
|
|
36
172
|
constructor() {
|
|
37
173
|
this.importerMap = /* @__PURE__ */ new Map();
|
|
@@ -148,7 +284,7 @@ class FormatRegistry {
|
|
|
148
284
|
*/
|
|
149
285
|
async importGraph(input, options = {}) {
|
|
150
286
|
const chosen = await this.choose(input, options);
|
|
151
|
-
const builder = seededBuilder(options);
|
|
287
|
+
const builder = seededBuilder(options, chosen.importer.format);
|
|
152
288
|
let report;
|
|
153
289
|
try {
|
|
154
290
|
report = await chosen.importer.import(chosen.source, builder, importerOptions(options));
|
|
@@ -174,13 +310,13 @@ class FormatRegistry {
|
|
|
174
310
|
let reports;
|
|
175
311
|
try {
|
|
176
312
|
if (importer.importAll === void 0) {
|
|
177
|
-
builders.push(seededBuilder(options));
|
|
313
|
+
builders.push(seededBuilder(options, importer.format));
|
|
178
314
|
reports = [await importer.import(chosen.source, builders[0], importerOptions(options))];
|
|
179
315
|
} else {
|
|
180
316
|
reports = await importer.importAll(
|
|
181
317
|
chosen.source,
|
|
182
318
|
() => {
|
|
183
|
-
const builder = seededBuilder(options);
|
|
319
|
+
const builder = seededBuilder(options, importer.format);
|
|
184
320
|
builders.push(builder);
|
|
185
321
|
return builder;
|
|
186
322
|
},
|
|
@@ -266,7 +402,7 @@ class FormatRegistry {
|
|
|
266
402
|
}
|
|
267
403
|
}
|
|
268
404
|
function createRegistry() {
|
|
269
|
-
return new FormatRegistry().registerImporter(jsonImporter).registerExporter(jsonExporter).registerImporter(graphmlImporter).registerExporter(graphmlExporter).registerImporter(gexfImporter).registerExporter(gexfExporter).registerImporter(csvImporter).registerExporter(csvExporter).registerImporter(gmlImporter).registerExporter(gmlExporter).registerImporter(dotImporter).registerExporter(dotExporter).registerImporter(pajekImporter).registerExporter(pajekExporter).registerImporter(neo4jImporter).registerExporter(neo4jExporter).registerImporter(cx2Importer).registerExporter(cx2Exporter).registerImporter(cxImporter).registerImporter(oboImporter);
|
|
405
|
+
return new FormatRegistry().registerImporter(jsonImporter).registerExporter(jsonExporter).registerImporter(graphmlImporter).registerExporter(graphmlExporter).registerImporter(gexfImporter).registerExporter(gexfExporter).registerImporter(csvImporter).registerExporter(csvExporter).registerImporter(gmlImporter).registerExporter(gmlExporter).registerImporter(dotImporter).registerExporter(dotExporter).registerImporter(pajekImporter).registerExporter(pajekExporter).registerImporter(neo4jImporter).registerExporter(neo4jExporter).registerImporter(xgmmlImporter).registerExporter(xgmmlExporter).registerImporter(cx2Importer).registerExporter(cx2Exporter).registerImporter(cxImporter).registerImporter(oboImporter).registerImporter(cysImporter);
|
|
270
406
|
}
|
|
271
407
|
const registry = createRegistry();
|
|
272
408
|
function importGraph(input, options) {
|
|
@@ -299,15 +435,20 @@ function importerOptions(options) {
|
|
|
299
435
|
}
|
|
300
436
|
return out;
|
|
301
437
|
}
|
|
302
|
-
function seededBuilder(options) {
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
438
|
+
function seededBuilder(options, format) {
|
|
439
|
+
const maxEmptyCells = maxEmptyCellsOption(options.maxEmptyCells);
|
|
440
|
+
return new CellBudgetBuilder(
|
|
441
|
+
{
|
|
442
|
+
weightDtype: options.weightDtype ?? "f64",
|
|
443
|
+
...options.builder,
|
|
444
|
+
directed: true,
|
|
445
|
+
addMissingNodes: options.addMissingNodes ?? true,
|
|
446
|
+
duplicateEdges: options.duplicateEdges ?? "keep",
|
|
447
|
+
selfLoops: options.selfLoops ?? "keep"
|
|
448
|
+
},
|
|
449
|
+
format,
|
|
450
|
+
maxEmptyCells
|
|
451
|
+
);
|
|
311
452
|
}
|
|
312
453
|
function result(chosen, builder, report, options) {
|
|
313
454
|
const frozen = builder.freezeWithReport(options.freeze);
|
|
@@ -370,10 +511,10 @@ async function peekHead(input, bytes, signal) {
|
|
|
370
511
|
return { head: joinHead(buffered, bytes), input: replayed, close: () => replayed.close() };
|
|
371
512
|
}
|
|
372
513
|
function joinHead(chunks, bytes) {
|
|
373
|
-
if (chunks.every((
|
|
514
|
+
if (chunks.every((c6) => c6 instanceof Uint8Array)) {
|
|
374
515
|
const total = Math.min(
|
|
375
516
|
bytes,
|
|
376
|
-
chunks.reduce((sum,
|
|
517
|
+
chunks.reduce((sum, c6) => sum + c6.byteLength, 0)
|
|
377
518
|
);
|
|
378
519
|
const head = new Uint8Array(total);
|
|
379
520
|
let offset = 0;
|
|
@@ -460,15 +601,15 @@ function readerIterator(stream) {
|
|
|
460
601
|
}
|
|
461
602
|
export {
|
|
462
603
|
A as AMBIGUOUS_GRAPH_NAME_CODE,
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
604
|
+
m as ASPECT_ORDER_CODE,
|
|
605
|
+
n as BAD_ASPECT_BLOCK_CODE,
|
|
606
|
+
Z as BAD_DEFAULT_CODE,
|
|
607
|
+
ah as BAD_OPTIONS_CODE,
|
|
608
|
+
B as BAD_VALUE_CODE,
|
|
468
609
|
C as COLUMN_RENAMED_CODE,
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
610
|
+
a5 as COLUMN_RENAMED_LOSS_CODE,
|
|
611
|
+
ai as COUNT_HINT_CODE,
|
|
612
|
+
l as COUNT_MISMATCH_CODE,
|
|
472
613
|
CSV_CAPABILITIES,
|
|
473
614
|
CSV_ISSUE,
|
|
474
615
|
CSV_LOSS,
|
|
@@ -476,24 +617,25 @@ export {
|
|
|
476
617
|
C5 as CX2_ISSUE,
|
|
477
618
|
a11 as CX2_LOSS,
|
|
478
619
|
C3 as CX_ISSUE,
|
|
620
|
+
C6 as CYS_ISSUE,
|
|
479
621
|
C2 as ChildrenCsr,
|
|
480
|
-
|
|
622
|
+
j as DANGLING_REFERENCE_CODE,
|
|
481
623
|
D3 as DEFAULT_CHUNK_BYTES,
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
624
|
+
aj as DEFAULT_ERROR_LIMIT,
|
|
625
|
+
ak as DIRECTED_COLUMN,
|
|
626
|
+
D as DIRECTION_FORCED_CODE,
|
|
627
|
+
a as DIRECTION_REFUSED_CODE,
|
|
486
628
|
D2 as DOT_ISSUE,
|
|
487
629
|
a12 as DOT_LOSS,
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
630
|
+
i as DUPLICATE_ATTRIBUTE_CODE,
|
|
631
|
+
c as DUPLICATE_EDGE_ID_CODE,
|
|
632
|
+
al as DUPLICATE_KEY_CODE,
|
|
633
|
+
d as DUPLICATE_NODE_CODE,
|
|
634
|
+
J as DirectionResolver,
|
|
635
|
+
a4 as EMPTY_COLUMN_DROPPED_CODE,
|
|
636
|
+
u as EMPTY_INPUT_CODE,
|
|
637
|
+
E as ENCODING_FALLBACK_CODE,
|
|
638
|
+
am as EQUATION_AS_TEXT_CODE,
|
|
497
639
|
FormatRegistry,
|
|
498
640
|
GEXF_1_2_CAPABILITIES,
|
|
499
641
|
GEXF_ISSUE,
|
|
@@ -504,110 +646,113 @@ export {
|
|
|
504
646
|
a13 as GRAPHML_LOSS,
|
|
505
647
|
G3 as GRAPH_FORMATS,
|
|
506
648
|
G as GRAPH_NOT_FOUND_CODE,
|
|
507
|
-
|
|
508
|
-
|
|
649
|
+
an as HYPEREDGE_CODE,
|
|
650
|
+
I as ID_MERGED_CODE,
|
|
509
651
|
ID_SPACE_COLUMN,
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
652
|
+
a8 as ID_TEXT_COLLISION_CODE,
|
|
653
|
+
b as ID_TEXT_TYPE_CODE,
|
|
654
|
+
a2 as INTEGRAL_F64_CODE,
|
|
655
|
+
r as INVALID_ENCODING_CODE,
|
|
656
|
+
s as INVALID_UTF8_CODE,
|
|
657
|
+
K as IdCoercer,
|
|
658
|
+
ao as ImportError,
|
|
517
659
|
ImportReportBuilder,
|
|
518
660
|
J2 as JSON_DIALECTS,
|
|
519
661
|
a14 as JSON_ISSUE,
|
|
520
662
|
b2 as JSON_LOSS,
|
|
521
663
|
LABELS_COLUMN,
|
|
522
664
|
L2 as LOSS,
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
665
|
+
ap as LineReader,
|
|
666
|
+
e as MISSING_ENDPOINT_CODE,
|
|
667
|
+
f as MISSING_ID_CODE,
|
|
668
|
+
af as MIXED_DIRECTION_CODE,
|
|
669
|
+
M as MULTIPLE_GRAPHS_CODE,
|
|
670
|
+
a9 as MUTUAL_AS_UNDIRECTED_CODE,
|
|
671
|
+
aq as MUTUAL_COLUMN,
|
|
672
|
+
aa as MUTUAL_EXPANDED_CODE,
|
|
531
673
|
NEO4J_CAPABILITIES,
|
|
532
674
|
NEO4J_ISSUE,
|
|
533
675
|
NEO4J_LOSS,
|
|
534
676
|
N2 as NO_CAPABILITIES,
|
|
535
|
-
|
|
677
|
+
N as NO_GRAPH_CODE,
|
|
536
678
|
O2 as OBO_ISSUE,
|
|
537
|
-
|
|
538
|
-
|
|
679
|
+
$ as OPTIONS_GAINED_CODE,
|
|
680
|
+
O as OPTION_IGNORED_CODE,
|
|
539
681
|
ORIGINAL_ID_COLUMN,
|
|
540
|
-
|
|
682
|
+
ar as PAIR_COLUMN,
|
|
541
683
|
P2 as PAJEK_ISSUE,
|
|
542
684
|
a15 as PAJEK_LOSS,
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
685
|
+
ab as PARENTS_DROPPED_CODE,
|
|
686
|
+
h as PARENT_CYCLE_CODE,
|
|
687
|
+
as as PARSE_ERROR_CODE,
|
|
688
|
+
P as PRECISION_CODE,
|
|
689
|
+
at as RENAMED_CODE,
|
|
690
|
+
a6 as ROLE_ASSUMED_CODE,
|
|
691
|
+
ac as ROLE_DROPPED_CODE,
|
|
692
|
+
R as ROLE_TAKEN_CODE,
|
|
693
|
+
S as SINK_OPTION_CODE,
|
|
552
694
|
SNIFF_HEAD_BYTES,
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
695
|
+
p as STATUS_FAILED_CODE,
|
|
696
|
+
o as STATUS_WARNING_CODE,
|
|
697
|
+
a3 as STORAGE_CLASS_CODE,
|
|
698
|
+
au as STRAY_TEXT_CODE,
|
|
699
|
+
g as STYLES_NOT_IMPORTED_CODE,
|
|
700
|
+
t as SYNTAX_CODE,
|
|
701
|
+
ae as TEMPORAL_DROPPED_CODE,
|
|
702
|
+
ad as TEMPORAL_TEXT_DROPPED_CODE,
|
|
703
|
+
a1 as TEXT_INFERRED_CODE,
|
|
704
|
+
T as TOO_LARGE_CODE,
|
|
563
705
|
TYPE_COLUMN,
|
|
564
706
|
T2 as TextCellWriter,
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
707
|
+
k as UNKNOWN_ATTR_TYPE_CODE,
|
|
708
|
+
Y as UNKNOWN_ELEMENT_CODE,
|
|
709
|
+
q as UNKNOWN_ENCODING_CODE,
|
|
568
710
|
UNKNOWN_FORMAT_CODE,
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
711
|
+
U as UNKNOWN_PARENT_CODE,
|
|
712
|
+
av as UNKNOWN_TYPE_CODE,
|
|
713
|
+
a7 as WEIGHT_KEY_CLASH_CODE,
|
|
714
|
+
W as WIDENED_CODE,
|
|
573
715
|
W2 as WIDENING_UNSUPPORTED_CODE,
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
716
|
+
X2 as XGMML_ISSUE,
|
|
717
|
+
a16 as XGMML_LOSS,
|
|
718
|
+
a0 as XML_ILLEGAL_CHAR_CODE,
|
|
719
|
+
aw as XML_SYNTAX_CODE,
|
|
720
|
+
X3 as XmlSyntaxError,
|
|
721
|
+
b4 as XmlTokenizer,
|
|
722
|
+
ax as canonicalId,
|
|
579
723
|
c3 as capabilities,
|
|
580
|
-
|
|
724
|
+
a17 as checkCapabilities,
|
|
581
725
|
checkExport,
|
|
582
726
|
c2 as childrenCsr,
|
|
583
727
|
a10 as childrenFromColumn,
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
728
|
+
H as chooseGraph,
|
|
729
|
+
ay as coerceId,
|
|
730
|
+
az as coerceIdText,
|
|
731
|
+
c5 as collectBytes,
|
|
588
732
|
createRegistry,
|
|
589
733
|
csvExporter,
|
|
590
734
|
csvImporter,
|
|
591
735
|
cx2Exporter,
|
|
592
736
|
cx2Importer,
|
|
593
737
|
cxImporter,
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
738
|
+
cysImporter,
|
|
739
|
+
aA as declareCompanion,
|
|
740
|
+
L as declareResolved,
|
|
741
|
+
d4 as decodeChunks,
|
|
742
|
+
aB as decodeEntryName,
|
|
598
743
|
d2 as dialectCapabilities,
|
|
599
744
|
dotExporter,
|
|
600
745
|
dotImporter,
|
|
601
|
-
|
|
602
|
-
|
|
746
|
+
e3 as encodeChunks,
|
|
747
|
+
e2 as explicitWeights,
|
|
603
748
|
exportGraph,
|
|
604
749
|
exportGraphToString,
|
|
605
750
|
f2 as extensionOf,
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
751
|
+
b3 as formatDecimal,
|
|
752
|
+
f3 as formatF32,
|
|
753
|
+
a18 as formatF64,
|
|
609
754
|
c4 as formatGmlReal,
|
|
610
|
-
|
|
755
|
+
d3 as formatInteger,
|
|
611
756
|
gexfExporter,
|
|
612
757
|
gexfImporter,
|
|
613
758
|
gmlExporter,
|
|
@@ -619,12 +764,12 @@ export {
|
|
|
619
764
|
importAllGraphs,
|
|
620
765
|
importGraph,
|
|
621
766
|
i4 as inferTextDtype,
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
767
|
+
aC as inputLength,
|
|
768
|
+
aD as isAbortError,
|
|
769
|
+
aE as isCanonicalIntegerText,
|
|
770
|
+
aF as isImportInput,
|
|
626
771
|
i2 as isNmtoken,
|
|
627
|
-
|
|
772
|
+
a19 as isNumericText,
|
|
628
773
|
i3 as isWeightField,
|
|
629
774
|
j3 as joinText,
|
|
630
775
|
j2 as jsonCapabilities,
|
|
@@ -636,26 +781,28 @@ export {
|
|
|
636
781
|
neo4jImporter,
|
|
637
782
|
n2 as normalizeMimeType,
|
|
638
783
|
oboImporter,
|
|
639
|
-
|
|
784
|
+
X as pairFolding,
|
|
640
785
|
pajekExporter,
|
|
641
786
|
pajekImporter,
|
|
642
787
|
p3 as parseTextCell,
|
|
643
788
|
p2 as parseWeightText,
|
|
644
789
|
rankFormats,
|
|
645
|
-
|
|
790
|
+
aG as readText,
|
|
646
791
|
registry,
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
792
|
+
F as reportSinkOptions,
|
|
793
|
+
z as reportUnusedOptions,
|
|
794
|
+
V as resolveExportOptions,
|
|
795
|
+
v as resolveImportOptions,
|
|
651
796
|
s3 as sanitizeIds,
|
|
652
797
|
sniff,
|
|
653
798
|
s2 as sniffFormat,
|
|
654
799
|
g2 as sniffJsonDialectHead,
|
|
655
|
-
|
|
800
|
+
x as textChunks,
|
|
656
801
|
throwIfAborted,
|
|
657
|
-
|
|
658
|
-
|
|
802
|
+
t2 as toReadableStream,
|
|
803
|
+
t3 as tokenizeXml,
|
|
804
|
+
xgmmlExporter,
|
|
805
|
+
xgmmlImporter,
|
|
659
806
|
x2 as xmlIllegalTextNotes
|
|
660
807
|
};
|
|
661
808
|
//# sourceMappingURL=graph-io.js.map
|