diff --git a/lib/network/modules/LayoutEngine.js b/lib/network/modules/LayoutEngine.js index ad907ebd8..7fb58aa51 100644 --- a/lib/network/modules/LayoutEngine.js +++ b/lib/network/modules/LayoutEngine.js @@ -711,7 +711,7 @@ class LayoutEngine { this.lastNodeOnLevel = {}; this.hierarchical = new HierarchicalStatus(); - for (nodeId in this.body.nodes) { + for (nodeId of this.body.nodeIndices) { if (this.body.nodes.hasOwnProperty(nodeId)) { node = this.body.nodes[nodeId]; if (node.options.level !== undefined) { @@ -746,7 +746,7 @@ class LayoutEngine { // fallback for cases where there are nodes but no edges - for (let nodeId in this.body.nodes) { + for (let nodeId of this.body.nodeIndices) { if (this.body.nodes.hasOwnProperty(nodeId)) { this.hierarchical.ensureLevel(nodeId); } @@ -1106,7 +1106,7 @@ class LayoutEngine { // center all parents let centerAllParents = () => { - for (let nodeId in this.body.nodes) { + for (let nodeId of this.body.nodeIndices) { if (this.body.nodes.hasOwnProperty(nodeId)) this._centerParent(this.body.nodes[nodeId]); }