@dagrejs/dagre 1.1.0 → 1.1.2

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.
Files changed (59) hide show
  1. package/dist/dagre.js +161 -150
  2. package/dist/dagre.min.js +60 -60
  3. package/lib/acyclic.js +18 -10
  4. package/lib/add-border-segments.js +11 -19
  5. package/lib/coordinate-system.js +15 -5
  6. package/lib/data/list.js +7 -8
  7. package/lib/debug.js +14 -25
  8. package/lib/greedy-fas.js +30 -35
  9. package/lib/layout.js +102 -105
  10. package/lib/nesting-graph.js +21 -18
  11. package/lib/normalize.js +18 -22
  12. package/lib/order/add-subgraph-constraints.js +2 -6
  13. package/lib/order/barycenter.js +6 -14
  14. package/lib/order/build-layer-graph.js +13 -19
  15. package/lib/order/cross-count.js +10 -13
  16. package/lib/order/index.js +23 -23
  17. package/lib/order/init-order.js +7 -8
  18. package/lib/order/resolve-conflicts.js +19 -9
  19. package/lib/order/sort-subgraph.js +22 -16
  20. package/lib/order/sort.js +12 -13
  21. package/lib/parent-dummy-chains.js +19 -17
  22. package/lib/position/bk.js +84 -40
  23. package/lib/position/index.js +9 -10
  24. package/lib/rank/feasible-tree.js +17 -14
  25. package/lib/rank/index.js +15 -25
  26. package/lib/rank/network-simplex.js +39 -18
  27. package/lib/rank/util.js +12 -6
  28. package/lib/util.js +57 -42
  29. package/lib/version.js +1 -8
  30. package/package.json +3 -15
  31. package/lib/index.js +0 -38
  32. package/mjs-lib/acyclic.js +0 -62
  33. package/mjs-lib/add-border-segments.js +0 -35
  34. package/mjs-lib/coordinate-system.js +0 -65
  35. package/mjs-lib/data/list.js +0 -56
  36. package/mjs-lib/debug.js +0 -30
  37. package/mjs-lib/greedy-fas.js +0 -125
  38. package/mjs-lib/index.js +0 -9
  39. package/mjs-lib/layout.js +0 -405
  40. package/mjs-lib/nesting-graph.js +0 -120
  41. package/mjs-lib/normalize.js +0 -84
  42. package/mjs-lib/order/add-subgraph-constraints.js +0 -49
  43. package/mjs-lib/order/barycenter.js +0 -24
  44. package/mjs-lib/order/build-layer-graph.js +0 -71
  45. package/mjs-lib/order/cross-count.js +0 -64
  46. package/mjs-lib/order/index.js +0 -70
  47. package/mjs-lib/order/init-order.js +0 -34
  48. package/mjs-lib/order/resolve-conflicts.js +0 -116
  49. package/mjs-lib/order/sort-subgraph.js +0 -71
  50. package/mjs-lib/order/sort.js +0 -54
  51. package/mjs-lib/parent-dummy-chains.js +0 -82
  52. package/mjs-lib/position/bk.js +0 -409
  53. package/mjs-lib/position/index.js +0 -30
  54. package/mjs-lib/rank/feasible-tree.js +0 -93
  55. package/mjs-lib/rank/index.js +0 -46
  56. package/mjs-lib/rank/network-simplex.js +0 -233
  57. package/mjs-lib/rank/util.js +0 -58
  58. package/mjs-lib/util.js +0 -305
  59. package/mjs-lib/version.js +0 -1
package/dist/dagre.js CHANGED
@@ -1309,7 +1309,12 @@ module.exports = order;
1309
1309
  * 1. Graph nodes will have an "order" attribute based on the results of the
1310
1310
  * algorithm.
1311
1311
  */
