@statelyai/graph 0.10.0 → 0.11.1
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 +26 -6
- package/dist/{algorithms-C-S7u40k.mjs → algorithms-BHHg7lGq.mjs} +1509 -2132
- package/dist/algorithms-BlM-qoJb.d.mts +178 -0
- package/dist/algorithms.d.mts +1 -1
- package/dist/algorithms.mjs +1 -1
- package/dist/{converter-B5CUD0r9.mjs → converter-Dspillnn.mjs} +2 -2
- package/dist/format-support.d.mts +22 -0
- package/dist/format-support.mjs +309 -0
- package/dist/formats/adjacency-list/index.d.mts +1 -1
- package/dist/formats/adjacency-list/index.mjs +1 -1
- package/dist/formats/converter/index.d.mts +1 -1
- package/dist/formats/converter/index.mjs +1 -1
- package/dist/formats/cytoscape/index.d.mts +1 -1
- package/dist/formats/cytoscape/index.mjs +1 -1
- package/dist/formats/d3/index.d.mts +1 -1
- package/dist/formats/d3/index.mjs +1 -1
- package/dist/formats/dot/index.d.mts +1 -1
- package/dist/formats/dot/index.mjs +1 -1
- package/dist/formats/edge-list/index.d.mts +1 -1
- package/dist/formats/edge-list/index.mjs +1 -1
- package/dist/formats/elk/index.d.mts +1 -1
- package/dist/formats/gexf/index.d.mts +1 -1
- package/dist/formats/gexf/index.mjs +1 -1
- package/dist/formats/gml/index.d.mts +1 -1
- package/dist/formats/gml/index.mjs +1 -1
- package/dist/formats/graphml/index.d.mts +1 -1
- package/dist/formats/graphml/index.mjs +34 -1
- package/dist/formats/jgf/index.d.mts +1 -1
- package/dist/formats/jgf/index.mjs +1 -1
- package/dist/formats/mermaid/index.d.mts +47 -3
- package/dist/formats/mermaid/index.mjs +234 -29
- package/dist/formats/tgf/index.d.mts +1 -1
- package/dist/formats/tgf/index.mjs +1 -1
- package/dist/formats/xyflow/index.d.mts +1 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +3 -3
- package/dist/queries.d.mts +1 -1
- package/dist/queries.mjs +1 -1
- package/dist/schemas.d.mts +52 -3
- package/dist/schemas.mjs +22 -3
- package/package.json +6 -2
- package/schemas/edge.schema.json +16 -1
- package/schemas/graph.schema.json +80 -4
- package/schemas/node.schema.json +64 -2
- package/dist/algorithms-DdjFO-ft.d.mts +0 -787
- /package/dist/{adjacency-list-fldj-QAL.mjs → adjacency-list-Ca0VjKIf.mjs} +0 -0
- /package/dist/{edge-list-Br05wXMg.mjs → edge-list-gKe8-iRa.mjs} +0 -0
- /package/dist/{indexing-DyfgLuzw.mjs → indexing-CJc-ul8e.mjs} +0 -0
- /package/dist/{types-F3j-sr2X.d.mts → types-CnZ01raw.d.mts} +0 -0
package/README.md
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: '@statelyai/graph'
|
|
3
|
+
---
|
|
4
|
+
|
|
1
5
|
# @statelyai/graph
|
|
2
6
|
|
|
3
7
|
A TypeScript graph library built on plain JSON objects. Supports directed/undirected graphs, hierarchical nodes, graph algorithms, visual properties, and serialization to DOT, GraphML, Mermaid, and more.
|
|
@@ -12,6 +16,8 @@ npm install @statelyai/graph
|
|
|
12
16
|
|
|
13
17
|
Optional peers are only needed for specific adapters:
|
|
14
18
|
|
|
19
|
+
<!-- optional peer dependencies derived from package.json#peerDependencies -->
|
|
20
|
+
|
|
15
21
|
| Package | Needed for |
|
|
16
22
|
| --- | --- |
|
|
17
23
|
| `fast-xml-parser` | `@statelyai/graph/gexf`, `@statelyai/graph/graphml` |
|
|
@@ -135,7 +141,9 @@ getEdgesByPort(graph, 'render', 'input'); // [e1]
|
|
|
135
141
|
|
|
136
142
|
## Algorithms
|
|
137
143
|
|
|
138
|
-
|
|
144
|
+
<!-- algorithm functions exported from src/algorithms.ts -->
|
|
145
|
+
|
|
146
|
+
Includes traversal (BFS, DFS, preorder/postorder), pathfinding (shortest path, simple paths, all-pairs shortest paths, A*), centrality/link analysis (degree, closeness, betweenness, PageRank, HITS, eigenvector), community detection (label propagation, Girvan-Newman, greedy modularity, modularity scoring), cycle detection, connected/strongly-connected components, bridges, articulation points, biconnected components, isomorphism, topological sort, minimum spanning tree, and more. Many algorithms have lazy generator variants (`gen*`) for early exit.
|
|
139
147
|
|
|
140
148
|
```ts
|
|
141
149
|
import {
|
|
@@ -203,7 +211,9 @@ const d3Data = toD3Graph(graph); // D3.js { nodes, links }
|
|
|
203
211
|
const imported = fromGEXF(gexfXmlString); // GEXF (Gephi)
|
|
204
212
|
```
|
|
205
213
|
|
|
206
|
-
|
|
214
|
+
<!-- supported format adapters derived from src/formats/* subdirectories -->
|
|
215
|
+
|
|
216
|
+
**Supported formats:** Cytoscape.js JSON, D3.js JSON, JSON Graph Format, GEXF, GraphML, GML, TGF, DOT, Mermaid (flowchart, state, sequence, class, ER, mindmap, block, Ishikawa), ELK, xyflow, adjacency list, and edge list.
|
|
207
217
|
|
|
208
218
|
Each bidirectional format also has a converter object:
|
|
209
219
|
|
|
@@ -218,19 +228,27 @@ Some formats have optional peer dependencies: `fast-xml-parser` (GEXF, GraphML)
|
|
|
218
228
|
|
|
219
229
|
Format-specific docs live alongside the source:
|
|
220
230
|
|
|
231
|
+
<!-- format README files under src/formats/*/README.md -->
|
|
232
|
+
|
|
233
|
+
- [Adjacency list](./src/formats/adjacency-list/README.md)
|
|
234
|
+
- [Cytoscape](./src/formats/cytoscape/README.md)
|
|
235
|
+
- [D3](./src/formats/d3/README.md)
|
|
221
236
|
- [DOT](./src/formats/dot/README.md)
|
|
222
|
-
- [
|
|
237
|
+
- [Edge list](./src/formats/edge-list/README.md)
|
|
238
|
+
- [ELK](./src/formats/elk/README.md)
|
|
223
239
|
- [GEXF](./src/formats/gexf/README.md)
|
|
224
240
|
- [GML](./src/formats/gml/README.md)
|
|
241
|
+
- [GraphML](./src/formats/graphml/README.md)
|
|
225
242
|
- [JGF](./src/formats/jgf/README.md)
|
|
226
|
-
- [TGF](./src/formats/tgf/README.md)
|
|
227
|
-
- [Cytoscape](./src/formats/cytoscape/README.md)
|
|
228
|
-
- [D3](./src/formats/d3/README.md)
|
|
229
243
|
- [Mermaid](./src/formats/mermaid/README.md)
|
|
244
|
+
- [TGF](./src/formats/tgf/README.md)
|
|
245
|
+
- [xyflow](./src/formats/xyflow/README.md)
|
|
230
246
|
- [Converter helpers](./src/formats/converter/README.md)
|
|
231
247
|
|
|
232
248
|
## Examples
|
|
233
249
|
|
|
250
|
+
<!-- runnable example files under examples/ -->
|
|
251
|
+
|
|
234
252
|
The repo includes runnable examples under [`examples/`](./examples):
|
|
235
253
|
|
|
236
254
|
- [Flow-based math](./examples/flow-based-math.ts) shows ports, topological ordering, and value propagation.
|
|
@@ -238,6 +256,8 @@ The repo includes runnable examples under [`examples/`](./examples):
|
|
|
238
256
|
|
|
239
257
|
## Development
|
|
240
258
|
|
|
259
|
+
<!-- dev commands from package.json#scripts -->
|
|
260
|
+
|
|
241
261
|
```bash
|
|
242
262
|
pnpm install
|
|
243
263
|
pnpm verify
|