@loaders.gl/graphs 4.5.3
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/LICENSE +41 -0
- package/README.md +66 -0
- package/dist/dot-loader-types.d.ts +16 -0
- package/dist/dot-loader-types.d.ts.map +1 -0
- package/dist/dot-loader-types.js +20 -0
- package/dist/dot-loader-types.js.map +1 -0
- package/dist/dot-loader.cjs +732 -0
- package/dist/dot-loader.cjs.map +7 -0
- package/dist/dot-loader.d.ts +19 -0
- package/dist/dot-loader.d.ts.map +1 -0
- package/dist/dot-loader.js +13 -0
- package/dist/dot-loader.js.map +1 -0
- package/dist/dot-types.d.ts +32 -0
- package/dist/dot-types.d.ts.map +1 -0
- package/dist/dot-types.js +5 -0
- package/dist/dot-types.js.map +1 -0
- package/dist/graph-types.d.ts +28 -0
- package/dist/graph-types.d.ts.map +1 -0
- package/dist/graph-types.js +5 -0
- package/dist/graph-types.js.map +1 -0
- package/dist/graphml-loader-types.d.ts +16 -0
- package/dist/graphml-loader-types.d.ts.map +1 -0
- package/dist/graphml-loader-types.js +20 -0
- package/dist/graphml-loader-types.js.map +1 -0
- package/dist/graphml-loader.cjs +315 -0
- package/dist/graphml-loader.cjs.map +7 -0
- package/dist/graphml-loader.d.ts +19 -0
- package/dist/graphml-loader.d.ts.map +1 -0
- package/dist/graphml-loader.js +13 -0
- package/dist/graphml-loader.js.map +1 -0
- package/dist/index.cjs +1022 -0
- package/dist/index.cjs.map +7 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/parse-dot.d.ts +4 -0
- package/dist/lib/parse-dot.d.ts.map +1 -0
- package/dist/lib/parse-dot.js +724 -0
- package/dist/lib/parse-dot.js.map +1 -0
- package/dist/lib/parse-graphml.d.ts +6 -0
- package/dist/lib/parse-graphml.d.ts.map +1 -0
- package/dist/lib/parse-graphml.js +296 -0
- package/dist/lib/parse-graphml.js.map +1 -0
- package/package.json +58 -0
- package/src/dot-loader-types.ts +24 -0
- package/src/dot-loader.ts +14 -0
- package/src/dot-types.ts +38 -0
- package/src/graph-types.ts +33 -0
- package/src/graphml-loader-types.ts +24 -0
- package/src/graphml-loader.ts +14 -0
- package/src/index.ts +8 -0
- package/src/lib/parse-dot.ts +924 -0
- package/src/lib/parse-graphml.ts +414 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
loaders.gl is licensed under the MIT license
|
|
2
|
+
|
|
3
|
+
Copyright (c) vis.gl contributors
|
|
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
|
|
13
|
+
all 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
|
|
21
|
+
THE SOFTWARE.
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
Copyright (c) 2015 Uber Technologies, Inc.
|
|
26
|
+
|
|
27
|
+
loaders.gl includes certain files from Cesium (https://github.com/AnalyticalGraphicsInc/cesium)
|
|
28
|
+
under the Apache 2 License (found in the submodule: modules/3d-tiles):)
|
|
29
|
+
|
|
30
|
+
Copyright 2011-2018 CesiumJS Contributors
|
|
31
|
+
|
|
32
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
33
|
+
you may not use this file except in compliance with the License.
|
|
34
|
+
You may obtain a copy of the License at
|
|
35
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
36
|
+
|
|
37
|
+
Unless required by applicable law or agreed to in writing, software
|
|
38
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
39
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
40
|
+
See the License for the specific language governing permissions and limitations under the License.
|
|
41
|
+
|
package/README.md
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
# @loaders.gl/graphs
|
|
2
|
+
|
|
3
|
+
Framework-independent loaders for GraphML and Graphviz DOT documents.
|
|
4
|
+
|
|
5
|
+
## GraphML loader
|
|
6
|
+
|
|
7
|
+
`GraphMLLoader` reads the first graph in a GraphML 1.0 document.
|
|
8
|
+
|
|
9
|
+
```typescript
|
|
10
|
+
import {load} from '@loaders.gl/core';
|
|
11
|
+
import {GraphMLLoader} from '@loaders.gl/graphs';
|
|
12
|
+
|
|
13
|
+
const graph = await load('network.graphml', GraphMLLoader);
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
Pass `GraphMLLoader` to `parseSync` from `@loaders.gl/core` for synchronous parsing.
|
|
17
|
+
The direct parser subpath also exports `GraphMLLoaderWithParser` from
|
|
18
|
+
`@loaders.gl/graphs/graphml-loader`.
|
|
19
|
+
|
|
20
|
+
The result is `GraphData` with `shape: 'plain-graph-data'`, `nodes`, and `edges`.
|
|
21
|
+
Nodes have `id`, optional `label`, and optional `attributes`. Edges additionally have
|
|
22
|
+
`sourceId`, `targetId`, and `directed`. This shape is compatible with
|
|
23
|
+
`createGraphFromData` in `@deck.gl-community/graph-layers`.
|
|
24
|
+
|
|
25
|
+
Supported constructs include node and edge identifiers, generated IDs for unnamed edges,
|
|
26
|
+
`edgedefault` and per-edge direction overrides, node/edge/all keys, typed data and defaults,
|
|
27
|
+
unknown data keys, and namespace-prefixed elements. Numeric and boolean keys become JavaScript
|
|
28
|
+
values; other values remain strings. Nested XML data becomes a JSON string.
|
|
29
|
+
|
|
30
|
+
Only the first graph is returned. Nested graphs, hyperedges, ports, and graph-level data are
|
|
31
|
+
ignored. Nodes without IDs and edges without endpoints are skipped. This is a permissive
|
|
32
|
+
parser, not a GraphML schema validator. Long integers use JavaScript numbers and may lose
|
|
33
|
+
precision outside the safe integer range.
|
|
34
|
+
|
|
35
|
+
## DOT loader
|
|
36
|
+
|
|
37
|
+
```typescript
|
|
38
|
+
import {load} from '@loaders.gl/core';
|
|
39
|
+
import {DOTLoader} from '@loaders.gl/graphs';
|
|
40
|
+
|
|
41
|
+
const graph = await load('network.dot', DOTLoader);
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Pass `DOTLoader` to `parseSync` for synchronous text or UTF-8 `ArrayBuffer` parsing.
|
|
45
|
+
The direct parser subpath also exports `DOTLoaderWithParser` from
|
|
46
|
+
`@loaders.gl/graphs/dot-loader`. `DOTLoader` recognizes `.dot` and `.gv` files.
|
|
47
|
+
|
|
48
|
+
The loader returns the same plain `GraphData` node/edge shape as GraphML, plus typed
|
|
49
|
+
DOT metadata: graph ID, direction, strictness, graph attributes, and subgraph descriptors.
|
|
50
|
+
Identifiers remain strings, including numeric-looking IDs. Unquoted numeric attributes
|
|
51
|
+
become numbers; quoted attributes remain strings. Node and edge `label` attributes are
|
|
52
|
+
also exposed as record labels.
|
|
53
|
+
|
|
54
|
+
Supported syntax includes `graph` and `digraph`, strict graphs with parallel-edge
|
|
55
|
+
coalescing, implicit nodes, chained edges, repeated attribute lists, scoped node/edge
|
|
56
|
+
defaults, graph attribute assignments, nested named and anonymous subgraphs, comments,
|
|
57
|
+
quoted identifiers, and balanced HTML-like labels. Node and edge attributes include
|
|
58
|
+
subgraph membership descriptors. Reopening a named subgraph retains its attributes and
|
|
59
|
+
node/edge defaults; anonymous subgraph identifiers remain distinct from explicit names. An edge `id`, `Id`, or `ID` attribute supplies its ID;
|
|
60
|
+
otherwise the loader generates an ID from its endpoints and a counter. `dir=none`
|
|
61
|
+
marks an edge as undirected; other `dir` strings mark it as directed.
|
|
62
|
+
|
|
63
|
+
This is a parser for the supported DOT subset, not a Graphviz renderer. Node ports,
|
|
64
|
+
subgraph endpoints in edge statements, and concatenated quoted strings are unsupported.
|
|
65
|
+
Port syntax is rejected; identifiers containing colons must be quoted. Truncated input,
|
|
66
|
+
trailing content, and edge operators inconsistent with the graph declaration are rejected.
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { DOTGraphData } from "./dot-types.js";
|
|
2
|
+
/** Metadata-only loader for Graphviz DOT documents. */
|
|
3
|
+
export declare const DOTLoader: {
|
|
4
|
+
readonly name: "DOT";
|
|
5
|
+
readonly id: "dot";
|
|
6
|
+
readonly module: "graphs";
|
|
7
|
+
readonly version: any;
|
|
8
|
+
readonly extensions: ["dot", "gv"];
|
|
9
|
+
readonly mimeTypes: ["text/vnd.graphviz", "text/x-graphviz", "application/vnd.graphviz"];
|
|
10
|
+
readonly text: true;
|
|
11
|
+
readonly worker: false;
|
|
12
|
+
readonly dataType: DOTGraphData;
|
|
13
|
+
readonly batchType: never;
|
|
14
|
+
readonly options: {};
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=dot-loader-types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dot-loader-types.d.ts","sourceRoot":"","sources":["../src/dot-loader-types.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAC,YAAY,EAAC,uBAAoB;AAK9C,uDAAuD;AACvD,eAAO,MAAM,SAAS;;;;;;;;;uBASS,YAAY;wBACtB,KAAK;;CAEsB,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// loaders.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
4
|
+
// @ts-ignore __VERSION__ is injected by the build.
|
|
5
|
+
const VERSION = typeof "4.5.3" !== 'undefined' ? "4.5.3" : 'latest';
|
|
6
|
+
/** Metadata-only loader for Graphviz DOT documents. */
|
|
7
|
+
export const DOTLoader = {
|
|
8
|
+
name: 'DOT',
|
|
9
|
+
id: 'dot',
|
|
10
|
+
module: 'graphs',
|
|
11
|
+
version: VERSION,
|
|
12
|
+
extensions: ['dot', 'gv'],
|
|
13
|
+
mimeTypes: ['text/vnd.graphviz', 'text/x-graphviz', 'application/vnd.graphviz'],
|
|
14
|
+
text: true,
|
|
15
|
+
worker: false,
|
|
16
|
+
dataType: null,
|
|
17
|
+
batchType: null,
|
|
18
|
+
options: {}
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=dot-loader-types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dot-loader-types.js","sourceRoot":"","sources":["../src/dot-loader-types.ts"],"names":[],"mappings":"AAAA,aAAa;AACb,+BAA+B;AAC/B,oCAAoC;AAKpC,mDAAmD;AACnD,MAAM,OAAO,GAAG,cAAkB,KAAK,WAAW,CAAC,CAAC,SAAa,CAAC,CAAC,QAAQ,CAAC;AAE5E,uDAAuD;AACvD,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB,IAAI,EAAE,KAAK;IACX,EAAE,EAAE,KAAK;IACT,MAAM,EAAE,QAAQ;IAChB,OAAO,EAAE,OAAO;IAChB,UAAU,EAAE,CAAC,KAAK,EAAE,IAAI,CAAC;IACzB,SAAS,EAAE,CAAC,mBAAmB,EAAE,iBAAiB,EAAE,0BAA0B,CAAC;IAC/E,IAAI,EAAE,IAAI;IACV,MAAM,EAAE,KAAK;IACb,QAAQ,EAAE,IAA+B;IACzC,SAAS,EAAE,IAAa;IACxB,OAAO,EAAE,EAAE;CACmC,CAAC"}
|