1312
- function order(g) {
1312
+ function order(g, opts) {
1313
+ if (opts && typeof opts.customOrder === 'function') {
1314
+ opts.customOrder(g, order);
1315
+ return;
1316
+ }
1317
+
1313
1318
  let maxRank = util.maxRank(g),
1314
1319
  downLayerGraphs = buildLayerGraphs(g, util.range(1, maxRank + 1), "inEdges"),
1315
1320
  upLayerGraphs = buildLayerGraphs(g, util.range(maxRank - 1, -1, -1), "outEdges");
@@ -1317,6 +1322,10 @@ function order(g) {
1317
1322
  let layering = initOrder(g);
1318
1323
  assignOrder(g, layering);
1319
1324
 
1325
+ if (opts && opts.disableOptimalOrderHeuristic) {
1326
+ return;
1327
+ }
1328
+
1320
1329
  let bestCC = Number.POSITIVE_INFINITY,
1321
1330
  best;
1322
1331
 
@@ -1810,7 +1819,8 @@ function findType1Conflicts(g, layering) {
1810
1819
  return layer;
1811
1820
  }
1812
1821
 
1813
- layering.reduce(visitLayer);
1822
+ layering.length && layering.reduce(visitLayer);
1823
+
1814
1824
  return conflicts;
1815
1825
  }
1816
1826
 
@@ -1855,7 +1865,8 @@ function findType2Conflicts(g, layering) {
1855
1865
  return south;
1856
1866
  }
1857
1867
 
1858
- layering.reduce(visitLayer);
1868
+ layering.length && layering.reduce(visitLayer);
1869
+
1859
1870
  return conflicts;
1860
1871
  }
1861
1872
 
@@ -2948,7 +2959,7 @@ function zipObject(props, values) {
2948
2959
  }
2949
2960
 
2950
2961
  },{"@dagrejs/graphlib":29}],28:[function(require,module,exports){
2951
- module.exports = "1.0.4";
2962
+ module.exports = "1.1.2";
2952
2963
 
2953
2964
  },{}],29:[function(require,module,exports){
2954
2965
  /**
@@ -3411,28 +3422,28 @@ topsort.CycleException = CycleException;
3411
3422
  * have its priority decreased in O(log n) time.
3412
3423
  */
3413
3424
  class PriorityQueue {
3414
- #arr = [];
3415
- #keyIndices = {};
3425
+ _arr = [];
3426
+ _keyIndices = {};
3416
3427
 
3417
3428
  /**
3418
3429
  * Returns the number of elements in the queue. Takes `O(1)` time.
3419
3430
  */
3420
3431
  size() {
3421
- return this.#arr.length;
3432
+ return this._arr.length;
3422
3433
  }
3423
3434
 
3424
3435
  /**
3425
3436
  * Returns the keys that are in the queue. Takes `O(n)` time.
3426
3437
  */
3427
3438
  keys() {
3428
- return this.#arr.map(function(x) { return x.key; });
3439
+ return this._arr.map(function(x) { return x.key; });
3429
3440
  }
3430
3441
 
3431
3442
  /**
3432
3443
  * Returns `true` if **key** is in the queue and `false` if not.
3433
3444
  */
3434
3445
  has(key) {
3435
- return this.#keyIndices.hasOwnProperty(key);
3446
+ return this._keyIndices.hasOwnProperty(key);
3436
3447
  }
3437
3448
 
3438
3449
  /**
@@ -3442,9 +3453,9 @@ class PriorityQueue {
3442
3453
  * @param {Object} key
3443
3454
  */
3444
3455
  priority(key) {
3445
- var index = this.#keyIndices[key];
3456
+ var index = this._keyIndices[key];
3446
3457
  if (index !== undefined) {
3447
- return this.#arr[index].priority;
3458
+ return this._arr[index].priority;
3448
3459
  }
3449
3460
  }
3450
3461
 
@@ -3456,7 +3467,7 @@ class PriorityQueue {
3456
3467
  if (this.size() === 0) {
3457
3468
  throw new Error("Queue underflow");
3458
3469
  }
3459
- return this.#arr[0].key;
3470
+ return this._arr[0].key;
3460
3471
  }
3461
3472
 
3462
3473
  /**
@@ -3468,14 +3479,14 @@ class PriorityQueue {
3468
3479
  * @param {Number} priority the initial priority for the key
3469
3480
  */
3470
3481
  add(key, priority) {
3471
- var keyIndices = this.#keyIndices;
3482
+ var keyIndices = this._keyIndices;
3472
3483
  key = String(key);
3473
3484
  if (!keyIndices.hasOwnProperty(key)) {
3474
- var arr = this.#arr;
3485
+ var arr = this._arr;
3475
3486
  var index = arr.length;
3476
3487
  keyIndices[key] = index;
3477
3488
  arr.push({key: key, priority: priority});
3478
- this.#decrease(index);
3489
+ this._decrease(index);
3479
3490
  return true;
3480
3491
  }
3481
3492
  return false;
@@ -3485,10 +3496,10 @@ class PriorityQueue {
3485
3496
  * Removes and returns the smallest key in the queue. Takes `O(log n)` time.
3486
3497
  */
3487
3498
  removeMin() {
3488
- this.#swap(0, this.#arr.length - 1);
3489
- var min = this.#arr.pop();
3490
- delete this.#keyIndices[min.key];
3491
- this.#heapify(0);
3499
+ this._swap(0, this._arr.length - 1);
3500
+ var min = this._arr.pop();
3501
+ delete this._keyIndices[min.key];
3502
+ this._heapify(0);
3492
3503
  return min.key;
3493
3504
  }
3494
3505
 
@@ -3500,17 +3511,17 @@ class PriorityQueue {
3500
3511
  * @param {Number} priority the new priority for the key
3501
3512
  */
3502
3513
  decrease(key, priority) {
3503
- var index = this.#keyIndices[key];
3504
- if (priority > this.#arr[index].priority) {
3514
+ var index = this._keyIndices[key];
3515
+ if (priority > this._arr[index].priority) {
3505
3516
  throw new Error("New priority is greater than current priority. " +
3506
- "Key: " + key + " Old: " + this.#arr[index].priority + " New: " + priority);
3517
+ "Key: " + key + " Old: " + this._arr[index].priority + " New: " + priority);
3507
3518
  }
3508
- this.#arr[index].priority = priority;
3509
- this.#decrease(index);
3519
+ this._arr[index].priority = priority;
3520
+ this._decrease(index);
3510
3521
  }
3511
3522
 
3512
- #heapify(i) {
3513
- var arr = this.#arr;
3523
+ _heapify(i) {
3524
+ var arr = this._arr;
3514
3525
  var l = 2 * i;
3515
3526
  var r = l + 1;
3516
3527
  var largest = i;
@@ -3520,14 +3531,14 @@ class PriorityQueue {
3520
3531
  largest = arr[r].priority < arr[largest].priority ? r : largest;
3521
3532
  }
3522
3533
  if (largest !== i) {
3523
- this.#swap(i, largest);
3524
- this.#heapify(largest);
3534
+ this._swap(i, largest);
3535
+ this._heapify(largest);
3525
3536
  }
3526
3537
  }
3527
3538
  }
3528
3539
 
3529
- #decrease(index) {
3530
- var arr = this.#arr;
3540
+ _decrease(index) {
3541
+ var arr = this._arr;
3531
3542
  var priority = arr[index].priority;
3532
3543
  var parent;
3533
3544
  while (index !== 0) {
@@ -3535,14 +3546,14 @@ class PriorityQueue {
3535
3546
  if (arr[parent].priority < priority) {
3536
3547
  break;
3537
3548
  }
3538
- this.#swap(index, parent);
3549
+ this._swap(index, parent);
3539
3550
  index = parent;
3540
3551
  }
3541
3552
  }
3542
3553
 
3543
- #swap(i, j) {
3544
- var arr = this.#arr;
3545
- var keyIndices = this.#keyIndices;
3554
+ _swap(i, j) {
3555
+ var arr = this._arr;
3556
+ var keyIndices = this._keyIndices;
3546
3557
  var origArrI = arr[i];
3547
3558
  var origArrJ = arr[j];
3548
3559
  arr[i] = origArrJ;
@@ -3572,64 +3583,64 @@ var EDGE_KEY_DELIM = "\x01";
3572
3583
  // we're going to get to a performant hashtable in JavaScript.
3573
3584
 
3574
3585
  class Graph {
3575
- #isDirected = true;
3576
- #isMultigraph = false;
3577
- #isCompound = false;
3586
+ _isDirected = true;
3587
+ _isMultigraph = false;
3588
+ _isCompound = false;
3578
3589
 
3579
3590
  // Label for the graph itself
3580
- #label;
3591
+ _label;
3581
3592
 
3582
3593
  // Defaults to be set when creating a new node
3583
- #defaultNodeLabelFn = () => undefined;
3594
+ _defaultNodeLabelFn = () => undefined;
3584
3595
 
3585
3596
  // Defaults to be set when creating a new edge
3586
- #defaultEdgeLabelFn = () => undefined;
3597
+ _defaultEdgeLabelFn = () => undefined;
3587
3598
 
3588
3599
  // v -> label
3589
- #nodes = {};
3600
+ _nodes = {};
3590
3601
 
3591
3602
  // v -> edgeObj
3592
- #in = {};
3603
+ _in = {};
3593
3604
 
3594
3605
  // u -> v -> Number
3595
- #preds = {};
3606
+ _preds = {};
3596
3607
 
3597
3608
  // v -> edgeObj
3598
- #out = {};
3609
+ _out = {};
3599
3610
 
3600
3611
  // v -> w -> Number
3601
- #sucs = {};
3612
+ _sucs = {};
3602
3613
 
3603
3614
  // e -> edgeObj
3604
- #edgeObjs = {};
3615
+ _edgeObjs = {};
3605
3616
 
3606
3617
  // e -> label
3607
- #edgeLabels = {};
3618
+ _edgeLabels = {};
3608
3619
 
3609
3620
  /* Number of nodes in the graph. Should only be changed by the implementation. */
3610
- #nodeCount = 0;
3621
+ _nodeCount = 0;
3611
3622
 
3612
3623
  /* Number of edges in the graph. Should only be changed by the implementation. */
3613
- #edgeCount = 0;
3624
+ _edgeCount = 0;
3614
3625
 
3615
- #parent;
3626
+ _parent;
3616
3627
 
3617
- #children;
3628
+ _children;
3618
3629
 
3619
3630
  constructor(opts) {
3620
3631
  if (opts) {
3621
- this.#isDirected = opts.hasOwnProperty("directed") ? opts.directed : true;
3622
- this.#isMultigraph = opts.hasOwnProperty("multigraph") ? opts.multigraph : false;
3623
- this.#isCompound = opts.hasOwnProperty("compound") ? opts.compound : false;
3632
+ this._isDirected = opts.hasOwnProperty("directed") ? opts.directed : true;
3633
+ this._isMultigraph = opts.hasOwnProperty("multigraph") ? opts.multigraph : false;
3634
+ this._isCompound = opts.hasOwnProperty("compound") ? opts.compound : false;
3624
3635
  }
3625
3636
 
3626
- if (this.#isCompound) {
3637
+ if (this._isCompound) {
3627
3638
  // v -> parent
3628
- this.#parent = {};
3639
+ this._parent = {};
3629
3640
 
3630
3641
  // v -> children
3631
- this.#children = {};
3632
- this.#children[GRAPH_NODE] = {};
3642
+ this._children = {};
3643
+ this._children[GRAPH_NODE] = {};
3633
3644
  }
3634
3645
  }
3635
3646
 
@@ -3639,28 +3650,28 @@ class Graph {
3639
3650
  * Whether graph was created with 'directed' flag set to true or not.
3640
3651
  */
3641
3652
  isDirected() {
3642
- return this.#isDirected;
3653
+ return this._isDirected;
3643
3654
  }
3644
3655
 
3645
3656
  /**
3646
3657
  * Whether graph was created with 'multigraph' flag set to true or not.
3647
3658
  */
3648
3659
  isMultigraph() {
3649
- return this.#isMultigraph;
3660
+ return this._isMultigraph;
3650
3661
  }
3651
3662
 
3652
3663
  /**
3653
3664
  * Whether graph was created with 'compound' flag set to true or not.
3654
3665
  */
3655
3666
  isCompound() {
3656
- return this.#isCompound;
3667
+ return this._isCompound;
3657
3668
  }
3658
3669
 
3659
3670
  /**
3660
3671
  * Sets the label of the graph.
3661
3672
  */
3662
3673
  setGraph(label) {
3663
- this.#label = label;
3674
+ this._label = label;
3664
3675
  return this;
3665
3676
  }
3666
3677
 
@@ -3668,7 +3679,7 @@ class Graph {
3668
3679
  * Gets the graph label.
3669
3680
  */
3670
3681
  graph() {
3671
- return this.#label;
3682
+ return this._label;
3672
3683
  }
3673
3684
 
3674
3685
 
@@ -3682,9 +3693,9 @@ class Graph {
3682
3693
  * Complexity: O(1).
3683
3694
  */
3684
3695
  setDefaultNodeLabel(newDefault) {
3685
- this.#defaultNodeLabelFn = newDefault;
3696
+ this._defaultNodeLabelFn = newDefault;
3686
3697
  if (typeof newDefault !== 'function') {
3687
- this.#defaultNodeLabelFn = () => newDefault;
3698
+ this._defaultNodeLabelFn = () => newDefault;
3688
3699
  }
3689
3700
 
3690
3701
  return this;
@@ -3695,7 +3706,7 @@ class Graph {
3695
3706
  * Complexity: O(1).
3696
3707
  */
3697
3708
  nodeCount() {
3698
- return this.#nodeCount;
3709
+ return this._nodeCount;
3699
3710
  }
3700
3711
 
3701
3712
  /**
@@ -3704,7 +3715,7 @@ class Graph {
3704
3715
  * Complexity: O(1).
3705
3716
  */
3706
3717
  nodes() {
3707
- return Object.keys(this.#nodes);
3718
+ return Object.keys(this._nodes);
3708
3719
  }
3709
3720
 
3710
3721
  /**
@@ -3713,7 +3724,7 @@ class Graph {
3713
3724
  */
3714
3725
  sources() {
3715
3726
  var self = this;
3716
- return this.nodes().filter(v => Object.keys(self.#in[v]).length === 0);
3727
+ return this.nodes().filter(v => Object.keys(self._in[v]).length === 0);
3717
3728
  }
3718
3729
 
3719
3730
  /**
@@ -3722,7 +3733,7 @@ class Graph {
3722
3733
  */
3723
3734
  sinks() {
3724
3735
  var self = this;
3725
- return this.nodes().filter(v => Object.keys(self.#out[v]).length === 0);
3736
+ return this.nodes().filter(v => Object.keys(self._out[v]).length === 0);
3726
3737
  }
3727
3738
 
3728
3739
  /**
@@ -3749,24 +3760,24 @@ class Graph {
3749
3760
  * Complexity: O(1).
3750
3761
  */
3751
3762
  setNode(v, value) {
3752
- if (this.#nodes.hasOwnProperty(v)) {
3763
+ if (this._nodes.hasOwnProperty(v)) {
3753
3764
  if (arguments.length > 1) {
3754
- this.#nodes[v] = value;
3765
+ this._nodes[v] = value;
3755
3766
  }
3756
3767
  return this;
3757
3768
  }
3758
3769
 
3759
- this.#nodes[v] = arguments.length > 1 ? value : this.#defaultNodeLabelFn(v);
3760
- if (this.#isCompound) {
3761
- this.#parent[v] = GRAPH_NODE;
3762
- this.#children[v] = {};
3763
- this.#children[GRAPH_NODE][v] = true;
3770
+ this._nodes[v] = arguments.length > 1 ? value : this._defaultNodeLabelFn(v);
3771
+ if (this._isCompound) {
3772
+ this._parent[v] = GRAPH_NODE;
3773
+ this._children[v] = {};
3774
+ this._children[GRAPH_NODE][v] = true;
3764
3775
  }
3765
- this.#in[v] = {};
3766
- this.#preds[v] = {};
3767
- this.#out[v] = {};
3768
- this.#sucs[v] = {};
3769
- ++this.#nodeCount;
3776
+ this._in[v] = {};
3777
+ this._preds[v] = {};
3778
+ this._out[v] = {};
3779
+ this._sucs[v] = {};
3780
+ ++this._nodeCount;
3770
3781
  return this;
3771
3782
  }
3772
3783
 
@@ -3775,14 +3786,14 @@ class Graph {
3775
3786
  * Complexity: O(|V|).
3776
3787
  */
3777
3788
  node(v) {
3778
- return this.#nodes[v];
3789
+ return this._nodes[v];
3779
3790
  }
3780
3791
 
3781
3792
  /**
3782
3793
  * Detects whether graph has a node with specified name or not.
3783
3794
  */
3784
3795
  hasNode(v) {
3785
- return this.#nodes.hasOwnProperty(v);
3796
+ return this._nodes.hasOwnProperty(v);
3786
3797
  }
3787
3798
 
3788
3799
  /**
@@ -3793,24 +3804,24 @@ class Graph {
3793
3804
  */
3794
3805
  removeNode(v) {
3795
3806
  var self = this;
3796
- if (this.#nodes.hasOwnProperty(v)) {
3797
- var removeEdge = e => self.removeEdge(self.#edgeObjs[e]);
3798
- delete this.#nodes[v];
3799
- if (this.#isCompound) {
3800
- this.#removeFromParentsChildList(v);
3801
- delete this.#parent[v];
3807
+ if (this._nodes.hasOwnProperty(v)) {
3808
+ var removeEdge = e => self.removeEdge(self._edgeObjs[e]);
3809
+ delete this._nodes[v];
3810
+ if (this._isCompound) {
3811
+ this._removeFromParentsChildList(v);
3812
+ delete this._parent[v];
3802
3813
  this.children(v).forEach(function(child) {
3803
3814
  self.setParent(child);
3804
3815
  });
3805
- delete this.#children[v];
3816
+ delete this._children[v];
3806
3817
  }
3807
- Object.keys(this.#in[v]).forEach(removeEdge);
3808
- delete this.#in[v];
3809
- delete this.#preds[v];
3810
- Object.keys(this.#out[v]).forEach(removeEdge);
3811
- delete this.#out[v];
3812
- delete this.#sucs[v];
3813
- --this.#nodeCount;
3818
+ Object.keys(this._in[v]).forEach(removeEdge);
3819
+ delete this._in[v];
3820
+ delete this._preds[v];
3821
+ Object.keys(this._out[v]).forEach(removeEdge);
3822
+ delete this._out[v];
3823
+ delete this._sucs[v];
3824
+ --this._nodeCount;
3814
3825
  }
3815
3826
  return this;
3816
3827
  }
@@ -3822,7 +3833,7 @@ class Graph {
3822
3833
  * Average-case complexity: O(1).
3823
3834
  */
3824
3835
  setParent(v, parent) {
3825
- if (!this.#isCompound) {
3836
+ if (!this._isCompound) {
3826
3837
  throw new Error("Cannot set parent in a non-compound graph");
3827
3838
  }
3828
3839
 
@@ -3842,14 +3853,14 @@ class Graph {
3842
3853
  }
3843
3854
 
3844
3855
  this.setNode(v);
3845
- this.#removeFromParentsChildList(v);
3846
- this.#parent[v] = parent;
3847
- this.#children[parent][v] = true;
3856
+ this._removeFromParentsChildList(v);
3857
+ this._parent[v] = parent;
3858
+ this._children[parent][v] = true;
3848
3859
  return this;
3849
3860
  }
3850
3861
 
3851
- #removeFromParentsChildList(v) {
3852
- delete this.#children[this.#parent[v]][v];
3862
+ _removeFromParentsChildList(v) {
3863
+ delete this._children[this._parent[v]][v];
3853
3864
  }
3854
3865
 
3855
3866
  /**
@@ -3857,8 +3868,8 @@ class Graph {
3857
3868
  * Complexity: O(1).
3858
3869
  */
3859
3870
  parent(v) {
3860
- if (this.#isCompound) {
3861
- var parent = this.#parent[v];
3871
+ if (this._isCompound) {
3872
+ var parent = this._parent[v];
3862
3873
  if (parent !== GRAPH_NODE) {
3863
3874
  return parent;
3864
3875
  }
@@ -3870,8 +3881,8 @@ class Graph {
3870
3881
  * Complexity: O(1).
3871
3882
  */
3872
3883
  children(v = GRAPH_NODE) {
3873
- if (this.#isCompound) {
3874
- var children = this.#children[v];
3884
+ if (this._isCompound) {
3885
+ var children = this._children[v];
3875
3886
  if (children) {
3876
3887
  return Object.keys(children);
3877
3888
  }
@@ -3888,7 +3899,7 @@ class Graph {
3888
3899
  * Complexity: O(|V|).
3889
3900
  */
3890
3901
  predecessors(v) {
3891
- var predsV = this.#preds[v];
3902
+ var predsV = this._preds[v];
3892
3903
  if (predsV) {
3893
3904
  return Object.keys(predsV);
3894
3905
  }
@@ -3900,7 +3911,7 @@ class Graph {
3900
3911
  * Complexity: O(|V|).
3901
3912
  */
3902
3913
  successors(v) {
3903
- var sucsV = this.#sucs[v];
3914
+ var sucsV = this._sucs[v];
3904
3915
  if (sucsV) {
3905
3916
  return Object.keys(sucsV);
3906
3917
  }
@@ -3941,21 +3952,21 @@ class Graph {
3941
3952
  */
3942
3953
  filterNodes(filter) {
3943
3954
  var copy = new this.constructor({
3944
- directed: this.#isDirected,
3945
- multigraph: this.#isMultigraph,
3946
- compound: this.#isCompound
3955
+ directed: this._isDirected,
3956
+ multigraph: this._isMultigraph,
3957
+ compound: this._isCompound
3947
3958
  });
3948
3959
 
3949
3960
  copy.setGraph(this.graph());
3950
3961
 
3951
3962
  var self = this;
3952
- Object.entries(this.#nodes).forEach(function([v, value]) {
3963
+ Object.entries(this._nodes).forEach(function([v, value]) {
3953
3964
  if (filter(v)) {
3954
3965
  copy.setNode(v, value);
3955
3966
  }
3956
3967
  });
3957
3968
 
3958
- Object.values(this.#edgeObjs).forEach(function(e) {
3969
+ Object.values(this._edgeObjs).forEach(function(e) {
3959
3970
  if (copy.hasNode(e.v) && copy.hasNode(e.w)) {
3960
3971
  copy.setEdge(e, self.edge(e));
3961
3972
  }
@@ -3974,7 +3985,7 @@ class Graph {
3974
3985
  }
3975
3986
  }
3976
3987
 
3977
- if (this.#isCompound) {
3988
+ if (this._isCompound) {
3978
3989
  copy.nodes().forEach(v => copy.setParent(v, findParent(v)));
3979
3990
  }
3980
3991
 
@@ -3991,9 +4002,9 @@ class Graph {
3991
4002
  * Complexity: O(1).
3992
4003
  */
3993
4004
  setDefaultEdgeLabel(newDefault) {
3994
- this.#defaultEdgeLabelFn = newDefault;
4005
+ this._defaultEdgeLabelFn = newDefault;
3995
4006
  if (typeof newDefault !== 'function') {
3996
- this.#defaultEdgeLabelFn = () => newDefault;
4007
+ this._defaultEdgeLabelFn = () => newDefault;
3997
4008
  }
3998
4009
 
3999
4010
  return this;
@@ -4004,7 +4015,7 @@ class Graph {
4004
4015
  * Complexity: O(1).
4005
4016
  */
4006
4017
  edgeCount() {
4007
- return this.#edgeCount;
4018
+ return this._edgeCount;
4008
4019
  }
4009
4020
 
4010
4021
  /**
@@ -4012,7 +4023,7 @@ class Graph {
4012
4023
  * Complexity: O(|E|).
4013
4024
  */
4014
4025
  edges() {
4015
- return Object.values(this.#edgeObjs);
4026
+ return Object.values(this._edgeObjs);
4016
4027
  }
4017
4028
 
4018
4029
  /**
@@ -4070,15 +4081,15 @@ class Graph {
4070
4081
  name = "" + name;
4071
4082
  }
4072
4083
 
4073
- var e = edgeArgsToId(this.#isDirected, v, w, name);
4074
- if (this.#edgeLabels.hasOwnProperty(e)) {
4084
+ var e = edgeArgsToId(this._isDirected, v, w, name);
4085
+ if (this._edgeLabels.hasOwnProperty(e)) {
4075
4086
  if (valueSpecified) {
4076
- this.#edgeLabels[e] = value;
4087
+ this._edgeLabels[e] = value;
4077
4088
  }
4078
4089
  return this;
4079
4090
  }
4080
4091
 
4081
- if (name !== undefined && !this.#isMultigraph) {
4092
+ if (name !== undefined && !this._isMultigraph) {
4082
4093
  throw new Error("Cannot set a named edge when isMultigraph = false");
4083
4094
  }
4084
4095
 
@@ -4087,20 +4098,20 @@ class Graph {
4087
4098
  this.setNode(v);
4088
4099
  this.setNode(w);
4089
4100
 
4090
- this.#edgeLabels[e] = valueSpecified ? value : this.#defaultEdgeLabelFn(v, w, name);
4101
+ this._edgeLabels[e] = valueSpecified ? value : this._defaultEdgeLabelFn(v, w, name);
4091
4102
 
4092
- var edgeObj = edgeArgsToObj(this.#isDirected, v, w, name);
4103
+ var edgeObj = edgeArgsToObj(this._isDirected, v, w, name);
4093
4104
  // Ensure we add undirected edges in a consistent way.
4094
4105
  v = edgeObj.v;
4095
4106
  w = edgeObj.w;
4096
4107
 
4097
4108
  Object.freeze(edgeObj);
4098
- this.#edgeObjs[e] = edgeObj;
4099
- incrementOrInitEntry(this.#preds[w], v);
4100
- incrementOrInitEntry(this.#sucs[v], w);
4101
- this.#in[w][e] = edgeObj;
4102
- this.#out[v][e] = edgeObj;
4103
- this.#edgeCount++;
4109
+ this._edgeObjs[e] = edgeObj;
4110
+ incrementOrInitEntry(this._preds[w], v);
4111
+ incrementOrInitEntry(this._sucs[v], w);
4112
+ this._in[w][e] = edgeObj;
4113
+ this._out[v][e] = edgeObj;
4114
+ this._edgeCount++;
4104
4115
  return this;
4105
4116
  }
4106
4117
 
@@ -4110,9 +4121,9 @@ class Graph {
4110
4121
  */
4111
4122
  edge(v, w, name) {
4112
4123
  var e = (arguments.length === 1
4113
- ? edgeObjToId(this.#isDirected, arguments[0])
4114
- : edgeArgsToId(this.#isDirected, v, w, name));
4115
- return this.#edgeLabels[e];
4124
+ ? edgeObjToId(this._isDirected, arguments[0])
4125
+ : edgeArgsToId(this._isDirected, v, w, name));
4126
+ return this._edgeLabels[e];
4116
4127
  }
4117
4128
 
4118
4129
  /**
@@ -4134,9 +4145,9 @@ class Graph {
4134
4145
  */
4135
4146
  hasEdge(v, w, name) {
4136
4147
  var e = (arguments.length === 1
4137
- ? edgeObjToId(this.#isDirected, arguments[0])
4138
- : edgeArgsToId(this.#isDirected, v, w, name));
4139
- return this.#edgeLabels.hasOwnProperty(e);
4148
+ ? edgeObjToId(this._isDirected, arguments[0])
4149
+ : edgeArgsToId(this._isDirected, v, w, name));
4150
+ return this._edgeLabels.hasOwnProperty(e);
4140
4151
  }
4141
4152
 
4142
4153
  /**
@@ -4145,19 +4156,19 @@ class Graph {
4145
4156
  */
4146
4157
  removeEdge(v, w, name) {
4147
4158
  var e = (arguments.length === 1
4148
- ? edgeObjToId(this.#isDirected, arguments[0])
4149
- : edgeArgsToId(this.#isDirected, v, w, name));
4150
- var edge = this.#edgeObjs[e];
4159
+ ? edgeObjToId(this._isDirected, arguments[0])
4160
+ : edgeArgsToId(this._isDirected, v, w, name));
4161
+ var edge = this._edgeObjs[e];
4151
4162
  if (edge) {
4152
4163
  v = edge.v;
4153
4164
  w = edge.w;
4154
- delete this.#edgeLabels[e];
4155
- delete this.#edgeObjs[e];
4156
- decrementOrRemoveEntry(this.#preds[w], v);
4157
- decrementOrRemoveEntry(this.#sucs[v], w);
4158
- delete this.#in[w][e];
4159
- delete this.#out[v][e];
4160
- this.#edgeCount--;
4165
+ delete this._edgeLabels[e];
4166
+ delete this._edgeObjs[e];
4167
+ decrementOrRemoveEntry(this._preds[w], v);
4168
+ decrementOrRemoveEntry(this._sucs[v], w);
4169
+ delete this._in[w][e];
4170
+ delete this._out[v][e];
4171
+ this._edgeCount--;
4161
4172
  }
4162
4173
  return this;
4163
4174
  }
@@ -4168,7 +4179,7 @@ class Graph {
4168
4179
  * Complexity: O(|E|).
4169
4180
  */
4170
4181
  inEdges(v, u) {
4171
- var inV = this.#in[v];
4182
+ var inV = this._in[v];
4172
4183
  if (inV) {
4173
4184
  var edges = Object.values(inV);
4174
4185
  if (!u) {
@@ -4184,7 +4195,7 @@ class Graph {
4184
4195
  * Complexity: O(|E|).
4185
4196
  */
4186
4197
  outEdges(v, w) {
4187
- var outV = this.#out[v];
4198
+ var outV = this._out[v];
4188
4199
  if (outV) {
4189
4200
  var edges = Object.values(outV);
4190
4201
  if (!w) {
@@ -4342,7 +4353,7 @@ function read(json) {
4342
4353
  }
4343
4354
 
4344
4355
  },{"./graph":44}],47:[function(require,module,exports){
4345
- module.exports = '2.1.13';
4356
+ module.exports = '2.2.2';
4346
4357
 
4347
4358
  },{}]},{},[1])(1)
4348
4359
  });