@graphty/graphty-element 2.6.1 → 3.0.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.
- package/dist/ai.js +3 -3
- package/dist/catalog.js +53 -54
- package/dist/chunks/{AiManager-4iQpsJW1.js → AiManager-Bhh0rR_p.js} +706 -655
- package/dist/chunks/GraphSession-DPoTaT3b.js +21175 -0
- package/dist/chunks/{GraphtyLogger-B_O67a6c.js → GraphtyLogger-BtcBJQPL.js} +1 -1
- package/dist/chunks/{VoiceInputAdapter-Cc6mHXTI.js → VoiceInputAdapter-CdLsJ_nG.js} +1 -1
- package/dist/chunks/{XRPivotCameraController-BLa89LXn.js → XRPivotCameraController-CiLJ9Gz6.js} +2 -2
- package/dist/chunks/algorithms-qij74zEN.js +6811 -0
- package/dist/chunks/{capability-check-Am2zliFj.js → capability-check-BbgTejS3.js} +1 -1
- package/dist/chunks/definePalette-BYt2Llxs.js +1333 -0
- package/dist/chunks/fields-5uVC1Pll.js +4999 -0
- package/dist/chunks/{format-detection-BHwrAVzW.js → format-detection-FKaDMshR.js} +1 -1
- package/dist/chunks/{index-BkBLbvui.js → index-Cc_6D9hV.js} +6034 -7127
- package/dist/chunks/interpolation-Dk206AhZ.js +105 -0
- package/dist/chunks/paletteRegistry-De3CGdst.js +357 -0
- package/dist/chunks/parse-SVp77JbE.js +669 -0
- package/dist/chunks/{pluginRegistry-Bs8bEkz9.js → pluginRegistry-Ddfl6Mv2.js} +27 -24
- package/dist/chunks/{registry-BdGvyZou.js → registry-CgMqldp4.js} +1 -1
- package/dist/chunks/{DataSource-BL2UzPff.js → sources-BbAJCDIH.js} +279 -108
- package/dist/commands.d.ts +128 -19
- package/dist/commands.js +49 -1
- package/dist/custom-elements.json +1 -1
- package/dist/extend.d.ts +10 -2
- package/dist/extend.js +64 -57
- package/dist/graphty-catalog.json +6 -3
- package/dist/graphty.bundle.js +267177 -240648
- package/dist/graphty.js +84 -78
- package/dist/index.d.ts +4 -0
- package/dist/logging.js +2 -2
- package/dist/schema.js +70 -71
- package/dist/session.d.ts +5 -6
- package/dist/session.js +40 -86
- package/dist/src/Edge.d.ts +31 -67
- package/dist/src/Graph.d.ts +335 -77
- package/dist/src/Node.d.ts +36 -3
- package/dist/src/NodeBehavior.d.ts +28 -0
- package/dist/src/Styles.d.ts +15 -4
- package/dist/src/acceleration/AccelerationController.d.ts +8 -0
- package/dist/src/acceleration/narrow.d.ts +9 -1
- package/dist/src/acceleration/types.d.ts +10 -0
- package/dist/src/ai/AiController.d.ts +12 -0
- package/dist/src/ai/AiManager.d.ts +7 -0
- package/dist/src/ai/commands/AlgorithmCommands.d.ts +1 -1
- package/dist/src/ai/commands/LayoutCommands.d.ts +1 -1
- package/dist/src/ai/commands/StyleCommands.d.ts +1 -1
- package/dist/src/ai/commands/types.d.ts +20 -1
- package/dist/src/algorithms/Algorithm.d.ts +21 -4
- package/dist/src/algorithms/BFSAlgorithm.d.ts +0 -9
- package/dist/src/algorithms/BellmanFordAlgorithm.d.ts +0 -14
- package/dist/src/algorithms/DFSAlgorithm.d.ts +1 -1
- package/dist/src/algorithms/FloydWarshallAlgorithm.d.ts +5 -0
- package/dist/src/algorithms/GirvanNewmanAlgorithm.d.ts +5 -0
- package/dist/src/algorithms/LeidenAlgorithm.d.ts +5 -0
- package/dist/src/algorithms/PageRankAlgorithm.d.ts +1 -1
- package/dist/src/algorithms/StronglyConnectedComponentsAlgorithm.d.ts +1 -1
- package/dist/src/algorithms/metrics/fields.d.ts +23 -1
- package/dist/src/algorithms/utils/graphUtils.d.ts +13 -1
- package/dist/src/catalog/paletteRegistry.d.ts +4 -4
- package/dist/src/catalog/registry.d.ts +3 -2
- package/dist/src/catalog/types.d.ts +18 -1
- package/dist/src/config/GraphStyle.d.ts +1 -1
- package/dist/src/config/StyleTemplate.d.ts +2 -2
- package/dist/src/config/xr-config-schema.d.ts +4 -4
- package/dist/src/data/CSVDataSource.d.ts +77 -22
- package/dist/src/data/ErrorAggregator.d.ts +5 -0
- package/dist/src/data/GEXFDataSource.d.ts +12 -61
- package/dist/src/data/GraphMLDataSource.d.ts +3 -44
- package/dist/src/data/GraphStore.d.ts +322 -15
- package/dist/src/data/JsonDataSource.d.ts +43 -1
- package/dist/src/data/graph-io-import.d.ts +89 -0
- package/dist/src/data/graph-io-records.d.ts +64 -0
- package/dist/src/data/lane.d.ts +23 -0
- package/dist/src/data/positions.d.ts +13 -0
- package/dist/src/data/seedPosition.d.ts +16 -0
- package/dist/src/errors/GraphtyError.d.ts +3 -1
- package/dist/src/errors/codes.d.ts +23 -0
- package/dist/src/events.d.ts +12 -0
- package/dist/src/graphty-element.d.ts +149 -54
- package/dist/src/input/types.d.ts +2 -0
- package/dist/src/layout/D3GraphLayoutEngine.d.ts +17 -3
- package/dist/src/layout/FixedLayoutEngine.d.ts +20 -4
- package/dist/src/layout/KamadaKawaiLayoutEngine.d.ts +6 -0
- package/dist/src/layout/LayoutEngine.d.ts +214 -116
- package/dist/src/layout/NGraphLayoutEngine.d.ts +10 -3
- package/dist/src/layout/SimulationLayoutEngine.d.ts +8 -3
- package/dist/src/managers/AlgorithmManager.d.ts +24 -5
- package/dist/src/managers/DataManager.d.ts +258 -181
- package/dist/src/managers/EventManager.d.ts +5 -2
- package/dist/src/managers/GraphContext.d.ts +7 -0
- package/dist/src/managers/InputManager.d.ts +11 -0
- package/dist/src/managers/LayoutManager.d.ts +129 -50
- package/dist/src/managers/RenderManager.d.ts +14 -1
- package/dist/src/managers/UpdateManager.d.ts +20 -0
- package/dist/src/screenshot/ScreenshotCapture.d.ts +1 -1
- package/dist/src/session/GraphSession.d.ts +83 -6
- package/dist/src/session/commands/algo.d.ts +169 -0
- package/dist/src/session/commands/config.d.ts +45 -0
- package/dist/src/session/commands/data.d.ts +178 -0
- package/dist/src/session/commands/doors.d.ts +93 -0
- package/dist/src/session/commands/index.d.ts +20 -0
- package/dist/src/session/commands/layout.d.ts +104 -0
- package/dist/src/session/commands/positions.d.ts +30 -0
- package/dist/src/session/commands/sets.d.ts +113 -0
- package/dist/src/session/commands/style.d.ts +92 -0
- package/dist/src/session/commands/view.d.ts +57 -0
- package/dist/src/session/commands/visibility.d.ts +41 -0
- package/dist/src/session/data.d.ts +131 -4
- package/dist/src/session/index.d.ts +1 -1
- package/dist/src/session/planning.d.ts +25 -8
- package/dist/src/session/project/Dispatcher.d.ts +905 -0
- package/dist/src/session/project/History.d.ts +382 -0
- package/dist/src/session/project/arrangement.d.ts +247 -0
- package/dist/src/session/project/derive.d.ts +132 -0
- package/dist/src/session/project/digest.d.ts +33 -0
- package/dist/src/session/project/draft.d.ts +194 -0
- package/dist/src/session/project/graphOps.d.ts +304 -0
- package/dist/src/session/project/ingest.d.ts +364 -0
- package/dist/src/session/project/state.d.ts +145 -0
- package/dist/src/session/project/strict.d.ts +68 -0
- package/dist/src/session/results/RunResult.d.ts +48 -0
- package/dist/src/session/results/statistics.d.ts +20 -0
- package/dist/src/session/runs/Run.d.ts +80 -4
- package/dist/src/session/runs/RunsApi.d.ts +23 -6
- package/dist/src/session/runs/types.d.ts +25 -6
- package/dist/src/session/scope/ElementMask.d.ts +14 -0
- package/dist/src/session/scope/ScopeApi.d.ts +3 -22
- package/dist/src/session/scope/spaces.d.ts +29 -0
- package/dist/src/session/sealed.d.ts +22 -0
- package/dist/src/session/selection/SelectionApi.d.ts +14 -4
- package/dist/src/session/sets/SetsApi.d.ts +13 -5
- package/dist/src/session/sets/store.d.ts +54 -53
- package/dist/src/session/sets/types.d.ts +5 -2
- package/dist/src/session/styles/Layer.d.ts +5 -0
- package/dist/src/session/styles/StylesApi.d.ts +68 -17
- package/dist/src/session/styles/autoApply.d.ts +64 -53
- package/dist/src/session/styles/index.d.ts +3 -3
- package/dist/src/session/styles/predicate.d.ts +7 -0
- package/dist/src/session/styles/repaint.d.ts +16 -1
- package/dist/src/session/styles/sources.d.ts +1 -1
- package/dist/src/session/types.d.ts +625 -54
- package/dist/src/session/visibility/VisibilityApi.d.ts +38 -18
- package/dist/src/session/visibility/filter.d.ts +10 -0
- package/dist/src/simple/defineAlgorithm.d.ts +28 -0
- package/dist/src/simple/defineLayout.d.ts +35 -0
- package/dist/src/simple/defineLogDestination.d.ts +31 -0
- package/dist/src/simple/definePalette.d.ts +26 -0
- package/dist/src/simple/definition.d.ts +106 -0
- package/dist/src/simple/options.d.ts +33 -0
- package/dist/src/simple/source.d.ts +49 -0
- package/dist/src/simple/types.d.ts +366 -0
- package/dist/src/simple/view.d.ts +107 -0
- package/dist/webgpu.js +2 -2
- package/package.json +10 -12
- package/dist/chunks/GraphSession-BhuHSXIo.js +0 -12819
- package/dist/chunks/GraphStyle-Cwr55SAE.js +0 -65
- package/dist/chunks/algorithms-BJ6DQMOe.js +0 -3777
- package/dist/chunks/detect-fyuVnlCT.js +0 -88
- package/dist/chunks/interpolation-DY-PNpqX.js +0 -43
- package/dist/chunks/optionsFromZod-CKMYSwTz.js +0 -3636
- package/dist/chunks/paletteRegistry-BCFSwJGK.js +0 -1196
- package/dist/chunks/parse-BMTqt4SS.js +0 -3658
- package/dist/src/data/csv-variant-detection.d.ts +0 -29
- package/dist/src/data/ingest.d.ts +0 -104
|
@@ -116,8 +116,8 @@ export declare const GraphStyle: z.ZodObject<{
|
|
|
116
116
|
viewMode: z.ZodDefault<z.ZodEnum<{
|
|
117
117
|
"2d": "2d";
|
|
118
118
|
"3d": "3d";
|
|
119
|
-
vr: "vr";
|
|
120
119
|
ar: "ar";
|
|
120
|
+
vr: "vr";
|
|
121
121
|
}>>;
|
|
122
122
|
/**
|
|
123
123
|
* @deprecated Use viewMode instead. twoD: true is equivalent to viewMode: "2d"
|
|
@@ -28,8 +28,8 @@ declare const StyleTemplateV1: z.ZodObject<{
|
|
|
28
28
|
viewMode: z.ZodDefault<z.ZodEnum<{
|
|
29
29
|
"2d": "2d";
|
|
30
30
|
"3d": "3d";
|
|
31
|
-
vr: "vr";
|
|
32
31
|
ar: "ar";
|
|
32
|
+
vr: "vr";
|
|
33
33
|
}>>;
|
|
34
34
|
twoD: z.ZodDefault<z.ZodBoolean>;
|
|
35
35
|
}, z.core.$strict>>;
|
|
@@ -964,8 +964,8 @@ export declare const StyleTemplate: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
964
964
|
viewMode: z.ZodDefault<z.ZodEnum<{
|
|
965
965
|
"2d": "2d";
|
|
966
966
|
"3d": "3d";
|
|
967
|
-
vr: "vr";
|
|
968
967
|
ar: "ar";
|
|
968
|
+
vr: "vr";
|
|
969
969
|
}>>;
|
|
970
970
|
twoD: z.ZodDefault<z.ZodBoolean>;
|
|
971
971
|
}, z.core.$strict>>;
|
|
@@ -201,12 +201,12 @@ export declare const xrConfigSchema: z.ZodDefault<z.ZodObject<{
|
|
|
201
201
|
enableZAmplificationInDesktop: boolean;
|
|
202
202
|
};
|
|
203
203
|
enabled: boolean;
|
|
204
|
-
|
|
204
|
+
ar: {
|
|
205
205
|
enabled: boolean;
|
|
206
206
|
optionalFeatures: string[];
|
|
207
207
|
referenceSpaceType: "unbounded" | "local" | "local-floor" | "bounded-floor";
|
|
208
208
|
};
|
|
209
|
-
|
|
209
|
+
vr: {
|
|
210
210
|
enabled: boolean;
|
|
211
211
|
optionalFeatures: string[];
|
|
212
212
|
referenceSpaceType: "unbounded" | "local" | "local-floor" | "bounded-floor";
|
|
@@ -231,12 +231,12 @@ export declare const xrConfigSchema: z.ZodDefault<z.ZodObject<{
|
|
|
231
231
|
enableZAmplificationInDesktop?: boolean | undefined;
|
|
232
232
|
} | undefined;
|
|
233
233
|
enabled?: boolean | undefined;
|
|
234
|
-
|
|
234
|
+
ar?: {
|
|
235
235
|
enabled?: boolean | undefined;
|
|
236
236
|
optionalFeatures?: string[] | undefined;
|
|
237
237
|
referenceSpaceType?: "unbounded" | "local" | "local-floor" | "bounded-floor" | undefined;
|
|
238
238
|
} | undefined;
|
|
239
|
-
|
|
239
|
+
vr?: {
|
|
240
240
|
enabled?: boolean | undefined;
|
|
241
241
|
optionalFeatures?: string[] | undefined;
|
|
242
242
|
referenceSpaceType?: "unbounded" | "local" | "local-floor" | "bounded-floor" | undefined;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { type CSVVariant } from "./csv-variant-detection.js";
|
|
2
1
|
import { BaseDataSourceConfig, DataSource, DataSourceChunk } from "./DataSource.js";
|
|
2
|
+
/** The CSV shapes the reader can be told to read, or recognises when it is not told. */
|
|
3
|
+
export type CSVVariant = "neo4j" | "gephi" | "cytoscape" | "adjacency-list" | "edge-list" | "node-list" | "generic";
|
|
3
4
|
interface CSVDataSourceConfig extends BaseDataSourceConfig {
|
|
4
|
-
/** The column separator. Worked out from the first
|
|
5
|
+
/** The column separator. Worked out from the first rows (comma, tab, semicolon or pipe) when unset. */
|
|
5
6
|
delimiter?: string;
|
|
6
7
|
variant?: CSVVariant;
|
|
7
8
|
/**
|
|
@@ -22,8 +23,9 @@ interface CSVDataSourceConfig extends BaseDataSourceConfig {
|
|
|
22
23
|
edgeURL?: string;
|
|
23
24
|
}
|
|
24
25
|
/**
|
|
25
|
-
* Data source for loading graph data from CSV files
|
|
26
|
-
* Supports edge lists, adjacency lists,
|
|
26
|
+
* Data source for loading graph data from CSV files, read by `@graphty/graph-io`.
|
|
27
|
+
* Supports edge lists (plain, Gephi, Cytoscape), adjacency lists, node lists, Neo4j admin-import
|
|
28
|
+
* files and paired node and edge files.
|
|
27
29
|
*/
|
|
28
30
|
export declare class CSVDataSource extends DataSource {
|
|
29
31
|
static readonly type = "csv";
|
|
@@ -36,28 +38,81 @@ export declare class CSVDataSource extends DataSource {
|
|
|
36
38
|
protected getConfig(): BaseDataSourceConfig;
|
|
37
39
|
/**
|
|
38
40
|
* Fetches and parses CSV data into graph chunks.
|
|
39
|
-
*
|
|
41
|
+
* Recognises a Neo4j file from its header; every other file is read as the variant asked for,
|
|
42
|
+
* or as whatever table its header describes.
|
|
40
43
|
* @yields DataSourceChunk objects containing parsed nodes and edges
|
|
41
44
|
*/
|
|
42
45
|
sourceFetchData(): AsyncGenerator<DataSourceChunk, void, unknown>;
|
|
43
46
|
/**
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
* @
|
|
48
|
-
*
|
|
49
|
-
* @param
|
|
50
|
-
* @param
|
|
51
|
-
* @param
|
|
52
|
-
*
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
private
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
47
|
+
* Read a single table, choosing an edge table's endpoint columns.
|
|
48
|
+
*
|
|
49
|
+
* The endpoint columns are the configured ones, else the variant's, else the first pair of
|
|
50
|
+
* {@link ENDPOINT_PAIRS} the header holds both halves of. A configured column the file does not
|
|
51
|
+
* have is recorded as an error and nothing is read. The import's issues are recorded.
|
|
52
|
+
* @param content - the file's text
|
|
53
|
+
* @param table - the variant's table options
|
|
54
|
+
* @param mayBeNodeList - read a header with no endpoint pair and an `id` column as a node table
|
|
55
|
+
* (a node table's own id column is looked for the same way, and is the row number without one)
|
|
56
|
+
* @returns the records, or null when the header names no endpoint pair (and, where it may be a
|
|
57
|
+
* node list, no id column): the rows are then handed to the element unread
|
|
58
|
+
*/
|
|
59
|
+
private readTable;
|
|
60
|
+
/**
|
|
61
|
+
* Read one table with the options every CSV route shares.
|
|
62
|
+
* @param content - the file's text
|
|
63
|
+
* @param table - the variant's table options
|
|
64
|
+
* @param nodes - a node file read before the edges, for a pair of files
|
|
65
|
+
* @returns the records and the report
|
|
66
|
+
*/
|
|
67
|
+
private importTable;
|
|
68
|
+
/**
|
|
69
|
+
* Hand the rows of a file whose header names no endpoint column to the element unread.
|
|
70
|
+
*
|
|
71
|
+
* Such a row is not a malformed edge, it is a file whose endpoint columns are named something
|
|
72
|
+
* else entirely -- and the reader has no idea what. Dropping it produced a graph with no edges,
|
|
73
|
+
* a pile of "Missing source" errors and a load that reported success. Handing it over unread
|
|
74
|
+
* lets the ELEMENT refuse the batch and name the columns the file does carry, which is the one
|
|
75
|
+
* message a reader can act on. The rows are read as a node table numbered by row, so no column
|
|
76
|
+
* is taken as an id and every column of every row is kept.
|
|
77
|
+
* @param content - the file's text
|
|
78
|
+
* @yields the rows as edge records, and no nodes
|
|
79
|
+
*/
|
|
80
|
+
private passThroughRows;
|
|
81
|
+
/**
|
|
82
|
+
* Read a Neo4j admin-import file: node sections and relationship sections, each under its own
|
|
83
|
+
* header row.
|
|
84
|
+
*
|
|
85
|
+
* The records keep the keys the element's reader always gave them: a node's `:LABEL` cell
|
|
86
|
+
* arrives as `label` (several labels joined by `;`, as the cell wrote them) and a
|
|
87
|
+
* relationship's `:TYPE` as `type`.
|
|
88
|
+
*
|
|
89
|
+
* This importer declares NO direction, deliberately. A Neo4j relationship is directed as a
|
|
90
|
+
* property of the database, not as something the CSV states -- the file carries :START_ID and
|
|
91
|
+
* :END_ID and no field that could say otherwise -- so there is nothing here to read. The
|
|
92
|
+
* element's own configuration stands, and under "auto" that is already directed.
|
|
93
|
+
* @param content - the file's text
|
|
94
|
+
* @yields the nodes and relationships
|
|
95
|
+
*/
|
|
96
|
+
private parseNeo4j;
|
|
61
97
|
private parsePairedFiles;
|
|
98
|
+
/**
|
|
99
|
+
* Declare the direction a Gephi `Type` column states, then yield the records in chunks.
|
|
100
|
+
*
|
|
101
|
+
* The same `Type` column is read on every route -- a single edge file, or the edge file of a
|
|
102
|
+
* pair: an export split into a node file and an edge file is the same export, and must not be
|
|
103
|
+
* read as a different graph because of how it was handed over. It is declared before the first
|
|
104
|
+
* chunk is yielded, and therefore before the first edge reaches the builder.
|
|
105
|
+
* The id and endpoints are written last, so an attribute column that happens to be named
|
|
106
|
+
* `id`, `source` or `target` cannot take their place.
|
|
107
|
+
* @param nodes - the nodes
|
|
108
|
+
* @param edges - the edges
|
|
109
|
+
* @yields the chunks
|
|
110
|
+
*/
|
|
111
|
+
private emit;
|
|
112
|
+
/**
|
|
113
|
+
* Record an error, and stop the load at the error limit as every reader does.
|
|
114
|
+
* @param error - the error
|
|
115
|
+
*/
|
|
116
|
+
private addError;
|
|
62
117
|
}
|
|
63
118
|
export {};
|
|
@@ -50,6 +50,11 @@ export declare class ErrorAggregator {
|
|
|
50
50
|
* @returns The count of accumulated errors
|
|
51
51
|
*/
|
|
52
52
|
getErrorCount(): number;
|
|
53
|
+
/**
|
|
54
|
+
* Get the number of errors this aggregator collects before it stops
|
|
55
|
+
* @returns The error limit
|
|
56
|
+
*/
|
|
57
|
+
getErrorLimit(): number;
|
|
53
58
|
/**
|
|
54
59
|
* Check if error limit has been reached
|
|
55
60
|
* @returns True if the maximum error count has been reached
|
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
import { BaseDataSourceConfig, DataSource, DataSourceChunk } from "./DataSource.js";
|
|
2
2
|
type GEXFDataSourceConfig = BaseDataSourceConfig;
|
|
3
3
|
/**
|
|
4
|
-
* Data source for loading graph data from GEXF (Graph Exchange XML Format) files
|
|
5
|
-
* Supports node and edge attributes, attribute types,
|
|
4
|
+
* Data source for loading graph data from GEXF (Graph Exchange XML Format) files, read by
|
|
5
|
+
* `@graphty/graph-io`'s GEXF importer. Supports node and edge attributes, attribute types, the viz
|
|
6
|
+
* namespace and dynamic graphs.
|
|
6
7
|
*
|
|
7
8
|
* Dynamic graphs keep their time data on each record rather than acting on it:
|
|
8
|
-
* - a node's or edge's `start` / `end` / `timestamp`
|
|
9
|
-
*
|
|
9
|
+
* - a node's or edge's `start` / `end` / `timestamp` go onto its data under those names, with
|
|
10
|
+
* `startOpen` / `endOpen` set for an open bound, and its `<spells>` go onto `spells` as a list of
|
|
11
|
+
* `{ start, end }` intervals;
|
|
10
12
|
* - an attribute with time-sliced `attvalue`s becomes a list of `{ value, start, end }` slices
|
|
11
13
|
* instead of a single value. An attribute with no timed `attvalue` keeps its plain value.
|
|
12
14
|
*
|
|
13
|
-
*
|
|
15
|
+
* An edge that names a node the file never declared is kept, and the node is created for it.
|
|
14
16
|
*/
|
|
15
17
|
export declare class GEXFDataSource extends DataSource {
|
|
16
18
|
static readonly type = "gexf";
|
|
@@ -27,62 +29,11 @@ export declare class GEXFDataSource extends DataSource {
|
|
|
27
29
|
*/
|
|
28
30
|
sourceFetchData(): AsyncGenerator<DataSourceChunk, void, unknown>;
|
|
29
31
|
/**
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
* way it would have by writing the attribute out, and that is how every other GEXF reader
|
|
35
|
-
* takes it, NetworkX included.
|
|
36
|
-
*
|
|
37
|
-
* WHY THE CALLER IS TOLD WHETHER THE ATTRIBUTE WAS WRITTEN. A direction the file's author typed
|
|
38
|
-
* out and a direction the schema supplied for them are not equally strong, and the difference
|
|
39
|
-
* decides what happens when the edges say something else. An author who wrote
|
|
40
|
-
* `defaultedgetype="undirected"` and then marked one edge `type="directed"` described a mixed
|
|
41
|
-
* graph, and the graph-level statement is the one to keep. An author who wrote no
|
|
42
|
-
* `defaultedgetype` at all and marked every edge `type="directed"` stated direction in exactly
|
|
43
|
-
* one place, and reading that file as undirected would invent a reverse path for every edge in
|
|
44
|
-
* it. Both cases arrive here as `directed: false`; only `written` separates them.
|
|
45
|
-
*
|
|
46
|
-
* An unreadable value is reported as unwritten, because a keyword GEXF does not define is not a
|
|
47
|
-
* statement the element can act on -- but the text says the attribute was there and could not
|
|
48
|
-
* be read, rather than claiming the file omitted it.
|
|
49
|
-
* @param graph - the parsed `<graph>` element
|
|
50
|
-
* @returns the direction, whether the file actually wrote it, and the text that stated it
|
|
32
|
+
* Import the document through graph-io.
|
|
33
|
+
* @param text - the document
|
|
34
|
+
* @param defaultDirected - the direction an edge without a `type` takes when the graph wrote none
|
|
35
|
+
* @returns the import
|
|
51
36
|
*/
|
|
52
|
-
private
|
|
53
|
-
private parseAttributeDefinitions;
|
|
54
|
-
private parseNodes;
|
|
55
|
-
/**
|
|
56
|
-
* Parse the `<edges>` children, and tally what each one said about its own direction.
|
|
57
|
-
*
|
|
58
|
-
* A GEXF edge may carry its own `type`, which makes a MIXED graph expressible in the file and
|
|
59
|
-
* not in the element: the snapshot holds one direction flag for the whole graph. So the two
|
|
60
|
-
* tallies returned here are raw counts rather than a count of disagreements -- which edges
|
|
61
|
-
* disagree cannot be known until the graph's direction is settled, and on a file that never
|
|
62
|
-
* wrote `defaultedgetype` these tallies are what settles it. {@link resolveDirection} decides.
|
|
63
|
-
*
|
|
64
|
-
* Nothing is thrown away either way: each edge keeps its own `type` on its record, so a style
|
|
65
|
-
* layer can still draw that one edge differently.
|
|
66
|
-
* @param edgeData - the parsed `<edge>` elements
|
|
67
|
-
* @param attributes - the edge attribute definitions
|
|
68
|
-
* @returns the edge records, and how many edges stated each direction
|
|
69
|
-
*/
|
|
70
|
-
private parseEdges;
|
|
71
|
-
/**
|
|
72
|
-
* Copy a node's or edge's lifetime, spells and attribute values onto its record.
|
|
73
|
-
*
|
|
74
|
-
* Every `attvalue` for one attribute is kept: if any of them is timed, the attribute becomes
|
|
75
|
-
* the list of all its slices, `{ value, start, end }`, in file order; otherwise it keeps its
|
|
76
|
-
* plain value, so a static file reads exactly as it always has.
|
|
77
|
-
* @param obj - the parsed `<node>` or `<edge>`
|
|
78
|
-
* @param obj.attvalues - its `<attvalues>` element, if any
|
|
79
|
-
* @param obj.attvalues.attvalue - the `<attvalue>` children
|
|
80
|
-
* @param obj.spells - its `<spells>` element, if any
|
|
81
|
-
* @param obj.spells.spell - the `<spell>` children
|
|
82
|
-
* @param record - the record being built, written in place
|
|
83
|
-
* @param attributes - the attribute definitions for this element class
|
|
84
|
-
*/
|
|
85
|
-
private readTimeData;
|
|
86
|
-
private parseValue;
|
|
37
|
+
private read;
|
|
87
38
|
}
|
|
88
39
|
export {};
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { BaseDataSourceConfig, DataSource, DataSourceChunk } from "./DataSource.js";
|
|
2
2
|
type GraphMLDataSourceConfig = BaseDataSourceConfig;
|
|
3
3
|
/**
|
|
4
|
-
* Data source for loading graph data from GraphML files
|
|
5
|
-
* Supports
|
|
4
|
+
* Data source for loading graph data from GraphML files, read by `@graphty/graph-io`'s GraphML
|
|
5
|
+
* importer. Supports key definitions and data elements, and the yFiles `ShapeNode` and
|
|
6
|
+
* `PolyLineEdge` graphics (position, size, colours, border, label, shape and arrows).
|
|
6
7
|
*/
|
|
7
8
|
export declare class GraphMLDataSource extends DataSource {
|
|
8
9
|
static readonly type = "graphml";
|
|
@@ -18,47 +19,5 @@ export declare class GraphMLDataSource extends DataSource {
|
|
|
18
19
|
* @yields DataSourceChunk objects containing parsed nodes and edges
|
|
19
20
|
*/
|
|
20
21
|
sourceFetchData(): AsyncGenerator<DataSourceChunk, void, unknown>;
|
|
21
|
-
private parseKeyDefinitions;
|
|
22
|
-
private parseNodes;
|
|
23
|
-
/**
|
|
24
|
-
* Parse the `<edge>` children, and count the ones that contradict the graph's declaration.
|
|
25
|
-
*
|
|
26
|
-
* A GraphML edge may carry `directed="true|false"` of its own, which overrides `edgedefault`
|
|
27
|
-
* for that edge alone and so makes a MIXED graph expressible in the file but not in the
|
|
28
|
-
* element, whose snapshot holds one direction flag for the whole graph. `edgedefault` is what
|
|
29
|
-
* the element adopts, because it is the file's statement about the graph AS A WHOLE. The
|
|
30
|
-
* per-edge value is not discarded: it is kept on the edge record as `directed`, where a style
|
|
31
|
-
* layer can still read it, and the count returned here is what the element logs.
|
|
32
|
-
* @param edgeData - the parsed `<edge>` elements
|
|
33
|
-
* @param keys - the key definitions
|
|
34
|
-
* @param declaredDirected - what `edgedefault` declared, or null when it declared nothing
|
|
35
|
-
* @returns the edge records, and how many carried a `directed` attribute that disagrees
|
|
36
|
-
*/
|
|
37
|
-
private parseEdges;
|
|
38
|
-
private parseValue;
|
|
39
|
-
/**
|
|
40
|
-
* Maps yFiles shape types to Graphty shape types
|
|
41
|
-
* @param yfilesShape - yFiles shape type identifier
|
|
42
|
-
* @returns Corresponding Graphty shape type
|
|
43
|
-
*/
|
|
44
|
-
private mapYFilesShape;
|
|
45
|
-
/**
|
|
46
|
-
* Normalizes color to standard hex format (#RRGGBB)
|
|
47
|
-
* @param color - Color value in any format
|
|
48
|
-
* @returns Normalized hex color string
|
|
49
|
-
*/
|
|
50
|
-
private normalizeColor;
|
|
51
|
-
/**
|
|
52
|
-
* Parses yFiles ShapeNode data and extracts visual properties
|
|
53
|
-
* @param shapeNode - yFiles ShapeNode data structure
|
|
54
|
-
* @returns Object containing extracted node properties
|
|
55
|
-
*/
|
|
56
|
-
private parseYFilesShapeNode;
|
|
57
|
-
/**
|
|
58
|
-
* Parses yFiles PolyLineEdge data and extracts visual properties
|
|
59
|
-
* @param polyLineEdge - yFiles PolyLineEdge data structure
|
|
60
|
-
* @returns Object containing extracted edge properties
|
|
61
|
-
*/
|
|
62
|
-
private parseYFilesPolyLineEdge;
|
|
63
22
|
}
|
|
64
23
|
export {};
|