@knowvah/dot-engine 2.10.2 → 2.10.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/dist/gvc/layout-reset.d.ts.map +1 -1
- package/dist/index.js +0 -51
- package/dist/index.js.map +3 -3
- package/dist/layout/circo/index.d.ts.map +1 -1
- package/dist/layout/dot/init.d.ts +0 -10
- package/dist/layout/dot/init.d.ts.map +1 -1
- package/dist/layout/fdp/init.d.ts.map +1 -1
- package/dist/layout/neato/init.d.ts.map +1 -1
- package/dist/layout/osage/index.d.ts +1 -4
- package/dist/layout/osage/index.d.ts.map +1 -1
- package/dist/layout/patchwork/index.d.ts.map +1 -1
- package/dist/layout/sfdp/init.d.ts.map +1 -1
- package/dist/layout/twopi/init.d.ts.map +1 -1
- package/dist/render.js +0 -51
- package/dist/render.js.map +3 -3
- package/package.json +1 -1
- package/src/gvc/layout-reset.ts +9 -1
- package/src/layout/circo/index.ts +1 -3
- package/src/layout/dot/init.ts +2 -32
- package/src/layout/fdp/init.ts +2 -17
- package/src/layout/neato/init.ts +1 -3
- package/src/layout/osage/index.ts +3 -22
- package/src/layout/patchwork/index.ts +1 -3
- package/src/layout/sfdp/init.ts +1 -3
- package/src/layout/twopi/init.ts +1 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@knowvah/dot-engine",
|
|
3
|
-
"version": "2.10.
|
|
3
|
+
"version": "2.10.3",
|
|
4
4
|
"description": "Faithful TypeScript port of Graphviz (dot, neato, fdp, sfdp, circo, twopi, osage, patchwork) — no C: no native binary, no WASM. Oracle-verified against the C implementation, runs in the browser.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"graphviz",
|
package/src/gvc/layout-reset.ts
CHANGED
|
@@ -9,9 +9,17 @@
|
|
|
9
9
|
* therefore only marks the graph freed, and the next `layout` replaces the
|
|
10
10
|
* records before the engine runs. That is an explicit deviation in WHEN the
|
|
11
11
|
* records go. What a layout sees is the same: zeroed records after a free, stale
|
|
12
|
-
* ones without one.
|
|
12
|
+
* ones without one. C's label frees (gv_cleanup_node, gv_cleanup_edge,
|
|
13
|
+
* dot_cleanup_graph, cleanup_subgs, cleanup_graphs), and osage's cluster arrays,
|
|
14
|
+
* go the same way, since `getLayout` publishes them: engine cleanups leave them,
|
|
15
|
+
* and this reset drops them.
|
|
13
16
|
*
|
|
14
17
|
* @see lib/gvc/gvlayout.c:gvFreeLayout
|
|
18
|
+
* @see lib/common/utils.c:gv_cleanup_node
|
|
19
|
+
* @see lib/common/utils.c:gv_cleanup_edge
|
|
20
|
+
* @see lib/dotgen/dotinit.c:dot_cleanup_graph
|
|
21
|
+
* @see lib/fdpgen/fdpinit.c:cleanup_subgs
|
|
22
|
+
* @see lib/osage/osageinit.c:cleanup_graphs
|
|
15
23
|
*/
|
|
16
24
|
|
|
17
25
|
import { makeEdgeInfo, makePort } from '../model/edgeInfo.js';
|
|
@@ -18,7 +18,6 @@
|
|
|
18
18
|
*/
|
|
19
19
|
|
|
20
20
|
import type { Graph } from '../../model/graph.js';
|
|
21
|
-
import { gvCleanupEdgeLabels, gvCleanupNodeLabels } from '../dot/init.js';
|
|
22
21
|
import type { LayoutEngine } from '../../gvc/context.js';
|
|
23
22
|
import { circoInitGraph, freeNData } from './init.js';
|
|
24
23
|
import { circoLayout } from './circular.js';
|
|
@@ -74,8 +73,7 @@ export function circoLayoutFull(g: Graph): void {
|
|
|
74
73
|
/** @see lib/circogen/circularinit.c:circo_cleanup */
|
|
75
74
|
export function circoCleanup(g: Graph): void {
|
|
76
75
|
if (g.nodes.size === 0) return; // C: g is empty
|
|
77
|
-
|
|
78
|
-
for (const n of g.nodes.values()) gvCleanupNodeLabels(n); // gv_cleanup_node
|
|
76
|
+
// gv_cleanup_edge, gv_cleanup_node: labels go at the next layout (layout-reset.ts).
|
|
79
77
|
// Derived graph was stored in g.info.alg during circoLayout; clear it.
|
|
80
78
|
g.info.alg = undefined;
|
|
81
79
|
g.info.neato_nlist = undefined;
|
package/src/layout/dot/init.ts
CHANGED
|
@@ -291,35 +291,6 @@ export function removeFill(g: Graph): void {
|
|
|
291
291
|
// dotCleanup
|
|
292
292
|
// ---------------------------------------------------------------------------
|
|
293
293
|
|
|
294
|
-
/**
|
|
295
|
-
* The label frees shared by every engine's per-edge cleanup.
|
|
296
|
-
* @see lib/common/utils.c:gv_cleanup_edge
|
|
297
|
-
*/
|
|
298
|
-
export function gvCleanupEdgeLabels(e: Edge): void {
|
|
299
|
-
e.info.label = undefined;
|
|
300
|
-
e.info.xlabel = undefined;
|
|
301
|
-
e.info.head_label = undefined;
|
|
302
|
-
e.info.tail_label = undefined;
|
|
303
|
-
}
|
|
304
|
-
|
|
305
|
-
/**
|
|
306
|
-
* The label frees shared by every non-dot engine's per-node cleanup.
|
|
307
|
-
* @see lib/common/utils.c:gv_cleanup_node
|
|
308
|
-
*/
|
|
309
|
-
export function gvCleanupNodeLabels(n: Node): void {
|
|
310
|
-
n.info.label = undefined;
|
|
311
|
-
n.info.xlabel = undefined;
|
|
312
|
-
}
|
|
313
|
-
|
|
314
|
-
/**
|
|
315
|
-
* Frees non-root subgraph labels, recursing into every subgraph first.
|
|
316
|
-
* @see lib/dotgen/dotinit.c:dot_cleanup_graph
|
|
317
|
-
*/
|
|
318
|
-
function dotCleanupGraph(g: Graph): void {
|
|
319
|
-
for (const subg of g.subgraphs.values()) dotCleanupGraph(subg);
|
|
320
|
-
if (g !== g.root) g.info.label = undefined;
|
|
321
|
-
}
|
|
322
|
-
|
|
323
294
|
/**
|
|
324
295
|
* Clears all edge lists and linked-list pointers from nodes in the fast-graph,
|
|
325
296
|
* releasing layout state without destroying the underlying graph structure.
|
|
@@ -329,9 +300,8 @@ function dotCleanupGraph(g: Graph): void {
|
|
|
329
300
|
* @see lib/dotgen/dotinit.c:dot_cleanup
|
|
330
301
|
*/
|
|
331
302
|
export function dotCleanup(g: Graph): void {
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
dotCleanupGraph(g);
|
|
303
|
+
// gv_cleanup_edge, dot_cleanup_node, dot_cleanup_graph: labels go at the next
|
|
304
|
+
// layout (layout-reset.ts).
|
|
335
305
|
let n: Node | undefined = g.info.nlist;
|
|
336
306
|
while (n !== undefined) {
|
|
337
307
|
const next: Node | undefined = n.info.next;
|
package/src/layout/fdp/init.ts
CHANGED
|
@@ -14,7 +14,6 @@
|
|
|
14
14
|
*/
|
|
15
15
|
|
|
16
16
|
import type { Graph } from '../../model/graph.js';
|
|
17
|
-
import { gvCleanupEdgeLabels, gvCleanupNodeLabels } from '../dot/init.js';
|
|
18
17
|
import type { Node } from '../../model/node.js';
|
|
19
18
|
import type { Edge } from '../../model/edge.js';
|
|
20
19
|
import { commonInitNodeEdge, lateDouble, layoutMeasurer } from '../../common/nodeinit.js';
|
|
@@ -100,28 +99,14 @@ export function fdpInitNodeEdge(g: Graph): void {
|
|
|
100
99
|
initialPositions(g);
|
|
101
100
|
}
|
|
102
101
|
|
|
103
|
-
/**
|
|
104
|
-
* Frees each cluster label, recursively.
|
|
105
|
-
* @see lib/fdpgen/fdpinit.c:cleanup_subgs
|
|
106
|
-
*/
|
|
107
|
-
function fdpCleanupSubgs(g: Graph): void {
|
|
108
|
-
const nClust = g.info.n_cluster ?? 0;
|
|
109
|
-
for (let i = 1; i <= nClust; i++) {
|
|
110
|
-
const subg = g.info.clust![i - 1];
|
|
111
|
-
subg.info.label = undefined;
|
|
112
|
-
fdpCleanupSubgs(subg);
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
|
|
116
102
|
/**
|
|
117
103
|
* Release fdp layout state (gv_cleanup analogue; the render pipeline
|
|
118
104
|
* runs before cleanup per the M2 ordering fix).
|
|
119
105
|
* @see lib/fdpgen/fdpinit.c:fdp_cleanup
|
|
120
106
|
*/
|
|
121
107
|
export function fdpCleanup(g: Graph): void {
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
fdpCleanupSubgs(g);
|
|
108
|
+
// gv_cleanup_edge, gv_cleanup_node, cleanup_subgs: labels go at the next layout
|
|
109
|
+
// (layout-reset.ts).
|
|
125
110
|
for (const n of g.nodes.values()) {
|
|
126
111
|
n.info.alg = undefined;
|
|
127
112
|
n.info.pos = undefined;
|
package/src/layout/neato/init.ts
CHANGED
|
@@ -11,7 +11,6 @@
|
|
|
11
11
|
|
|
12
12
|
import type { ShapeDesc } from '../../common/types.js';
|
|
13
13
|
import type { Graph } from '../../model/graph.js';
|
|
14
|
-
import { gvCleanupEdgeLabels, gvCleanupNodeLabels } from '../dot/init.js';
|
|
15
14
|
import type { Node } from '../../model/node.js';
|
|
16
15
|
import type { Edge } from '../../model/edge.js';
|
|
17
16
|
import type { VtxData } from './dijkstra.js';
|
|
@@ -479,8 +478,7 @@ export function neatoSetAspect(g: Graph): void {
|
|
|
479
478
|
* @see lib/neatogen/neatoinit.c:neato_cleanup
|
|
480
479
|
*/
|
|
481
480
|
export function neatoCleanup(g: Graph): void {
|
|
482
|
-
|
|
483
|
-
for (const n of g.nodes.values()) gvCleanupNodeLabels(n); // gv_cleanup_node
|
|
481
|
+
// gv_cleanup_edge, gv_cleanup_node: labels go at the next layout (layout-reset.ts).
|
|
484
482
|
for (const [, n] of g.nodes) {
|
|
485
483
|
n.info.pos = undefined;
|
|
486
484
|
n.info.pinned = undefined;
|
|
@@ -11,7 +11,6 @@
|
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
13
|
import type { Graph } from '../../model/graph.js';
|
|
14
|
-
import { gvCleanupEdgeLabels, gvCleanupNodeLabels } from '../dot/init.js';
|
|
15
14
|
import type { Node } from '../../model/node.js';
|
|
16
15
|
import type { Box } from '../../model/geom.js';
|
|
17
16
|
import type { LayoutEngine } from '../../gvc/context.js';
|
|
@@ -501,22 +500,6 @@ export function osageLayout(g: Graph): void {
|
|
|
501
500
|
gvPostprocess(g);
|
|
502
501
|
}
|
|
503
502
|
|
|
504
|
-
// ---------------------------------------------------------------------------
|
|
505
|
-
// osageCleanup helpers — exported for Lizard
|
|
506
|
-
// ---------------------------------------------------------------------------
|
|
507
|
-
|
|
508
|
-
/** Recursively clear cluster arrays from g and all subclusters. */
|
|
509
|
-
export function cleanupGraphs(g: Graph): void {
|
|
510
|
-
const nClust = g.info.n_cluster ?? 0;
|
|
511
|
-
for (let i = 1; i <= nClust; i++) {
|
|
512
|
-
const subg = g.info.clust![i - 1];
|
|
513
|
-
subg.info.label = undefined; // free_label(GD_label(subg))
|
|
514
|
-
cleanupGraphs(subg);
|
|
515
|
-
}
|
|
516
|
-
g.info.clust = undefined;
|
|
517
|
-
g.info.n_cluster = undefined;
|
|
518
|
-
}
|
|
519
|
-
|
|
520
503
|
// ---------------------------------------------------------------------------
|
|
521
504
|
// osageCleanup
|
|
522
505
|
// ---------------------------------------------------------------------------
|
|
@@ -524,18 +507,16 @@ export function cleanupGraphs(g: Graph): void {
|
|
|
524
507
|
/**
|
|
525
508
|
* Free all layout-specific memory attached to g.
|
|
526
509
|
*
|
|
527
|
-
* Clears alg (osage ownership tag) from all nodes
|
|
528
|
-
* arrays from GraphInfo.
|
|
510
|
+
* Clears alg (osage ownership tag) from all nodes.
|
|
529
511
|
*
|
|
530
512
|
* @see lib/osage/osageinit.c:osage_cleanup
|
|
531
513
|
*/
|
|
532
514
|
export function osageCleanup(g: Graph): void {
|
|
533
|
-
|
|
534
|
-
for (const n of g.nodes.values()) gvCleanupNodeLabels(n); // gv_cleanup_node
|
|
515
|
+
// gv_cleanup_edge, gv_cleanup_node: labels go at the next layout (layout-reset.ts).
|
|
535
516
|
for (const n of g.nodes.values()) {
|
|
536
517
|
if (n.info.alg?.kind === 'osage') n.info.alg = undefined;
|
|
537
518
|
}
|
|
538
|
-
|
|
519
|
+
// cleanup_graphs: cluster labels and arrays go at the next layout (layout-reset.ts).
|
|
539
520
|
}
|
|
540
521
|
|
|
541
522
|
// ---------------------------------------------------------------------------
|
|
@@ -15,7 +15,6 @@
|
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
17
|
import type { Graph } from '../../model/graph.js';
|
|
18
|
-
import { gvCleanupEdgeLabels, gvCleanupNodeLabels } from '../dot/init.js';
|
|
19
18
|
import type { Node } from '../../model/node.js';
|
|
20
19
|
import type { LayoutEngine } from '../../gvc/context.js';
|
|
21
20
|
import { ps2inch } from '../pack/index.js';
|
|
@@ -427,8 +426,7 @@ export function patchworkEngineLayout(g: Graph): void {
|
|
|
427
426
|
/** @see lib/patchwork/patchworkinit.c:patchwork_cleanup */
|
|
428
427
|
export function patchworkEngineCleanup(g: Graph): void {
|
|
429
428
|
if (g.nodes.size === 0) return; // C: if (!n) return
|
|
430
|
-
|
|
431
|
-
for (const n of g.nodes.values()) gvCleanupNodeLabels(n); // gv_cleanup_node
|
|
429
|
+
// gv_cleanup_edge, gv_cleanup_node: labels go at the next layout (layout-reset.ts).
|
|
432
430
|
g.info.clust = undefined;
|
|
433
431
|
g.info.n_cluster = undefined;
|
|
434
432
|
for (const n of g.nodes.values()) { n.info.alg = undefined; }
|
package/src/layout/sfdp/init.ts
CHANGED
|
@@ -12,7 +12,6 @@
|
|
|
12
12
|
|
|
13
13
|
import { RenderError } from '../../errors.js';
|
|
14
14
|
import type { Graph } from '../../model/graph.js';
|
|
15
|
-
import { gvCleanupEdgeLabels, gvCleanupNodeLabels } from '../dot/init.js';
|
|
16
15
|
import { setEdgeTypeFromAttr } from '../dot/index.js';
|
|
17
16
|
import { EDGETYPE_LINE } from '../neato/splines.js';
|
|
18
17
|
import { neatoInitNode } from '../neato/init.js';
|
|
@@ -273,8 +272,7 @@ export function getPos(g: Graph, dim: number): number[] {
|
|
|
273
272
|
* @see lib/sfdpgen/sfdpinit.c:sfdp_cleanup
|
|
274
273
|
*/
|
|
275
274
|
export function sfdpCleanup(g: Graph): void {
|
|
276
|
-
|
|
277
|
-
for (const n of g.nodes.values()) gvCleanupNodeLabels(n); // gv_cleanup_node
|
|
275
|
+
// gv_cleanup_edge, gv_cleanup_node: labels go at the next layout (layout-reset.ts).
|
|
278
276
|
for (const n of g.nodes.values()) {
|
|
279
277
|
n.info.pos = undefined;
|
|
280
278
|
n.info.id = undefined;
|
package/src/layout/twopi/init.ts
CHANGED
|
@@ -10,7 +10,6 @@
|
|
|
10
10
|
|
|
11
11
|
import type { ShapeDesc } from '../../common/types.js';
|
|
12
12
|
import type { Graph } from '../../model/graph.js';
|
|
13
|
-
import { gvCleanupEdgeLabels, gvCleanupNodeLabels } from '../dot/init.js';
|
|
14
13
|
import type { Node } from '../../model/node.js';
|
|
15
14
|
import type { Edge } from '../../model/edge.js';
|
|
16
15
|
import type { TwopiAlgData } from '../../model/nodeInfo.js';
|
|
@@ -185,7 +184,6 @@ export function twopiFreeAlg(g: Graph): void {
|
|
|
185
184
|
*/
|
|
186
185
|
export function twopiCleanup(g: Graph): void {
|
|
187
186
|
if (g.nodes.size === 0) return; // C: empty graph
|
|
188
|
-
|
|
189
|
-
for (const n of g.nodes.values()) gvCleanupNodeLabels(n); // gv_cleanup_node
|
|
187
|
+
// gv_cleanup_edge, gv_cleanup_node: labels go at the next layout (layout-reset.ts).
|
|
190
188
|
g.info.neato_nlist = undefined; // twopi_cleanup_graph
|
|
191
189
|
}
|