@dagrejs/dagre 2.0.0 → 2.0.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/dist/dagre.cjs.js +1 -1
- package/dist/dagre.cjs.js.map +3 -3
- package/dist/dagre.d.ts +104 -0
- package/dist/dagre.esm.js +1 -1
- package/dist/dagre.esm.js.map +3 -3
- package/dist/dagre.js +41 -1260
- package/dist/dagre.js.map +4 -4
- package/dist/dagre.min.js +1 -1
- package/dist/dagre.min.js.map +4 -4
- package/package.json +3 -2
package/dist/dagre.js
CHANGED
|
@@ -1,1241 +1,14 @@
|
|
|
1
1
|
var dagre = (() => {
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
2
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
-
var
|
|
5
|
-
|
|
3
|
+
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
4
|
+
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
5
|
+
}) : x)(function(x) {
|
|
6
|
+
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
7
|
+
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
8
|
+
});
|
|
9
|
+
var __commonJS = (cb, mod) => function __require2() {
|
|
6
10
|
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
7
11
|
};
|
|
8
|
-
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
9
|
-
|
|
10
|
-
// node_modules/@dagrejs/graphlib/lib/graph.js
|
|
11
|
-
var require_graph = __commonJS({
|
|
12
|
-
"node_modules/@dagrejs/graphlib/lib/graph.js"(exports, module) {
|
|
13
|
-
"use strict";
|
|
14
|
-
var DEFAULT_EDGE_NAME = "\0";
|
|
15
|
-
var GRAPH_NODE = "\0";
|
|
16
|
-
var EDGE_KEY_DELIM = "";
|
|
17
|
-
var Graph = class {
|
|
18
|
-
constructor(opts) {
|
|
19
|
-
__publicField(this, "_isDirected", true);
|
|
20
|
-
__publicField(this, "_isMultigraph", false);
|
|
21
|
-
__publicField(this, "_isCompound", false);
|
|
22
|
-
// Label for the graph itself
|
|
23
|
-
__publicField(this, "_label");
|
|
24
|
-
// Defaults to be set when creating a new node
|
|
25
|
-
__publicField(this, "_defaultNodeLabelFn", () => void 0);
|
|
26
|
-
// Defaults to be set when creating a new edge
|
|
27
|
-
__publicField(this, "_defaultEdgeLabelFn", () => void 0);
|
|
28
|
-
// v -> label
|
|
29
|
-
__publicField(this, "_nodes", {});
|
|
30
|
-
// v -> edgeObj
|
|
31
|
-
__publicField(this, "_in", {});
|
|
32
|
-
// u -> v -> Number
|
|
33
|
-
__publicField(this, "_preds", {});
|
|
34
|
-
// v -> edgeObj
|
|
35
|
-
__publicField(this, "_out", {});
|
|
36
|
-
// v -> w -> Number
|
|
37
|
-
__publicField(this, "_sucs", {});
|
|
38
|
-
// e -> edgeObj
|
|
39
|
-
__publicField(this, "_edgeObjs", {});
|
|
40
|
-
// e -> label
|
|
41
|
-
__publicField(this, "_edgeLabels", {});
|
|
42
|
-
/* Number of nodes in the graph. Should only be changed by the implementation. */
|
|
43
|
-
__publicField(this, "_nodeCount", 0);
|
|
44
|
-
/* Number of edges in the graph. Should only be changed by the implementation. */
|
|
45
|
-
__publicField(this, "_edgeCount", 0);
|
|
46
|
-
__publicField(this, "_parent");
|
|
47
|
-
__publicField(this, "_children");
|
|
48
|
-
if (opts) {
|
|
49
|
-
this._isDirected = Object.hasOwn(opts, "directed") ? opts.directed : true;
|
|
50
|
-
this._isMultigraph = Object.hasOwn(opts, "multigraph") ? opts.multigraph : false;
|
|
51
|
-
this._isCompound = Object.hasOwn(opts, "compound") ? opts.compound : false;
|
|
52
|
-
}
|
|
53
|
-
if (this._isCompound) {
|
|
54
|
-
this._parent = {};
|
|
55
|
-
this._children = {};
|
|
56
|
-
this._children[GRAPH_NODE] = {};
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
/* === Graph functions ========= */
|
|
60
|
-
/**
|
|
61
|
-
* Whether graph was created with 'directed' flag set to true or not.
|
|
62
|
-
*/
|
|
63
|
-
isDirected() {
|
|
64
|
-
return this._isDirected;
|
|
65
|
-
}
|
|
66
|
-
/**
|
|
67
|
-
* Whether graph was created with 'multigraph' flag set to true or not.
|
|
68
|
-
*/
|
|
69
|
-
isMultigraph() {
|
|
70
|
-
return this._isMultigraph;
|
|
71
|
-
}
|
|
72
|
-
/**
|
|
73
|
-
* Whether graph was created with 'compound' flag set to true or not.
|
|
74
|
-
*/
|
|
75
|
-
isCompound() {
|
|
76
|
-
return this._isCompound;
|
|
77
|
-
}
|
|
78
|
-
/**
|
|
79
|
-
* Sets the label of the graph.
|
|
80
|
-
*/
|
|
81
|
-
setGraph(label) {
|
|
82
|
-
this._label = label;
|
|
83
|
-
return this;
|
|
84
|
-
}
|
|
85
|
-
/**
|
|
86
|
-
* Gets the graph label.
|
|
87
|
-
*/
|
|
88
|
-
graph() {
|
|
89
|
-
return this._label;
|
|
90
|
-
}
|
|
91
|
-
/* === Node functions ========== */
|
|
92
|
-
/**
|
|
93
|
-
* Sets the default node label. If newDefault is a function, it will be
|
|
94
|
-
* invoked ach time when setting a label for a node. Otherwise, this label
|
|
95
|
-
* will be assigned as default label in case if no label was specified while
|
|
96
|
-
* setting a node.
|
|
97
|
-
* Complexity: O(1).
|
|
98
|
-
*/
|
|
99
|
-
setDefaultNodeLabel(newDefault) {
|
|
100
|
-
this._defaultNodeLabelFn = newDefault;
|
|
101
|
-
if (typeof newDefault !== "function") {
|
|
102
|
-
this._defaultNodeLabelFn = () => newDefault;
|
|
103
|
-
}
|
|
104
|
-
return this;
|
|
105
|
-
}
|
|
106
|
-
/**
|
|
107
|
-
* Gets the number of nodes in the graph.
|
|
108
|
-
* Complexity: O(1).
|
|
109
|
-
*/
|
|
110
|
-
nodeCount() {
|
|
111
|
-
return this._nodeCount;
|
|
112
|
-
}
|
|
113
|
-
/**
|
|
114
|
-
* Gets all nodes of the graph. Note, the in case of compound graph subnodes are
|
|
115
|
-
* not included in list.
|
|
116
|
-
* Complexity: O(1).
|
|
117
|
-
*/
|
|
118
|
-
nodes() {
|
|
119
|
-
return Object.keys(this._nodes);
|
|
120
|
-
}
|
|
121
|
-
/**
|
|
122
|
-
* Gets list of nodes without in-edges.
|
|
123
|
-
* Complexity: O(|V|).
|
|
124
|
-
*/
|
|
125
|
-
sources() {
|
|
126
|
-
var self = this;
|
|
127
|
-
return this.nodes().filter((v) => Object.keys(self._in[v]).length === 0);
|
|
128
|
-
}
|
|
129
|
-
/**
|
|
130
|
-
* Gets list of nodes without out-edges.
|
|
131
|
-
* Complexity: O(|V|).
|
|
132
|
-
*/
|
|
133
|
-
sinks() {
|
|
134
|
-
var self = this;
|
|
135
|
-
return this.nodes().filter((v) => Object.keys(self._out[v]).length === 0);
|
|
136
|
-
}
|
|
137
|
-
/**
|
|
138
|
-
* Invokes setNode method for each node in names list.
|
|
139
|
-
* Complexity: O(|names|).
|
|
140
|
-
*/
|
|
141
|
-
setNodes(vs, value) {
|
|
142
|
-
var args = arguments;
|
|
143
|
-
var self = this;
|
|
144
|
-
vs.forEach(function(v) {
|
|
145
|
-
if (args.length > 1) {
|
|
146
|
-
self.setNode(v, value);
|
|
147
|
-
} else {
|
|
148
|
-
self.setNode(v);
|
|
149
|
-
}
|
|
150
|
-
});
|
|
151
|
-
return this;
|
|
152
|
-
}
|
|
153
|
-
/**
|
|
154
|
-
* Creates or updates the value for the node v in the graph. If label is supplied
|
|
155
|
-
* it is set as the value for the node. If label is not supplied and the node was
|
|
156
|
-
* created by this call then the default node label will be assigned.
|
|
157
|
-
* Complexity: O(1).
|
|
158
|
-
*/
|
|
159
|
-
setNode(v, value) {
|
|
160
|
-
if (Object.hasOwn(this._nodes, v)) {
|
|
161
|
-
if (arguments.length > 1) {
|
|
162
|
-
this._nodes[v] = value;
|
|
163
|
-
}
|
|
164
|
-
return this;
|
|
165
|
-
}
|
|
166
|
-
this._nodes[v] = arguments.length > 1 ? value : this._defaultNodeLabelFn(v);
|
|
167
|
-
if (this._isCompound) {
|
|
168
|
-
this._parent[v] = GRAPH_NODE;
|
|
169
|
-
this._children[v] = {};
|
|
170
|
-
this._children[GRAPH_NODE][v] = true;
|
|
171
|
-
}
|
|
172
|
-
this._in[v] = {};
|
|
173
|
-
this._preds[v] = {};
|
|
174
|
-
this._out[v] = {};
|
|
175
|
-
this._sucs[v] = {};
|
|
176
|
-
++this._nodeCount;
|
|
177
|
-
return this;
|
|
178
|
-
}
|
|
179
|
-
/**
|
|
180
|
-
* Gets the label of node with specified name.
|
|
181
|
-
* Complexity: O(|V|).
|
|
182
|
-
*/
|
|
183
|
-
node(v) {
|
|
184
|
-
return this._nodes[v];
|
|
185
|
-
}
|
|
186
|
-
/**
|
|
187
|
-
* Detects whether graph has a node with specified name or not.
|
|
188
|
-
*/
|
|
189
|
-
hasNode(v) {
|
|
190
|
-
return Object.hasOwn(this._nodes, v);
|
|
191
|
-
}
|
|
192
|
-
/**
|
|
193
|
-
* Remove the node with the name from the graph or do nothing if the node is not in
|
|
194
|
-
* the graph. If the node was removed this function also removes any incident
|
|
195
|
-
* edges.
|
|
196
|
-
* Complexity: O(1).
|
|
197
|
-
*/
|
|
198
|
-
removeNode(v) {
|
|
199
|
-
var self = this;
|
|
200
|
-
if (Object.hasOwn(this._nodes, v)) {
|
|
201
|
-
var removeEdge = (e) => self.removeEdge(self._edgeObjs[e]);
|
|
202
|
-
delete this._nodes[v];
|
|
203
|
-
if (this._isCompound) {
|
|
204
|
-
this._removeFromParentsChildList(v);
|
|
205
|
-
delete this._parent[v];
|
|
206
|
-
this.children(v).forEach(function(child) {
|
|
207
|
-
self.setParent(child);
|
|
208
|
-
});
|
|
209
|
-
delete this._children[v];
|
|
210
|
-
}
|
|
211
|
-
Object.keys(this._in[v]).forEach(removeEdge);
|
|
212
|
-
delete this._in[v];
|
|
213
|
-
delete this._preds[v];
|
|
214
|
-
Object.keys(this._out[v]).forEach(removeEdge);
|
|
215
|
-
delete this._out[v];
|
|
216
|
-
delete this._sucs[v];
|
|
217
|
-
--this._nodeCount;
|
|
218
|
-
}
|
|
219
|
-
return this;
|
|
220
|
-
}
|
|
221
|
-
/**
|
|
222
|
-
* Sets node p as a parent for node v if it is defined, or removes the
|
|
223
|
-
* parent for v if p is undefined. Method throws an exception in case of
|
|
224
|
-
* invoking it in context of noncompound graph.
|
|
225
|
-
* Average-case complexity: O(1).
|
|
226
|
-
*/
|
|
227
|
-
setParent(v, parent) {
|
|
228
|
-
if (!this._isCompound) {
|
|
229
|
-
throw new Error("Cannot set parent in a non-compound graph");
|
|
230
|
-
}
|
|
231
|
-
if (parent === void 0) {
|
|
232
|
-
parent = GRAPH_NODE;
|
|
233
|
-
} else {
|
|
234
|
-
parent += "";
|
|
235
|
-
for (var ancestor = parent; ancestor !== void 0; ancestor = this.parent(ancestor)) {
|
|
236
|
-
if (ancestor === v) {
|
|
237
|
-
throw new Error("Setting " + parent + " as parent of " + v + " would create a cycle");
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
this.setNode(parent);
|
|
241
|
-
}
|
|
242
|
-
this.setNode(v);
|
|
243
|
-
this._removeFromParentsChildList(v);
|
|
244
|
-
this._parent[v] = parent;
|
|
245
|
-
this._children[parent][v] = true;
|
|
246
|
-
return this;
|
|
247
|
-
}
|
|
248
|
-
_removeFromParentsChildList(v) {
|
|
249
|
-
delete this._children[this._parent[v]][v];
|
|
250
|
-
}
|
|
251
|
-
/**
|
|
252
|
-
* Gets parent node for node v.
|
|
253
|
-
* Complexity: O(1).
|
|
254
|
-
*/
|
|
255
|
-
parent(v) {
|
|
256
|
-
if (this._isCompound) {
|
|
257
|
-
var parent = this._parent[v];
|
|
258
|
-
if (parent !== GRAPH_NODE) {
|
|
259
|
-
return parent;
|
|
260
|
-
}
|
|
261
|
-
}
|
|
262
|
-
}
|
|
263
|
-
/**
|
|
264
|
-
* Gets list of direct children of node v.
|
|
265
|
-
* Complexity: O(1).
|
|
266
|
-
*/
|
|
267
|
-
children(v = GRAPH_NODE) {
|
|
268
|
-
if (this._isCompound) {
|
|
269
|
-
var children = this._children[v];
|
|
270
|
-
if (children) {
|
|
271
|
-
return Object.keys(children);
|
|
272
|
-
}
|
|
273
|
-
} else if (v === GRAPH_NODE) {
|
|
274
|
-
return this.nodes();
|
|
275
|
-
} else if (this.hasNode(v)) {
|
|
276
|
-
return [];
|
|
277
|
-
}
|
|
278
|
-
}
|
|
279
|
-
/**
|
|
280
|
-
* Return all nodes that are predecessors of the specified node or undefined if node v is not in
|
|
281
|
-
* the graph. Behavior is undefined for undirected graphs - use neighbors instead.
|
|
282
|
-
* Complexity: O(|V|).
|
|
283
|
-
*/
|
|
284
|
-
predecessors(v) {
|
|
285
|
-
var predsV = this._preds[v];
|
|
286
|
-
if (predsV) {
|
|
287
|
-
return Object.keys(predsV);
|
|
288
|
-
}
|
|
289
|
-
}
|
|
290
|
-
/**
|
|
291
|
-
* Return all nodes that are successors of the specified node or undefined if node v is not in
|
|
292
|
-
* the graph. Behavior is undefined for undirected graphs - use neighbors instead.
|
|
293
|
-
* Complexity: O(|V|).
|
|
294
|
-
*/
|
|
295
|
-
successors(v) {
|
|
296
|
-
var sucsV = this._sucs[v];
|
|
297
|
-
if (sucsV) {
|
|
298
|
-
return Object.keys(sucsV);
|
|
299
|
-
}
|
|
300
|
-
}
|
|
301
|
-
/**
|
|
302
|
-
* Return all nodes that are predecessors or successors of the specified node or undefined if
|
|
303
|
-
* node v is not in the graph.
|
|
304
|
-
* Complexity: O(|V|).
|
|
305
|
-
*/
|
|
306
|
-
neighbors(v) {
|
|
307
|
-
var preds = this.predecessors(v);
|
|
308
|
-
if (preds) {
|
|
309
|
-
const union = new Set(preds);
|
|
310
|
-
for (var succ of this.successors(v)) {
|
|
311
|
-
union.add(succ);
|
|
312
|
-
}
|
|
313
|
-
return Array.from(union.values());
|
|
314
|
-
}
|
|
315
|
-
}
|
|
316
|
-
isLeaf(v) {
|
|
317
|
-
var neighbors;
|
|
318
|
-
if (this.isDirected()) {
|
|
319
|
-
neighbors = this.successors(v);
|
|
320
|
-
} else {
|
|
321
|
-
neighbors = this.neighbors(v);
|
|
322
|
-
}
|
|
323
|
-
return neighbors.length === 0;
|
|
324
|
-
}
|
|
325
|
-
/**
|
|
326
|
-
* Creates new graph with nodes filtered via filter. Edges incident to rejected node
|
|
327
|
-
* are also removed. In case of compound graph, if parent is rejected by filter,
|
|
328
|
-
* than all its children are rejected too.
|
|
329
|
-
* Average-case complexity: O(|E|+|V|).
|
|
330
|
-
*/
|
|
331
|
-
filterNodes(filter) {
|
|
332
|
-
var copy = new this.constructor({
|
|
333
|
-
directed: this._isDirected,
|
|
334
|
-
multigraph: this._isMultigraph,
|
|
335
|
-
compound: this._isCompound
|
|
336
|
-
});
|
|
337
|
-
copy.setGraph(this.graph());
|
|
338
|
-
var self = this;
|
|
339
|
-
Object.entries(this._nodes).forEach(function([v, value]) {
|
|
340
|
-
if (filter(v)) {
|
|
341
|
-
copy.setNode(v, value);
|
|
342
|
-
}
|
|
343
|
-
});
|
|
344
|
-
Object.values(this._edgeObjs).forEach(function(e) {
|
|
345
|
-
if (copy.hasNode(e.v) && copy.hasNode(e.w)) {
|
|
346
|
-
copy.setEdge(e, self.edge(e));
|
|
347
|
-
}
|
|
348
|
-
});
|
|
349
|
-
var parents = {};
|
|
350
|
-
function findParent(v) {
|
|
351
|
-
var parent = self.parent(v);
|
|
352
|
-
if (parent === void 0 || copy.hasNode(parent)) {
|
|
353
|
-
parents[v] = parent;
|
|
354
|
-
return parent;
|
|
355
|
-
} else if (parent in parents) {
|
|
356
|
-
return parents[parent];
|
|
357
|
-
} else {
|
|
358
|
-
return findParent(parent);
|
|
359
|
-
}
|
|
360
|
-
}
|
|
361
|
-
if (this._isCompound) {
|
|
362
|
-
copy.nodes().forEach((v) => copy.setParent(v, findParent(v)));
|
|
363
|
-
}
|
|
364
|
-
return copy;
|
|
365
|
-
}
|
|
366
|
-
/* === Edge functions ========== */
|
|
367
|
-
/**
|
|
368
|
-
* Sets the default edge label or factory function. This label will be
|
|
369
|
-
* assigned as default label in case if no label was specified while setting
|
|
370
|
-
* an edge or this function will be invoked each time when setting an edge
|
|
371
|
-
* with no label specified and returned value * will be used as a label for edge.
|
|
372
|
-
* Complexity: O(1).
|
|
373
|
-
*/
|
|
374
|
-
setDefaultEdgeLabel(newDefault) {
|
|
375
|
-
this._defaultEdgeLabelFn = newDefault;
|
|
376
|
-
if (typeof newDefault !== "function") {
|
|
377
|
-
this._defaultEdgeLabelFn = () => newDefault;
|
|
378
|
-
}
|
|
379
|
-
return this;
|
|
380
|
-
}
|
|
381
|
-
/**
|
|
382
|
-
* Gets the number of edges in the graph.
|
|
383
|
-
* Complexity: O(1).
|
|
384
|
-
*/
|
|
385
|
-
edgeCount() {
|
|
386
|
-
return this._edgeCount;
|
|
387
|
-
}
|
|
388
|
-
/**
|
|
389
|
-
* Gets edges of the graph. In case of compound graph subgraphs are not considered.
|
|
390
|
-
* Complexity: O(|E|).
|
|
391
|
-
*/
|
|
392
|
-
edges() {
|
|
393
|
-
return Object.values(this._edgeObjs);
|
|
394
|
-
}
|
|
395
|
-
/**
|
|
396
|
-
* Establish an edges path over the nodes in nodes list. If some edge is already
|
|
397
|
-
* exists, it will update its label, otherwise it will create an edge between pair
|
|
398
|
-
* of nodes with label provided or default label if no label provided.
|
|
399
|
-
* Complexity: O(|nodes|).
|
|
400
|
-
*/
|
|
401
|
-
setPath(vs, value) {
|
|
402
|
-
var self = this;
|
|
403
|
-
var args = arguments;
|
|
404
|
-
vs.reduce(function(v, w) {
|
|
405
|
-
if (args.length > 1) {
|
|
406
|
-
self.setEdge(v, w, value);
|
|
407
|
-
} else {
|
|
408
|
-
self.setEdge(v, w);
|
|
409
|
-
}
|
|
410
|
-
return w;
|
|
411
|
-
});
|
|
412
|
-
return this;
|
|
413
|
-
}
|
|
414
|
-
/**
|
|
415
|
-
* Creates or updates the label for the edge (v, w) with the optionally supplied
|
|
416
|
-
* name. If label is supplied it is set as the value for the edge. If label is not
|
|
417
|
-
* supplied and the edge was created by this call then the default edge label will
|
|
418
|
-
* be assigned. The name parameter is only useful with multigraphs.
|
|
419
|
-
*/
|
|
420
|
-
setEdge() {
|
|
421
|
-
var v, w, name, value;
|
|
422
|
-
var valueSpecified = false;
|
|
423
|
-
var arg0 = arguments[0];
|
|
424
|
-
if (typeof arg0 === "object" && arg0 !== null && "v" in arg0) {
|
|
425
|
-
v = arg0.v;
|
|
426
|
-
w = arg0.w;
|
|
427
|
-
name = arg0.name;
|
|
428
|
-
if (arguments.length === 2) {
|
|
429
|
-
value = arguments[1];
|
|
430
|
-
valueSpecified = true;
|
|
431
|
-
}
|
|
432
|
-
} else {
|
|
433
|
-
v = arg0;
|
|
434
|
-
w = arguments[1];
|
|
435
|
-
name = arguments[3];
|
|
436
|
-
if (arguments.length > 2) {
|
|
437
|
-
value = arguments[2];
|
|
438
|
-
valueSpecified = true;
|
|
439
|
-
}
|
|
440
|
-
}
|
|
441
|
-
v = "" + v;
|
|
442
|
-
w = "" + w;
|
|
443
|
-
if (name !== void 0) {
|
|
444
|
-
name = "" + name;
|
|
445
|
-
}
|
|
446
|
-
var e = edgeArgsToId(this._isDirected, v, w, name);
|
|
447
|
-
if (Object.hasOwn(this._edgeLabels, e)) {
|
|
448
|
-
if (valueSpecified) {
|
|
449
|
-
this._edgeLabels[e] = value;
|
|
450
|
-
}
|
|
451
|
-
return this;
|
|
452
|
-
}
|
|
453
|
-
if (name !== void 0 && !this._isMultigraph) {
|
|
454
|
-
throw new Error("Cannot set a named edge when isMultigraph = false");
|
|
455
|
-
}
|
|
456
|
-
this.setNode(v);
|
|
457
|
-
this.setNode(w);
|
|
458
|
-
this._edgeLabels[e] = valueSpecified ? value : this._defaultEdgeLabelFn(v, w, name);
|
|
459
|
-
var edgeObj = edgeArgsToObj(this._isDirected, v, w, name);
|
|
460
|
-
v = edgeObj.v;
|
|
461
|
-
w = edgeObj.w;
|
|
462
|
-
Object.freeze(edgeObj);
|
|
463
|
-
this._edgeObjs[e] = edgeObj;
|
|
464
|
-
incrementOrInitEntry(this._preds[w], v);
|
|
465
|
-
incrementOrInitEntry(this._sucs[v], w);
|
|
466
|
-
this._in[w][e] = edgeObj;
|
|
467
|
-
this._out[v][e] = edgeObj;
|
|
468
|
-
this._edgeCount++;
|
|
469
|
-
return this;
|
|
470
|
-
}
|
|
471
|
-
/**
|
|
472
|
-
* Gets the label for the specified edge.
|
|
473
|
-
* Complexity: O(1).
|
|
474
|
-
*/
|
|
475
|
-
edge(v, w, name) {
|
|
476
|
-
var e = arguments.length === 1 ? edgeObjToId(this._isDirected, arguments[0]) : edgeArgsToId(this._isDirected, v, w, name);
|
|
477
|
-
return this._edgeLabels[e];
|
|
478
|
-
}
|
|
479
|
-
/**
|
|
480
|
-
* Gets the label for the specified edge and converts it to an object.
|
|
481
|
-
* Complexity: O(1)
|
|
482
|
-
*/
|
|
483
|
-
edgeAsObj() {
|
|
484
|
-
const edge = this.edge(...arguments);
|
|
485
|
-
if (typeof edge !== "object") {
|
|
486
|
-
return { label: edge };
|
|
487
|
-
}
|
|
488
|
-
return edge;
|
|
489
|
-
}
|
|
490
|
-
/**
|
|
491
|
-
* Detects whether the graph contains specified edge or not. No subgraphs are considered.
|
|
492
|
-
* Complexity: O(1).
|
|
493
|
-
*/
|
|
494
|
-
hasEdge(v, w, name) {
|
|
495
|
-
var e = arguments.length === 1 ? edgeObjToId(this._isDirected, arguments[0]) : edgeArgsToId(this._isDirected, v, w, name);
|
|
496
|
-
return Object.hasOwn(this._edgeLabels, e);
|
|
497
|
-
}
|
|
498
|
-
/**
|
|
499
|
-
* Removes the specified edge from the graph. No subgraphs are considered.
|
|
500
|
-
* Complexity: O(1).
|
|
501
|
-
*/
|
|
502
|
-
removeEdge(v, w, name) {
|
|
503
|
-
var e = arguments.length === 1 ? edgeObjToId(this._isDirected, arguments[0]) : edgeArgsToId(this._isDirected, v, w, name);
|
|
504
|
-
var edge = this._edgeObjs[e];
|
|
505
|
-
if (edge) {
|
|
506
|
-
v = edge.v;
|
|
507
|
-
w = edge.w;
|
|
508
|
-
delete this._edgeLabels[e];
|
|
509
|
-
delete this._edgeObjs[e];
|
|
510
|
-
decrementOrRemoveEntry(this._preds[w], v);
|
|
511
|
-
decrementOrRemoveEntry(this._sucs[v], w);
|
|
512
|
-
delete this._in[w][e];
|
|
513
|
-
delete this._out[v][e];
|
|
514
|
-
this._edgeCount--;
|
|
515
|
-
}
|
|
516
|
-
return this;
|
|
517
|
-
}
|
|
518
|
-
/**
|
|
519
|
-
* Return all edges that point to the node v. Optionally filters those edges down to just those
|
|
520
|
-
* coming from node u. Behavior is undefined for undirected graphs - use nodeEdges instead.
|
|
521
|
-
* Complexity: O(|E|).
|
|
522
|
-
*/
|
|
523
|
-
inEdges(v, u) {
|
|
524
|
-
var inV = this._in[v];
|
|
525
|
-
if (inV) {
|
|
526
|
-
var edges = Object.values(inV);
|
|
527
|
-
if (!u) {
|
|
528
|
-
return edges;
|
|
529
|
-
}
|
|
530
|
-
return edges.filter((edge) => edge.v === u);
|
|
531
|
-
}
|
|
532
|
-
}
|
|
533
|
-
/**
|
|
534
|
-
* Return all edges that are pointed at by node v. Optionally filters those edges down to just
|
|
535
|
-
* those point to w. Behavior is undefined for undirected graphs - use nodeEdges instead.
|
|
536
|
-
* Complexity: O(|E|).
|
|
537
|
-
*/
|
|
538
|
-
outEdges(v, w) {
|
|
539
|
-
var outV = this._out[v];
|
|
540
|
-
if (outV) {
|
|
541
|
-
var edges = Object.values(outV);
|
|
542
|
-
if (!w) {
|
|
543
|
-
return edges;
|
|
544
|
-
}
|
|
545
|
-
return edges.filter((edge) => edge.w === w);
|
|
546
|
-
}
|
|
547
|
-
}
|
|
548
|
-
/**
|
|
549
|
-
* Returns all edges to or from node v regardless of direction. Optionally filters those edges
|
|
550
|
-
* down to just those between nodes v and w regardless of direction.
|
|
551
|
-
* Complexity: O(|E|).
|
|
552
|
-
*/
|
|
553
|
-
nodeEdges(v, w) {
|
|
554
|
-
var inEdges = this.inEdges(v, w);
|
|
555
|
-
if (inEdges) {
|
|
556
|
-
return inEdges.concat(this.outEdges(v, w));
|
|
557
|
-
}
|
|
558
|
-
}
|
|
559
|
-
};
|
|
560
|
-
function incrementOrInitEntry(map, k) {
|
|
561
|
-
if (map[k]) {
|
|
562
|
-
map[k]++;
|
|
563
|
-
} else {
|
|
564
|
-
map[k] = 1;
|
|
565
|
-
}
|
|
566
|
-
}
|
|
567
|
-
function decrementOrRemoveEntry(map, k) {
|
|
568
|
-
if (!--map[k]) {
|
|
569
|
-
delete map[k];
|
|
570
|
-
}
|
|
571
|
-
}
|
|
572
|
-
function edgeArgsToId(isDirected, v_, w_, name) {
|
|
573
|
-
var v = "" + v_;
|
|
574
|
-
var w = "" + w_;
|
|
575
|
-
if (!isDirected && v > w) {
|
|
576
|
-
var tmp = v;
|
|
577
|
-
v = w;
|
|
578
|
-
w = tmp;
|
|
579
|
-
}
|
|
580
|
-
return v + EDGE_KEY_DELIM + w + EDGE_KEY_DELIM + (name === void 0 ? DEFAULT_EDGE_NAME : name);
|
|
581
|
-
}
|
|
582
|
-
function edgeArgsToObj(isDirected, v_, w_, name) {
|
|
583
|
-
var v = "" + v_;
|
|
584
|
-
var w = "" + w_;
|
|
585
|
-
if (!isDirected && v > w) {
|
|
586
|
-
var tmp = v;
|
|
587
|
-
v = w;
|
|
588
|
-
w = tmp;
|
|
589
|
-
}
|
|
590
|
-
var edgeObj = { v, w };
|
|
591
|
-
if (name) {
|
|
592
|
-
edgeObj.name = name;
|
|
593
|
-
}
|
|
594
|
-
return edgeObj;
|
|
595
|
-
}
|
|
596
|
-
function edgeObjToId(isDirected, edgeObj) {
|
|
597
|
-
return edgeArgsToId(isDirected, edgeObj.v, edgeObj.w, edgeObj.name);
|
|
598
|
-
}
|
|
599
|
-
module.exports = Graph;
|
|
600
|
-
}
|
|
601
|
-
});
|
|
602
|
-
|
|
603
|
-
// node_modules/@dagrejs/graphlib/lib/version.js
|
|
604
|
-
var require_version = __commonJS({
|
|
605
|
-
"node_modules/@dagrejs/graphlib/lib/version.js"(exports, module) {
|
|
606
|
-
module.exports = "2.2.4";
|
|
607
|
-
}
|
|
608
|
-
});
|
|
609
|
-
|
|
610
|
-
// node_modules/@dagrejs/graphlib/lib/index.js
|
|
611
|
-
var require_lib = __commonJS({
|
|
612
|
-
"node_modules/@dagrejs/graphlib/lib/index.js"(exports, module) {
|
|
613
|
-
module.exports = {
|
|
614
|
-
Graph: require_graph(),
|
|
615
|
-
version: require_version()
|
|
616
|
-
};
|
|
617
|
-
}
|
|
618
|
-
});
|
|
619
|
-
|
|
620
|
-
// node_modules/@dagrejs/graphlib/lib/json.js
|
|
621
|
-
var require_json = __commonJS({
|
|
622
|
-
"node_modules/@dagrejs/graphlib/lib/json.js"(exports, module) {
|
|
623
|
-
var Graph = require_graph();
|
|
624
|
-
module.exports = {
|
|
625
|
-
write,
|
|
626
|
-
read
|
|
627
|
-
};
|
|
628
|
-
function write(g) {
|
|
629
|
-
var json = {
|
|
630
|
-
options: {
|
|
631
|
-
directed: g.isDirected(),
|
|
632
|
-
multigraph: g.isMultigraph(),
|
|
633
|
-
compound: g.isCompound()
|
|
634
|
-
},
|
|
635
|
-
nodes: writeNodes(g),
|
|
636
|
-
edges: writeEdges(g)
|
|
637
|
-
};
|
|
638
|
-
if (g.graph() !== void 0) {
|
|
639
|
-
json.value = structuredClone(g.graph());
|
|
640
|
-
}
|
|
641
|
-
return json;
|
|
642
|
-
}
|
|
643
|
-
function writeNodes(g) {
|
|
644
|
-
return g.nodes().map(function(v) {
|
|
645
|
-
var nodeValue = g.node(v);
|
|
646
|
-
var parent = g.parent(v);
|
|
647
|
-
var node = { v };
|
|
648
|
-
if (nodeValue !== void 0) {
|
|
649
|
-
node.value = nodeValue;
|
|
650
|
-
}
|
|
651
|
-
if (parent !== void 0) {
|
|
652
|
-
node.parent = parent;
|
|
653
|
-
}
|
|
654
|
-
return node;
|
|
655
|
-
});
|
|
656
|
-
}
|
|
657
|
-
function writeEdges(g) {
|
|
658
|
-
return g.edges().map(function(e) {
|
|
659
|
-
var edgeValue = g.edge(e);
|
|
660
|
-
var edge = { v: e.v, w: e.w };
|
|
661
|
-
if (e.name !== void 0) {
|
|
662
|
-
edge.name = e.name;
|
|
663
|
-
}
|
|
664
|
-
if (edgeValue !== void 0) {
|
|
665
|
-
edge.value = edgeValue;
|
|
666
|
-
}
|
|
667
|
-
return edge;
|
|
668
|
-
});
|
|
669
|
-
}
|
|
670
|
-
function read(json) {
|
|
671
|
-
var g = new Graph(json.options).setGraph(json.value);
|
|
672
|
-
json.nodes.forEach(function(entry) {
|
|
673
|
-
g.setNode(entry.v, entry.value);
|
|
674
|
-
if (entry.parent) {
|
|
675
|
-
g.setParent(entry.v, entry.parent);
|
|
676
|
-
}
|
|
677
|
-
});
|
|
678
|
-
json.edges.forEach(function(entry) {
|
|
679
|
-
g.setEdge({ v: entry.v, w: entry.w, name: entry.name }, entry.value);
|
|
680
|
-
});
|
|
681
|
-
return g;
|
|
682
|
-
}
|
|
683
|
-
}
|
|
684
|
-
});
|
|
685
|
-
|
|
686
|
-
// node_modules/@dagrejs/graphlib/lib/alg/components.js
|
|
687
|
-
var require_components = __commonJS({
|
|
688
|
-
"node_modules/@dagrejs/graphlib/lib/alg/components.js"(exports, module) {
|
|
689
|
-
module.exports = components;
|
|
690
|
-
function components(g) {
|
|
691
|
-
var visited = {};
|
|
692
|
-
var cmpts = [];
|
|
693
|
-
var cmpt;
|
|
694
|
-
function dfs(v) {
|
|
695
|
-
if (Object.hasOwn(visited, v)) return;
|
|
696
|
-
visited[v] = true;
|
|
697
|
-
cmpt.push(v);
|
|
698
|
-
g.successors(v).forEach(dfs);
|
|
699
|
-
g.predecessors(v).forEach(dfs);
|
|
700
|
-
}
|
|
701
|
-
g.nodes().forEach(function(v) {
|
|
702
|
-
cmpt = [];
|
|
703
|
-
dfs(v);
|
|
704
|
-
if (cmpt.length) {
|
|
705
|
-
cmpts.push(cmpt);
|
|
706
|
-
}
|
|
707
|
-
});
|
|
708
|
-
return cmpts;
|
|
709
|
-
}
|
|
710
|
-
}
|
|
711
|
-
});
|
|
712
|
-
|
|
713
|
-
// node_modules/@dagrejs/graphlib/lib/data/priority-queue.js
|
|
714
|
-
var require_priority_queue = __commonJS({
|
|
715
|
-
"node_modules/@dagrejs/graphlib/lib/data/priority-queue.js"(exports, module) {
|
|
716
|
-
var PriorityQueue = class {
|
|
717
|
-
constructor() {
|
|
718
|
-
__publicField(this, "_arr", []);
|
|
719
|
-
__publicField(this, "_keyIndices", {});
|
|
720
|
-
}
|
|
721
|
-
/**
|
|
722
|
-
* Returns the number of elements in the queue. Takes `O(1)` time.
|
|
723
|
-
*/
|
|
724
|
-
size() {
|
|
725
|
-
return this._arr.length;
|
|
726
|
-
}
|
|
727
|
-
/**
|
|
728
|
-
* Returns the keys that are in the queue. Takes `O(n)` time.
|
|
729
|
-
*/
|
|
730
|
-
keys() {
|
|
731
|
-
return this._arr.map(function(x) {
|
|
732
|
-
return x.key;
|
|
733
|
-
});
|
|
734
|
-
}
|
|
735
|
-
/**
|
|
736
|
-
* Returns `true` if **key** is in the queue and `false` if not.
|
|
737
|
-
*/
|
|
738
|
-
has(key) {
|
|
739
|
-
return Object.hasOwn(this._keyIndices, key);
|
|
740
|
-
}
|
|
741
|
-
/**
|
|
742
|
-
* Returns the priority for **key**. If **key** is not present in the queue
|
|
743
|
-
* then this function returns `undefined`. Takes `O(1)` time.
|
|
744
|
-
*
|
|
745
|
-
* @param {Object} key
|
|
746
|
-
*/
|
|
747
|
-
priority(key) {
|
|
748
|
-
var index = this._keyIndices[key];
|
|
749
|
-
if (index !== void 0) {
|
|
750
|
-
return this._arr[index].priority;
|
|
751
|
-
}
|
|
752
|
-
}
|
|
753
|
-
/**
|
|
754
|
-
* Returns the key for the minimum element in this queue. If the queue is
|
|
755
|
-
* empty this function throws an Error. Takes `O(1)` time.
|
|
756
|
-
*/
|
|
757
|
-
min() {
|
|
758
|
-
if (this.size() === 0) {
|
|
759
|
-
throw new Error("Queue underflow");
|
|
760
|
-
}
|
|
761
|
-
return this._arr[0].key;
|
|
762
|
-
}
|
|
763
|
-
/**
|
|
764
|
-
* Inserts a new key into the priority queue. If the key already exists in
|
|
765
|
-
* the queue this function returns `false`; otherwise it will return `true`.
|
|
766
|
-
* Takes `O(n)` time.
|
|
767
|
-
*
|
|
768
|
-
* @param {Object} key the key to add
|
|
769
|
-
* @param {Number} priority the initial priority for the key
|
|
770
|
-
*/
|
|
771
|
-
add(key, priority) {
|
|
772
|
-
var keyIndices = this._keyIndices;
|
|
773
|
-
key = String(key);
|
|
774
|
-
if (!Object.hasOwn(keyIndices, key)) {
|
|
775
|
-
var arr = this._arr;
|
|
776
|
-
var index = arr.length;
|
|
777
|
-
keyIndices[key] = index;
|
|
778
|
-
arr.push({ key, priority });
|
|
779
|
-
this._decrease(index);
|
|
780
|
-
return true;
|
|
781
|
-
}
|
|
782
|
-
return false;
|
|
783
|
-
}
|
|
784
|
-
/**
|
|
785
|
-
* Removes and returns the smallest key in the queue. Takes `O(log n)` time.
|
|
786
|
-
*/
|
|
787
|
-
removeMin() {
|
|
788
|
-
this._swap(0, this._arr.length - 1);
|
|
789
|
-
var min = this._arr.pop();
|
|
790
|
-
delete this._keyIndices[min.key];
|
|
791
|
-
this._heapify(0);
|
|
792
|
-
return min.key;
|
|
793
|
-
}
|
|
794
|
-
/**
|
|
795
|
-
* Decreases the priority for **key** to **priority**. If the new priority is
|
|
796
|
-
* greater than the previous priority, this function will throw an Error.
|
|
797
|
-
*
|
|
798
|
-
* @param {Object} key the key for which to raise priority
|
|
799
|
-
* @param {Number} priority the new priority for the key
|
|
800
|
-
*/
|
|
801
|
-
decrease(key, priority) {
|
|
802
|
-
var index = this._keyIndices[key];
|
|
803
|
-
if (priority > this._arr[index].priority) {
|
|
804
|
-
throw new Error("New priority is greater than current priority. Key: " + key + " Old: " + this._arr[index].priority + " New: " + priority);
|
|
805
|
-
}
|
|
806
|
-
this._arr[index].priority = priority;
|
|
807
|
-
this._decrease(index);
|
|
808
|
-
}
|
|
809
|
-
_heapify(i) {
|
|
810
|
-
var arr = this._arr;
|
|
811
|
-
var l = 2 * i;
|
|
812
|
-
var r = l + 1;
|
|
813
|
-
var largest = i;
|
|
814
|
-
if (l < arr.length) {
|
|
815
|
-
largest = arr[l].priority < arr[largest].priority ? l : largest;
|
|
816
|
-
if (r < arr.length) {
|
|
817
|
-
largest = arr[r].priority < arr[largest].priority ? r : largest;
|
|
818
|
-
}
|
|
819
|
-
if (largest !== i) {
|
|
820
|
-
this._swap(i, largest);
|
|
821
|
-
this._heapify(largest);
|
|
822
|
-
}
|
|
823
|
-
}
|
|
824
|
-
}
|
|
825
|
-
_decrease(index) {
|
|
826
|
-
var arr = this._arr;
|
|
827
|
-
var priority = arr[index].priority;
|
|
828
|
-
var parent;
|
|
829
|
-
while (index !== 0) {
|
|
830
|
-
parent = index >> 1;
|
|
831
|
-
if (arr[parent].priority < priority) {
|
|
832
|
-
break;
|
|
833
|
-
}
|
|
834
|
-
this._swap(index, parent);
|
|
835
|
-
index = parent;
|
|
836
|
-
}
|
|
837
|
-
}
|
|
838
|
-
_swap(i, j) {
|
|
839
|
-
var arr = this._arr;
|
|
840
|
-
var keyIndices = this._keyIndices;
|
|
841
|
-
var origArrI = arr[i];
|
|
842
|
-
var origArrJ = arr[j];
|
|
843
|
-
arr[i] = origArrJ;
|
|
844
|
-
arr[j] = origArrI;
|
|
845
|
-
keyIndices[origArrJ.key] = i;
|
|
846
|
-
keyIndices[origArrI.key] = j;
|
|
847
|
-
}
|
|
848
|
-
};
|
|
849
|
-
module.exports = PriorityQueue;
|
|
850
|
-
}
|
|
851
|
-
});
|
|
852
|
-
|
|
853
|
-
// node_modules/@dagrejs/graphlib/lib/alg/dijkstra.js
|
|
854
|
-
var require_dijkstra = __commonJS({
|
|
855
|
-
"node_modules/@dagrejs/graphlib/lib/alg/dijkstra.js"(exports, module) {
|
|
856
|
-
var PriorityQueue = require_priority_queue();
|
|
857
|
-
module.exports = dijkstra;
|
|
858
|
-
var DEFAULT_WEIGHT_FUNC = () => 1;
|
|
859
|
-
function dijkstra(g, source, weightFn, edgeFn) {
|
|
860
|
-
return runDijkstra(
|
|
861
|
-
g,
|
|
862
|
-
String(source),
|
|
863
|
-
weightFn || DEFAULT_WEIGHT_FUNC,
|
|
864
|
-
edgeFn || function(v) {
|
|
865
|
-
return g.outEdges(v);
|
|
866
|
-
}
|
|
867
|
-
);
|
|
868
|
-
}
|
|
869
|
-
function runDijkstra(g, source, weightFn, edgeFn) {
|
|
870
|
-
var results = {};
|
|
871
|
-
var pq = new PriorityQueue();
|
|
872
|
-
var v, vEntry;
|
|
873
|
-
var updateNeighbors = function(edge) {
|
|
874
|
-
var w = edge.v !== v ? edge.v : edge.w;
|
|
875
|
-
var wEntry = results[w];
|
|
876
|
-
var weight = weightFn(edge);
|
|
877
|
-
var distance = vEntry.distance + weight;
|
|
878
|
-
if (weight < 0) {
|
|
879
|
-
throw new Error("dijkstra does not allow negative edge weights. Bad edge: " + edge + " Weight: " + weight);
|
|
880
|
-
}
|
|
881
|
-
if (distance < wEntry.distance) {
|
|
882
|
-
wEntry.distance = distance;
|
|
883
|
-
wEntry.predecessor = v;
|
|
884
|
-
pq.decrease(w, distance);
|
|
885
|
-
}
|
|
886
|
-
};
|
|
887
|
-
g.nodes().forEach(function(v2) {
|
|
888
|
-
var distance = v2 === source ? 0 : Number.POSITIVE_INFINITY;
|
|
889
|
-
results[v2] = { distance };
|
|
890
|
-
pq.add(v2, distance);
|
|
891
|
-
});
|
|
892
|
-
while (pq.size() > 0) {
|
|
893
|
-
v = pq.removeMin();
|
|
894
|
-
vEntry = results[v];
|
|
895
|
-
if (vEntry.distance === Number.POSITIVE_INFINITY) {
|
|
896
|
-
break;
|
|
897
|
-
}
|
|
898
|
-
edgeFn(v).forEach(updateNeighbors);
|
|
899
|
-
}
|
|
900
|
-
return results;
|
|
901
|
-
}
|
|
902
|
-
}
|
|
903
|
-
});
|
|
904
|
-
|
|
905
|
-
// node_modules/@dagrejs/graphlib/lib/alg/dijkstra-all.js
|
|
906
|
-
var require_dijkstra_all = __commonJS({
|
|
907
|
-
"node_modules/@dagrejs/graphlib/lib/alg/dijkstra-all.js"(exports, module) {
|
|
908
|
-
var dijkstra = require_dijkstra();
|
|
909
|
-
module.exports = dijkstraAll;
|
|
910
|
-
function dijkstraAll(g, weightFunc, edgeFunc) {
|
|
911
|
-
return g.nodes().reduce(function(acc, v) {
|
|
912
|
-
acc[v] = dijkstra(g, v, weightFunc, edgeFunc);
|
|
913
|
-
return acc;
|
|
914
|
-
}, {});
|
|
915
|
-
}
|
|
916
|
-
}
|
|
917
|
-
});
|
|
918
|
-
|
|
919
|
-
// node_modules/@dagrejs/graphlib/lib/alg/tarjan.js
|
|
920
|
-
var require_tarjan = __commonJS({
|
|
921
|
-
"node_modules/@dagrejs/graphlib/lib/alg/tarjan.js"(exports, module) {
|
|
922
|
-
module.exports = tarjan;
|
|
923
|
-
function tarjan(g) {
|
|
924
|
-
var index = 0;
|
|
925
|
-
var stack = [];
|
|
926
|
-
var visited = {};
|
|
927
|
-
var results = [];
|
|
928
|
-
function dfs(v) {
|
|
929
|
-
var entry = visited[v] = {
|
|
930
|
-
onStack: true,
|
|
931
|
-
lowlink: index,
|
|
932
|
-
index: index++
|
|
933
|
-
};
|
|
934
|
-
stack.push(v);
|
|
935
|
-
g.successors(v).forEach(function(w2) {
|
|
936
|
-
if (!Object.hasOwn(visited, w2)) {
|
|
937
|
-
dfs(w2);
|
|
938
|
-
entry.lowlink = Math.min(entry.lowlink, visited[w2].lowlink);
|
|
939
|
-
} else if (visited[w2].onStack) {
|
|
940
|
-
entry.lowlink = Math.min(entry.lowlink, visited[w2].index);
|
|
941
|
-
}
|
|
942
|
-
});
|
|
943
|
-
if (entry.lowlink === entry.index) {
|
|
944
|
-
var cmpt = [];
|
|
945
|
-
var w;
|
|
946
|
-
do {
|
|
947
|
-
w = stack.pop();
|
|
948
|
-
visited[w].onStack = false;
|
|
949
|
-
cmpt.push(w);
|
|
950
|
-
} while (v !== w);
|
|
951
|
-
results.push(cmpt);
|
|
952
|
-
}
|
|
953
|
-
}
|
|
954
|
-
g.nodes().forEach(function(v) {
|
|
955
|
-
if (!Object.hasOwn(visited, v)) {
|
|
956
|
-
dfs(v);
|
|
957
|
-
}
|
|
958
|
-
});
|
|
959
|
-
return results;
|
|
960
|
-
}
|
|
961
|
-
}
|
|
962
|
-
});
|
|
963
|
-
|
|
964
|
-
// node_modules/@dagrejs/graphlib/lib/alg/find-cycles.js
|
|
965
|
-
var require_find_cycles = __commonJS({
|
|
966
|
-
"node_modules/@dagrejs/graphlib/lib/alg/find-cycles.js"(exports, module) {
|
|
967
|
-
var tarjan = require_tarjan();
|
|
968
|
-
module.exports = findCycles;
|
|
969
|
-
function findCycles(g) {
|
|
970
|
-
return tarjan(g).filter(function(cmpt) {
|
|
971
|
-
return cmpt.length > 1 || cmpt.length === 1 && g.hasEdge(cmpt[0], cmpt[0]);
|
|
972
|
-
});
|
|
973
|
-
}
|
|
974
|
-
}
|
|
975
|
-
});
|
|
976
|
-
|
|
977
|
-
// node_modules/@dagrejs/graphlib/lib/alg/floyd-warshall.js
|
|
978
|
-
var require_floyd_warshall = __commonJS({
|
|
979
|
-
"node_modules/@dagrejs/graphlib/lib/alg/floyd-warshall.js"(exports, module) {
|
|
980
|
-
module.exports = floydWarshall;
|
|
981
|
-
var DEFAULT_WEIGHT_FUNC = () => 1;
|
|
982
|
-
function floydWarshall(g, weightFn, edgeFn) {
|
|
983
|
-
return runFloydWarshall(
|
|
984
|
-
g,
|
|
985
|
-
weightFn || DEFAULT_WEIGHT_FUNC,
|
|
986
|
-
edgeFn || function(v) {
|
|
987
|
-
return g.outEdges(v);
|
|
988
|
-
}
|
|
989
|
-
);
|
|
990
|
-
}
|
|
991
|
-
function runFloydWarshall(g, weightFn, edgeFn) {
|
|
992
|
-
var results = {};
|
|
993
|
-
var nodes = g.nodes();
|
|
994
|
-
nodes.forEach(function(v) {
|
|
995
|
-
results[v] = {};
|
|
996
|
-
results[v][v] = { distance: 0 };
|
|
997
|
-
nodes.forEach(function(w) {
|
|
998
|
-
if (v !== w) {
|
|
999
|
-
results[v][w] = { distance: Number.POSITIVE_INFINITY };
|
|
1000
|
-
}
|
|
1001
|
-
});
|
|
1002
|
-
edgeFn(v).forEach(function(edge) {
|
|
1003
|
-
var w = edge.v === v ? edge.w : edge.v;
|
|
1004
|
-
var d = weightFn(edge);
|
|
1005
|
-
results[v][w] = { distance: d, predecessor: v };
|
|
1006
|
-
});
|
|
1007
|
-
});
|
|
1008
|
-
nodes.forEach(function(k) {
|
|
1009
|
-
var rowK = results[k];
|
|
1010
|
-
nodes.forEach(function(i) {
|
|
1011
|
-
var rowI = results[i];
|
|
1012
|
-
nodes.forEach(function(j) {
|
|
1013
|
-
var ik = rowI[k];
|
|
1014
|
-
var kj = rowK[j];
|
|
1015
|
-
var ij = rowI[j];
|
|
1016
|
-
var altDistance = ik.distance + kj.distance;
|
|
1017
|
-
if (altDistance < ij.distance) {
|
|
1018
|
-
ij.distance = altDistance;
|
|
1019
|
-
ij.predecessor = kj.predecessor;
|
|
1020
|
-
}
|
|
1021
|
-
});
|
|
1022
|
-
});
|
|
1023
|
-
});
|
|
1024
|
-
return results;
|
|
1025
|
-
}
|
|
1026
|
-
}
|
|
1027
|
-
});
|
|
1028
|
-
|
|
1029
|
-
// node_modules/@dagrejs/graphlib/lib/alg/topsort.js
|
|
1030
|
-
var require_topsort = __commonJS({
|
|
1031
|
-
"node_modules/@dagrejs/graphlib/lib/alg/topsort.js"(exports, module) {
|
|
1032
|
-
function topsort(g) {
|
|
1033
|
-
var visited = {};
|
|
1034
|
-
var stack = {};
|
|
1035
|
-
var results = [];
|
|
1036
|
-
function visit(node) {
|
|
1037
|
-
if (Object.hasOwn(stack, node)) {
|
|
1038
|
-
throw new CycleException();
|
|
1039
|
-
}
|
|
1040
|
-
if (!Object.hasOwn(visited, node)) {
|
|
1041
|
-
stack[node] = true;
|
|
1042
|
-
visited[node] = true;
|
|
1043
|
-
g.predecessors(node).forEach(visit);
|
|
1044
|
-
delete stack[node];
|
|
1045
|
-
results.push(node);
|
|
1046
|
-
}
|
|
1047
|
-
}
|
|
1048
|
-
g.sinks().forEach(visit);
|
|
1049
|
-
if (Object.keys(visited).length !== g.nodeCount()) {
|
|
1050
|
-
throw new CycleException();
|
|
1051
|
-
}
|
|
1052
|
-
return results;
|
|
1053
|
-
}
|
|
1054
|
-
var CycleException = class extends Error {
|
|
1055
|
-
constructor() {
|
|
1056
|
-
super(...arguments);
|
|
1057
|
-
}
|
|
1058
|
-
};
|
|
1059
|
-
module.exports = topsort;
|
|
1060
|
-
topsort.CycleException = CycleException;
|
|
1061
|
-
}
|
|
1062
|
-
});
|
|
1063
|
-
|
|
1064
|
-
// node_modules/@dagrejs/graphlib/lib/alg/is-acyclic.js
|
|
1065
|
-
var require_is_acyclic = __commonJS({
|
|
1066
|
-
"node_modules/@dagrejs/graphlib/lib/alg/is-acyclic.js"(exports, module) {
|
|
1067
|
-
var topsort = require_topsort();
|
|
1068
|
-
module.exports = isAcyclic;
|
|
1069
|
-
function isAcyclic(g) {
|
|
1070
|
-
try {
|
|
1071
|
-
topsort(g);
|
|
1072
|
-
} catch (e) {
|
|
1073
|
-
if (e instanceof topsort.CycleException) {
|
|
1074
|
-
return false;
|
|
1075
|
-
}
|
|
1076
|
-
throw e;
|
|
1077
|
-
}
|
|
1078
|
-
return true;
|
|
1079
|
-
}
|
|
1080
|
-
}
|
|
1081
|
-
});
|
|
1082
|
-
|
|
1083
|
-
// node_modules/@dagrejs/graphlib/lib/alg/dfs.js
|
|
1084
|
-
var require_dfs = __commonJS({
|
|
1085
|
-
"node_modules/@dagrejs/graphlib/lib/alg/dfs.js"(exports, module) {
|
|
1086
|
-
module.exports = dfs;
|
|
1087
|
-
function dfs(g, vs, order) {
|
|
1088
|
-
if (!Array.isArray(vs)) {
|
|
1089
|
-
vs = [vs];
|
|
1090
|
-
}
|
|
1091
|
-
var navigation = g.isDirected() ? (v) => g.successors(v) : (v) => g.neighbors(v);
|
|
1092
|
-
var orderFunc = order === "post" ? postOrderDfs : preOrderDfs;
|
|
1093
|
-
var acc = [];
|
|
1094
|
-
var visited = {};
|
|
1095
|
-
vs.forEach((v) => {
|
|
1096
|
-
if (!g.hasNode(v)) {
|
|
1097
|
-
throw new Error("Graph does not have node: " + v);
|
|
1098
|
-
}
|
|
1099
|
-
orderFunc(v, navigation, visited, acc);
|
|
1100
|
-
});
|
|
1101
|
-
return acc;
|
|
1102
|
-
}
|
|
1103
|
-
function postOrderDfs(v, navigation, visited, acc) {
|
|
1104
|
-
var stack = [[v, false]];
|
|
1105
|
-
while (stack.length > 0) {
|
|
1106
|
-
var curr = stack.pop();
|
|
1107
|
-
if (curr[1]) {
|
|
1108
|
-
acc.push(curr[0]);
|
|
1109
|
-
} else {
|
|
1110
|
-
if (!Object.hasOwn(visited, curr[0])) {
|
|
1111
|
-
visited[curr[0]] = true;
|
|
1112
|
-
stack.push([curr[0], true]);
|
|
1113
|
-
forEachRight(navigation(curr[0]), (w) => stack.push([w, false]));
|
|
1114
|
-
}
|
|
1115
|
-
}
|
|
1116
|
-
}
|
|
1117
|
-
}
|
|
1118
|
-
function preOrderDfs(v, navigation, visited, acc) {
|
|
1119
|
-
var stack = [v];
|
|
1120
|
-
while (stack.length > 0) {
|
|
1121
|
-
var curr = stack.pop();
|
|
1122
|
-
if (!Object.hasOwn(visited, curr)) {
|
|
1123
|
-
visited[curr] = true;
|
|
1124
|
-
acc.push(curr);
|
|
1125
|
-
forEachRight(navigation(curr), (w) => stack.push(w));
|
|
1126
|
-
}
|
|
1127
|
-
}
|
|
1128
|
-
}
|
|
1129
|
-
function forEachRight(array, iteratee) {
|
|
1130
|
-
var length = array.length;
|
|
1131
|
-
while (length--) {
|
|
1132
|
-
iteratee(array[length], length, array);
|
|
1133
|
-
}
|
|
1134
|
-
return array;
|
|
1135
|
-
}
|
|
1136
|
-
}
|
|
1137
|
-
});
|
|
1138
|
-
|
|
1139
|
-
// node_modules/@dagrejs/graphlib/lib/alg/postorder.js
|
|
1140
|
-
var require_postorder = __commonJS({
|
|
1141
|
-
"node_modules/@dagrejs/graphlib/lib/alg/postorder.js"(exports, module) {
|
|
1142
|
-
var dfs = require_dfs();
|
|
1143
|
-
module.exports = postorder;
|
|
1144
|
-
function postorder(g, vs) {
|
|
1145
|
-
return dfs(g, vs, "post");
|
|
1146
|
-
}
|
|
1147
|
-
}
|
|
1148
|
-
});
|
|
1149
|
-
|
|
1150
|
-
// node_modules/@dagrejs/graphlib/lib/alg/preorder.js
|
|
1151
|
-
var require_preorder = __commonJS({
|
|
1152
|
-
"node_modules/@dagrejs/graphlib/lib/alg/preorder.js"(exports, module) {
|
|
1153
|
-
var dfs = require_dfs();
|
|
1154
|
-
module.exports = preorder;
|
|
1155
|
-
function preorder(g, vs) {
|
|
1156
|
-
return dfs(g, vs, "pre");
|
|
1157
|
-
}
|
|
1158
|
-
}
|
|
1159
|
-
});
|
|
1160
|
-
|
|
1161
|
-
// node_modules/@dagrejs/graphlib/lib/alg/prim.js
|
|
1162
|
-
var require_prim = __commonJS({
|
|
1163
|
-
"node_modules/@dagrejs/graphlib/lib/alg/prim.js"(exports, module) {
|
|
1164
|
-
var Graph = require_graph();
|
|
1165
|
-
var PriorityQueue = require_priority_queue();
|
|
1166
|
-
module.exports = prim;
|
|
1167
|
-
function prim(g, weightFunc) {
|
|
1168
|
-
var result = new Graph();
|
|
1169
|
-
var parents = {};
|
|
1170
|
-
var pq = new PriorityQueue();
|
|
1171
|
-
var v;
|
|
1172
|
-
function updateNeighbors(edge) {
|
|
1173
|
-
var w = edge.v === v ? edge.w : edge.v;
|
|
1174
|
-
var pri = pq.priority(w);
|
|
1175
|
-
if (pri !== void 0) {
|
|
1176
|
-
var edgeWeight = weightFunc(edge);
|
|
1177
|
-
if (edgeWeight < pri) {
|
|
1178
|
-
parents[w] = v;
|
|
1179
|
-
pq.decrease(w, edgeWeight);
|
|
1180
|
-
}
|
|
1181
|
-
}
|
|
1182
|
-
}
|
|
1183
|
-
if (g.nodeCount() === 0) {
|
|
1184
|
-
return result;
|
|
1185
|
-
}
|
|
1186
|
-
g.nodes().forEach(function(v2) {
|
|
1187
|
-
pq.add(v2, Number.POSITIVE_INFINITY);
|
|
1188
|
-
result.setNode(v2);
|
|
1189
|
-
});
|
|
1190
|
-
pq.decrease(g.nodes()[0], 0);
|
|
1191
|
-
var init = false;
|
|
1192
|
-
while (pq.size() > 0) {
|
|
1193
|
-
v = pq.removeMin();
|
|
1194
|
-
if (Object.hasOwn(parents, v)) {
|
|
1195
|
-
result.setEdge(v, parents[v]);
|
|
1196
|
-
} else if (init) {
|
|
1197
|
-
throw new Error("Input graph is not connected: " + g);
|
|
1198
|
-
} else {
|
|
1199
|
-
init = true;
|
|
1200
|
-
}
|
|
1201
|
-
g.nodeEdges(v).forEach(updateNeighbors);
|
|
1202
|
-
}
|
|
1203
|
-
return result;
|
|
1204
|
-
}
|
|
1205
|
-
}
|
|
1206
|
-
});
|
|
1207
|
-
|
|
1208
|
-
// node_modules/@dagrejs/graphlib/lib/alg/index.js
|
|
1209
|
-
var require_alg = __commonJS({
|
|
1210
|
-
"node_modules/@dagrejs/graphlib/lib/alg/index.js"(exports, module) {
|
|
1211
|
-
module.exports = {
|
|
1212
|
-
components: require_components(),
|
|
1213
|
-
dijkstra: require_dijkstra(),
|
|
1214
|
-
dijkstraAll: require_dijkstra_all(),
|
|
1215
|
-
findCycles: require_find_cycles(),
|
|
1216
|
-
floydWarshall: require_floyd_warshall(),
|
|
1217
|
-
isAcyclic: require_is_acyclic(),
|
|
1218
|
-
postorder: require_postorder(),
|
|
1219
|
-
preorder: require_preorder(),
|
|
1220
|
-
prim: require_prim(),
|
|
1221
|
-
tarjan: require_tarjan(),
|
|
1222
|
-
topsort: require_topsort()
|
|
1223
|
-
};
|
|
1224
|
-
}
|
|
1225
|
-
});
|
|
1226
|
-
|
|
1227
|
-
// node_modules/@dagrejs/graphlib/index.js
|
|
1228
|
-
var require_graphlib = __commonJS({
|
|
1229
|
-
"node_modules/@dagrejs/graphlib/index.js"(exports, module) {
|
|
1230
|
-
var lib = require_lib();
|
|
1231
|
-
module.exports = {
|
|
1232
|
-
Graph: lib.Graph,
|
|
1233
|
-
json: require_json(),
|
|
1234
|
-
alg: require_alg(),
|
|
1235
|
-
version: lib.version
|
|
1236
|
-
};
|
|
1237
|
-
}
|
|
1238
|
-
});
|
|
1239
12
|
|
|
1240
13
|
// lib/data/list.js
|
|
1241
14
|
var require_list = __commonJS({
|
|
@@ -1293,7 +66,7 @@ var dagre = (() => {
|
|
|
1293
66
|
// lib/greedy-fas.js
|
|
1294
67
|
var require_greedy_fas = __commonJS({
|
|
1295
68
|
"lib/greedy-fas.js"(exports, module) {
|
|
1296
|
-
var Graph =
|
|
69
|
+
var Graph = __require("@dagrejs/graphlib").Graph;
|
|
1297
70
|
var List = require_list();
|
|
1298
71
|
module.exports = greedyFAS;
|
|
1299
72
|
var DEFAULT_WEIGHT_FN = () => 1;
|
|
@@ -1395,7 +168,7 @@ var dagre = (() => {
|
|
|
1395
168
|
var require_util = __commonJS({
|
|
1396
169
|
"lib/util.js"(exports, module) {
|
|
1397
170
|
"use strict";
|
|
1398
|
-
var Graph =
|
|
171
|
+
var Graph = __require("@dagrejs/graphlib").Graph;
|
|
1399
172
|
module.exports = {
|
|
1400
173
|
addBorderNode,
|
|
1401
174
|
addDummyNode,
|
|
@@ -1526,7 +299,7 @@ var dagre = (() => {
|
|
|
1526
299
|
});
|
|
1527
300
|
}
|
|
1528
301
|
function removeEmptyRanks(g) {
|
|
1529
|
-
let nodeRanks = g.nodes().map((v) => g.node(v).rank);
|
|
302
|
+
let nodeRanks = g.nodes().map((v) => g.node(v).rank).filter((rank) => rank !== void 0);
|
|
1530
303
|
let offset = applyWithChunking(Math.min, nodeRanks);
|
|
1531
304
|
let layers = [];
|
|
1532
305
|
g.nodes().forEach((v) => {
|
|
@@ -1830,7 +603,7 @@ var dagre = (() => {
|
|
|
1830
603
|
var require_feasible_tree = __commonJS({
|
|
1831
604
|
"lib/rank/feasible-tree.js"(exports, module) {
|
|
1832
605
|
"use strict";
|
|
1833
|
-
var Graph =
|
|
606
|
+
var Graph = __require("@dagrejs/graphlib").Graph;
|
|
1834
607
|
var slack = require_util2().slack;
|
|
1835
608
|
module.exports = feasibleTree;
|
|
1836
609
|
function feasibleTree(g) {
|
|
@@ -1886,8 +659,8 @@ var dagre = (() => {
|
|
|
1886
659
|
var feasibleTree = require_feasible_tree();
|
|
1887
660
|
var slack = require_util2().slack;
|
|
1888
661
|
var initRank = require_util2().longestPath;
|
|
1889
|
-
var preorder =
|
|
1890
|
-
var postorder =
|
|
662
|
+
var preorder = __require("@dagrejs/graphlib").alg.preorder;
|
|
663
|
+
var postorder = __require("@dagrejs/graphlib").alg.postorder;
|
|
1891
664
|
var simplify = require_util().simplify;
|
|
1892
665
|
module.exports = networkSimplex;
|
|
1893
666
|
networkSimplex.initLowLimValues = initLowLimValues;
|
|
@@ -2617,7 +1390,7 @@ var dagre = (() => {
|
|
|
2617
1390
|
// lib/order/build-layer-graph.js
|
|
2618
1391
|
var require_build_layer_graph = __commonJS({
|
|
2619
1392
|
"lib/order/build-layer-graph.js"(exports, module) {
|
|
2620
|
-
var Graph =
|
|
1393
|
+
var Graph = __require("@dagrejs/graphlib").Graph;
|
|
2621
1394
|
var util = require_util();
|
|
2622
1395
|
module.exports = buildLayerGraph;
|
|
2623
1396
|
function buildLayerGraph(g, rank, relationship, nodesWithRank) {
|
|
@@ -2689,29 +1462,32 @@ var dagre = (() => {
|
|
|
2689
1462
|
var sortSubgraph = require_sort_subgraph();
|
|
2690
1463
|
var buildLayerGraph = require_build_layer_graph();
|
|
2691
1464
|
var addSubgraphConstraints = require_add_subgraph_constraints();
|
|
2692
|
-
var Graph =
|
|
1465
|
+
var Graph = __require("@dagrejs/graphlib").Graph;
|
|
2693
1466
|
var util = require_util();
|
|
2694
1467
|
module.exports = order;
|
|
2695
|
-
function order(g, opts) {
|
|
2696
|
-
if (
|
|
1468
|
+
function order(g, opts = {}) {
|
|
1469
|
+
if (typeof opts.customOrder === "function") {
|
|
2697
1470
|
opts.customOrder(g, order);
|
|
2698
1471
|
return;
|
|
2699
1472
|
}
|
|
2700
1473
|
let maxRank = util.maxRank(g), downLayerGraphs = buildLayerGraphs(g, util.range(1, maxRank + 1), "inEdges"), upLayerGraphs = buildLayerGraphs(g, util.range(maxRank - 1, -1, -1), "outEdges");
|
|
2701
1474
|
let layering = initOrder(g);
|
|
2702
1475
|
assignOrder(g, layering);
|
|
2703
|
-
if (opts
|
|
1476
|
+
if (opts.disableOptimalOrderHeuristic) {
|
|
2704
1477
|
return;
|
|
2705
1478
|
}
|
|
2706
1479
|
let bestCC = Number.POSITIVE_INFINITY, best;
|
|
1480
|
+
const constraints = opts.constraints || [];
|
|
2707
1481
|
for (let i = 0, lastBest = 0; lastBest < 4; ++i, ++lastBest) {
|
|
2708
|
-
sweepLayerGraphs(i % 2 ? downLayerGraphs : upLayerGraphs, i % 4 >= 2);
|
|
1482
|
+
sweepLayerGraphs(i % 2 ? downLayerGraphs : upLayerGraphs, i % 4 >= 2, constraints);
|
|
2709
1483
|
layering = util.buildLayerMatrix(g);
|
|
2710
1484
|
let cc = crossCount(g, layering);
|
|
2711
1485
|
if (cc < bestCC) {
|
|
2712
1486
|
lastBest = 0;
|
|
2713
1487
|
best = Object.assign({}, layering);
|
|
2714
1488
|
bestCC = cc;
|
|
1489
|
+
} else if (cc === bestCC) {
|
|
1490
|
+
best = structuredClone(layering);
|
|
2715
1491
|
}
|
|
2716
1492
|
}
|
|
2717
1493
|
assignOrder(g, best);
|
|
@@ -2741,9 +1517,10 @@ var dagre = (() => {
|
|
|
2741
1517
|
return buildLayerGraph(g, rank, relationship, nodesByRank.get(rank) || []);
|
|
2742
1518
|
});
|
|
2743
1519
|
}
|
|
2744
|
-
function sweepLayerGraphs(layerGraphs, biasRight) {
|
|
1520
|
+
function sweepLayerGraphs(layerGraphs, biasRight, constraints) {
|
|
2745
1521
|
let cg = new Graph();
|
|
2746
1522
|
layerGraphs.forEach(function(lg) {
|
|
1523
|
+
constraints.forEach((con) => cg.setEdge(con.left, con.right));
|
|
2747
1524
|
let root = lg.graph().root;
|
|
2748
1525
|
let sorted = sortSubgraph(lg, root, cg, biasRight);
|
|
2749
1526
|
sorted.vs.forEach((v, i) => lg.node(v).order = i);
|
|
@@ -2760,7 +1537,7 @@ var dagre = (() => {
|
|
|
2760
1537
|
var require_bk = __commonJS({
|
|
2761
1538
|
"lib/position/bk.js"(exports, module) {
|
|
2762
1539
|
"use strict";
|
|
2763
|
-
var Graph =
|
|
1540
|
+
var Graph = __require("@dagrejs/graphlib").Graph;
|
|
2764
1541
|
var util = require_util();
|
|
2765
1542
|
module.exports = {
|
|
2766
1543
|
positionX,
|
|
@@ -2890,16 +1667,18 @@ var dagre = (() => {
|
|
|
2890
1667
|
function horizontalCompaction(g, layering, root, align, reverseSep) {
|
|
2891
1668
|
let xs = {}, blockG = buildBlockGraph(g, layering, root, reverseSep), borderType = reverseSep ? "borderLeft" : "borderRight";
|
|
2892
1669
|
function iterate(setXsFunc, nextNodesFunc) {
|
|
2893
|
-
|
|
1670
|
+
const stack = blockG.nodes().slice();
|
|
1671
|
+
const visited = {};
|
|
2894
1672
|
let elem = stack.pop();
|
|
2895
|
-
let visited = {};
|
|
2896
1673
|
while (elem) {
|
|
2897
1674
|
if (visited[elem]) {
|
|
2898
1675
|
setXsFunc(elem);
|
|
2899
1676
|
} else {
|
|
2900
1677
|
visited[elem] = true;
|
|
2901
1678
|
stack.push(elem);
|
|
2902
|
-
|
|
1679
|
+
for (const nextElem of nextNodesFunc(elem)) {
|
|
1680
|
+
stack.push(nextElem);
|
|
1681
|
+
}
|
|
2903
1682
|
}
|
|
2904
1683
|
elem = stack.pop();
|
|
2905
1684
|
}
|
|
@@ -3112,14 +1891,15 @@ var dagre = (() => {
|
|
|
3112
1891
|
var order = require_order();
|
|
3113
1892
|
var position = require_position();
|
|
3114
1893
|
var util = require_util();
|
|
3115
|
-
var Graph =
|
|
1894
|
+
var Graph = __require("@dagrejs/graphlib").Graph;
|
|
3116
1895
|
module.exports = layout;
|
|
3117
|
-
function layout(g, opts) {
|
|
3118
|
-
|
|
3119
|
-
time("layout", () => {
|
|
1896
|
+
function layout(g, opts = {}) {
|
|
1897
|
+
const time = opts.debugTiming ? util.time : util.notime;
|
|
1898
|
+
return time("layout", () => {
|
|
3120
1899
|
let layoutGraph = time(" buildLayoutGraph", () => buildLayoutGraph(g));
|
|
3121
1900
|
time(" runLayout", () => runLayout(layoutGraph, time, opts));
|
|
3122
1901
|
time(" updateInputGraph", () => updateInputGraph(g, layoutGraph));
|
|
1902
|
+
return layoutGraph;
|
|
3123
1903
|
});
|
|
3124
1904
|
}
|
|
3125
1905
|
function runLayout(g, time, opts) {
|
|
@@ -3158,6 +1938,7 @@ var dagre = (() => {
|
|
|
3158
1938
|
if (inputLabel) {
|
|
3159
1939
|
inputLabel.x = layoutLabel.x;
|
|
3160
1940
|
inputLabel.y = layoutLabel.y;
|
|
1941
|
+
inputLabel.order = layoutLabel.order;
|
|
3161
1942
|
inputLabel.rank = layoutLabel.rank;
|
|
3162
1943
|
if (layoutGraph.children(v).length) {
|
|
3163
1944
|
inputLabel.width = layoutLabel.width;
|
|
@@ -3460,7 +2241,7 @@ var dagre = (() => {
|
|
|
3460
2241
|
var require_debug = __commonJS({
|
|
3461
2242
|
"lib/debug.js"(exports, module) {
|
|
3462
2243
|
var util = require_util();
|
|
3463
|
-
var Graph =
|
|
2244
|
+
var Graph = __require("@dagrejs/graphlib").Graph;
|
|
3464
2245
|
module.exports = {
|
|
3465
2246
|
debugOrdering
|
|
3466
2247
|
};
|
|
@@ -3486,9 +2267,9 @@ var dagre = (() => {
|
|
|
3486
2267
|
});
|
|
3487
2268
|
|
|
3488
2269
|
// lib/version.js
|
|
3489
|
-
var
|
|
2270
|
+
var require_version = __commonJS({
|
|
3490
2271
|
"lib/version.js"(exports, module) {
|
|
3491
|
-
module.exports = "2.0.
|
|
2272
|
+
module.exports = "2.0.1";
|
|
3492
2273
|
}
|
|
3493
2274
|
});
|
|
3494
2275
|
|
|
@@ -3496,14 +2277,14 @@ var dagre = (() => {
|
|
|
3496
2277
|
var require_index = __commonJS({
|
|
3497
2278
|
"index.js"(exports, module) {
|
|
3498
2279
|
module.exports = {
|
|
3499
|
-
graphlib:
|
|
2280
|
+
graphlib: __require("@dagrejs/graphlib"),
|
|
3500
2281
|
layout: require_layout(),
|
|
3501
2282
|
debug: require_debug(),
|
|
3502
2283
|
util: {
|
|
3503
2284
|
time: require_util().time,
|
|
3504
2285
|
notime: require_util().notime
|
|
3505
2286
|
},
|
|
3506
|
-
version:
|
|
2287
|
+
version: require_version()
|
|
3507
2288
|
};
|
|
3508
2289
|
}
|
|
3509
2290
|
});
|