markdown-flow-ui 0.1.123 → 0.1.124
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/components/Slide/Player.cjs.js +1 -1
- package/dist/components/Slide/Player.cjs.js.map +1 -1
- package/dist/components/Slide/Player.es.js +191 -201
- package/dist/components/Slide/Player.es.js.map +1 -1
- package/dist/components/Slide/Slide.cjs.js +1 -1
- package/dist/components/Slide/Slide.cjs.js.map +1 -1
- package/dist/components/Slide/Slide.es.js +116 -116
- package/dist/components/Slide/Slide.es.js.map +1 -1
- package/dist/components/Slide/utils/playbackPreference.cjs.js +1 -1
- package/dist/components/Slide/utils/playbackPreference.cjs.js.map +1 -1
- package/dist/components/Slide/utils/playbackPreference.d.ts +1 -6
- package/dist/components/Slide/utils/playbackPreference.es.js +4 -9
- package/dist/components/Slide/utils/playbackPreference.es.js.map +1 -1
- package/dist/node_modules/cose-base/cose-base.cjs.js +1 -1
- package/dist/node_modules/cose-base/cose-base.cjs.js.map +1 -1
- package/dist/node_modules/cose-base/cose-base.es.js +1 -1
- package/dist/node_modules/cytoscape-fcose/node_modules/cose-base/cose-base.cjs.js +1 -1
- package/dist/node_modules/cytoscape-fcose/node_modules/cose-base/cose-base.cjs.js.map +1 -1
- package/dist/node_modules/cytoscape-fcose/node_modules/cose-base/cose-base.es.js +1 -1
- package/dist/node_modules/cytoscape-fcose/node_modules/layout-base/layout-base.cjs.js +1 -1
- package/dist/node_modules/cytoscape-fcose/node_modules/layout-base/layout-base.cjs.js.map +1 -1
- package/dist/node_modules/cytoscape-fcose/node_modules/layout-base/layout-base.es.js +1 -1
- package/dist/node_modules/layout-base/layout-base.cjs.js +1 -1
- package/dist/node_modules/layout-base/layout-base.cjs.js.map +1 -1
- package/dist/node_modules/layout-base/layout-base.es.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cose-base.cjs.js","sources":["../../../../../node_modules/cytoscape-fcose/node_modules/cose-base/cose-base.js"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory(require(\"layout-base\"));\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([\"layout-base\"], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"coseBase\"] = factory(require(\"layout-base\"));\n\telse\n\t\troot[\"coseBase\"] = factory(root[\"layoutBase\"]);\n})(this, function(__WEBPACK_EXTERNAL_MODULE__551__) {\nreturn /******/ (() => { // webpackBootstrap\n/******/ \t\"use strict\";\n/******/ \tvar __webpack_modules__ = ({\n\n/***/ 45:\n/***/ ((module, __unused_webpack_exports, __webpack_require__) => {\n\n\n\nvar coseBase = {};\n\ncoseBase.layoutBase = __webpack_require__(551);\ncoseBase.CoSEConstants = __webpack_require__(806);\ncoseBase.CoSEEdge = __webpack_require__(767);\ncoseBase.CoSEGraph = __webpack_require__(880);\ncoseBase.CoSEGraphManager = __webpack_require__(578);\ncoseBase.CoSELayout = __webpack_require__(765);\ncoseBase.CoSENode = __webpack_require__(991);\ncoseBase.ConstraintHandler = __webpack_require__(902);\n\nmodule.exports = coseBase;\n\n/***/ }),\n\n/***/ 806:\n/***/ ((module, __unused_webpack_exports, __webpack_require__) => {\n\n\n\nvar FDLayoutConstants = __webpack_require__(551).FDLayoutConstants;\n\nfunction CoSEConstants() {}\n\n//CoSEConstants inherits static props in FDLayoutConstants\nfor (var prop in FDLayoutConstants) {\n CoSEConstants[prop] = FDLayoutConstants[prop];\n}\n\nCoSEConstants.DEFAULT_USE_MULTI_LEVEL_SCALING = false;\nCoSEConstants.DEFAULT_RADIAL_SEPARATION = FDLayoutConstants.DEFAULT_EDGE_LENGTH;\nCoSEConstants.DEFAULT_COMPONENT_SEPERATION = 60;\nCoSEConstants.TILE = true;\nCoSEConstants.TILING_PADDING_VERTICAL = 10;\nCoSEConstants.TILING_PADDING_HORIZONTAL = 10;\nCoSEConstants.TRANSFORM_ON_CONSTRAINT_HANDLING = true;\nCoSEConstants.ENFORCE_CONSTRAINTS = true;\nCoSEConstants.APPLY_LAYOUT = true;\nCoSEConstants.RELAX_MOVEMENT_ON_CONSTRAINTS = true;\nCoSEConstants.TREE_REDUCTION_ON_INCREMENTAL = true; // this should be set to false if there will be a constraint\n// This constant is for differentiating whether actual layout algorithm that uses cose-base wants to apply only incremental layout or \n// an incremental layout on top of a randomized layout. If it is only incremental layout, then this constant should be true.\nCoSEConstants.PURE_INCREMENTAL = CoSEConstants.DEFAULT_INCREMENTAL;\n\nmodule.exports = CoSEConstants;\n\n/***/ }),\n\n/***/ 767:\n/***/ ((module, __unused_webpack_exports, __webpack_require__) => {\n\n\n\nvar FDLayoutEdge = __webpack_require__(551).FDLayoutEdge;\n\nfunction CoSEEdge(source, target, vEdge) {\n FDLayoutEdge.call(this, source, target, vEdge);\n}\n\nCoSEEdge.prototype = Object.create(FDLayoutEdge.prototype);\nfor (var prop in FDLayoutEdge) {\n CoSEEdge[prop] = FDLayoutEdge[prop];\n}\n\nmodule.exports = CoSEEdge;\n\n/***/ }),\n\n/***/ 880:\n/***/ ((module, __unused_webpack_exports, __webpack_require__) => {\n\n\n\nvar LGraph = __webpack_require__(551).LGraph;\n\nfunction CoSEGraph(parent, graphMgr, vGraph) {\n LGraph.call(this, parent, graphMgr, vGraph);\n}\n\nCoSEGraph.prototype = Object.create(LGraph.prototype);\nfor (var prop in LGraph) {\n CoSEGraph[prop] = LGraph[prop];\n}\n\nmodule.exports = CoSEGraph;\n\n/***/ }),\n\n/***/ 578:\n/***/ ((module, __unused_webpack_exports, __webpack_require__) => {\n\n\n\nvar LGraphManager = __webpack_require__(551).LGraphManager;\n\nfunction CoSEGraphManager(layout) {\n LGraphManager.call(this, layout);\n}\n\nCoSEGraphManager.prototype = Object.create(LGraphManager.prototype);\nfor (var prop in LGraphManager) {\n CoSEGraphManager[prop] = LGraphManager[prop];\n}\n\nmodule.exports = CoSEGraphManager;\n\n/***/ }),\n\n/***/ 765:\n/***/ ((module, __unused_webpack_exports, __webpack_require__) => {\n\n\n\nvar FDLayout = __webpack_require__(551).FDLayout;\nvar CoSEGraphManager = __webpack_require__(578);\nvar CoSEGraph = __webpack_require__(880);\nvar CoSENode = __webpack_require__(991);\nvar CoSEEdge = __webpack_require__(767);\nvar CoSEConstants = __webpack_require__(806);\nvar ConstraintHandler = __webpack_require__(902);\nvar FDLayoutConstants = __webpack_require__(551).FDLayoutConstants;\nvar LayoutConstants = __webpack_require__(551).LayoutConstants;\nvar Point = __webpack_require__(551).Point;\nvar PointD = __webpack_require__(551).PointD;\nvar DimensionD = __webpack_require__(551).DimensionD;\nvar Layout = __webpack_require__(551).Layout;\nvar Integer = __webpack_require__(551).Integer;\nvar IGeometry = __webpack_require__(551).IGeometry;\nvar LGraph = __webpack_require__(551).LGraph;\nvar Transform = __webpack_require__(551).Transform;\nvar LinkedList = __webpack_require__(551).LinkedList;\n\nfunction CoSELayout() {\n FDLayout.call(this);\n\n this.toBeTiled = {}; // Memorize if a node is to be tiled or is tiled\n this.constraints = {}; // keep layout constraints\n}\n\nCoSELayout.prototype = Object.create(FDLayout.prototype);\n\nfor (var prop in FDLayout) {\n CoSELayout[prop] = FDLayout[prop];\n}\n\nCoSELayout.prototype.newGraphManager = function () {\n var gm = new CoSEGraphManager(this);\n this.graphManager = gm;\n return gm;\n};\n\nCoSELayout.prototype.newGraph = function (vGraph) {\n return new CoSEGraph(null, this.graphManager, vGraph);\n};\n\nCoSELayout.prototype.newNode = function (vNode) {\n return new CoSENode(this.graphManager, vNode);\n};\n\nCoSELayout.prototype.newEdge = function (vEdge) {\n return new CoSEEdge(null, null, vEdge);\n};\n\nCoSELayout.prototype.initParameters = function () {\n FDLayout.prototype.initParameters.call(this, arguments);\n if (!this.isSubLayout) {\n if (CoSEConstants.DEFAULT_EDGE_LENGTH < 10) {\n this.idealEdgeLength = 10;\n } else {\n this.idealEdgeLength = CoSEConstants.DEFAULT_EDGE_LENGTH;\n }\n\n this.useSmartIdealEdgeLengthCalculation = CoSEConstants.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION;\n this.gravityConstant = FDLayoutConstants.DEFAULT_GRAVITY_STRENGTH;\n this.compoundGravityConstant = FDLayoutConstants.DEFAULT_COMPOUND_GRAVITY_STRENGTH;\n this.gravityRangeFactor = FDLayoutConstants.DEFAULT_GRAVITY_RANGE_FACTOR;\n this.compoundGravityRangeFactor = FDLayoutConstants.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR;\n\n // variables for tree reduction support\n this.prunedNodesAll = [];\n this.growTreeIterations = 0;\n this.afterGrowthIterations = 0;\n this.isTreeGrowing = false;\n this.isGrowthFinished = false;\n }\n};\n\n// This method is used to set CoSE related parameters used by spring embedder.\nCoSELayout.prototype.initSpringEmbedder = function () {\n FDLayout.prototype.initSpringEmbedder.call(this);\n\n // variables for cooling\n this.coolingCycle = 0;\n this.maxCoolingCycle = this.maxIterations / FDLayoutConstants.CONVERGENCE_CHECK_PERIOD;\n this.finalTemperature = 0.04;\n this.coolingAdjuster = 1;\n};\n\nCoSELayout.prototype.layout = function () {\n var createBendsAsNeeded = LayoutConstants.DEFAULT_CREATE_BENDS_AS_NEEDED;\n if (createBendsAsNeeded) {\n this.createBendpoints();\n this.graphManager.resetAllEdges();\n }\n\n this.level = 0;\n return this.classicLayout();\n};\n\nCoSELayout.prototype.classicLayout = function () {\n this.nodesWithGravity = this.calculateNodesToApplyGravitationTo();\n this.graphManager.setAllNodesToApplyGravitation(this.nodesWithGravity);\n this.calcNoOfChildrenForAllNodes();\n this.graphManager.calcLowestCommonAncestors();\n this.graphManager.calcInclusionTreeDepths();\n this.graphManager.getRoot().calcEstimatedSize();\n this.calcIdealEdgeLengths();\n\n if (!this.incremental) {\n var forest = this.getFlatForest();\n\n // The graph associated with this layout is flat and a forest\n if (forest.length > 0) {\n this.positionNodesRadially(forest);\n }\n // The graph associated with this layout is not flat or a forest\n else {\n // Reduce the trees when incremental mode is not enabled and graph is not a forest \n this.reduceTrees();\n // Update nodes that gravity will be applied\n this.graphManager.resetAllNodesToApplyGravitation();\n var allNodes = new Set(this.getAllNodes());\n var intersection = this.nodesWithGravity.filter(function (x) {\n return allNodes.has(x);\n });\n this.graphManager.setAllNodesToApplyGravitation(intersection);\n\n this.positionNodesRandomly();\n }\n } else {\n if (CoSEConstants.TREE_REDUCTION_ON_INCREMENTAL) {\n // Reduce the trees in incremental mode if only this constant is set to true \n this.reduceTrees();\n // Update nodes that gravity will be applied\n this.graphManager.resetAllNodesToApplyGravitation();\n var allNodes = new Set(this.getAllNodes());\n var intersection = this.nodesWithGravity.filter(function (x) {\n return allNodes.has(x);\n });\n this.graphManager.setAllNodesToApplyGravitation(intersection);\n }\n }\n\n if (Object.keys(this.constraints).length > 0) {\n ConstraintHandler.handleConstraints(this);\n this.initConstraintVariables();\n }\n\n this.initSpringEmbedder();\n if (CoSEConstants.APPLY_LAYOUT) {\n this.runSpringEmbedder();\n }\n\n return true;\n};\n\nCoSELayout.prototype.tick = function () {\n this.totalIterations++;\n\n if (this.totalIterations === this.maxIterations && !this.isTreeGrowing && !this.isGrowthFinished) {\n if (this.prunedNodesAll.length > 0) {\n this.isTreeGrowing = true;\n } else {\n return true;\n }\n }\n\n if (this.totalIterations % FDLayoutConstants.CONVERGENCE_CHECK_PERIOD == 0 && !this.isTreeGrowing && !this.isGrowthFinished) {\n if (this.isConverged()) {\n if (this.prunedNodesAll.length > 0) {\n this.isTreeGrowing = true;\n } else {\n return true;\n }\n }\n\n this.coolingCycle++;\n\n if (this.layoutQuality == 0) {\n // quality - \"draft\"\n this.coolingAdjuster = this.coolingCycle;\n } else if (this.layoutQuality == 1) {\n // quality - \"default\"\n this.coolingAdjuster = this.coolingCycle / 3;\n }\n\n // cooling schedule is based on http://www.btluke.com/simanf1.html -> cooling schedule 3\n this.coolingFactor = Math.max(this.initialCoolingFactor - Math.pow(this.coolingCycle, Math.log(100 * (this.initialCoolingFactor - this.finalTemperature)) / Math.log(this.maxCoolingCycle)) / 100 * this.coolingAdjuster, this.finalTemperature);\n this.animationPeriod = Math.ceil(this.initialAnimationPeriod * Math.sqrt(this.coolingFactor));\n }\n // Operations while tree is growing again \n if (this.isTreeGrowing) {\n if (this.growTreeIterations % 10 == 0) {\n if (this.prunedNodesAll.length > 0) {\n this.graphManager.updateBounds();\n this.updateGrid();\n this.growTree(this.prunedNodesAll);\n // Update nodes that gravity will be applied\n this.graphManager.resetAllNodesToApplyGravitation();\n var allNodes = new Set(this.getAllNodes());\n var intersection = this.nodesWithGravity.filter(function (x) {\n return allNodes.has(x);\n });\n this.graphManager.setAllNodesToApplyGravitation(intersection);\n\n this.graphManager.updateBounds();\n this.updateGrid();\n if (CoSEConstants.PURE_INCREMENTAL) this.coolingFactor = FDLayoutConstants.DEFAULT_COOLING_FACTOR_INCREMENTAL / 2;else this.coolingFactor = FDLayoutConstants.DEFAULT_COOLING_FACTOR_INCREMENTAL;\n } else {\n this.isTreeGrowing = false;\n this.isGrowthFinished = true;\n }\n }\n this.growTreeIterations++;\n }\n // Operations after growth is finished\n if (this.isGrowthFinished) {\n if (this.isConverged()) {\n return true;\n }\n if (this.afterGrowthIterations % 10 == 0) {\n this.graphManager.updateBounds();\n this.updateGrid();\n }\n if (CoSEConstants.PURE_INCREMENTAL) this.coolingFactor = FDLayoutConstants.DEFAULT_COOLING_FACTOR_INCREMENTAL / 2 * ((100 - this.afterGrowthIterations) / 100);else this.coolingFactor = FDLayoutConstants.DEFAULT_COOLING_FACTOR_INCREMENTAL * ((100 - this.afterGrowthIterations) / 100);\n this.afterGrowthIterations++;\n }\n\n var gridUpdateAllowed = !this.isTreeGrowing && !this.isGrowthFinished;\n var forceToNodeSurroundingUpdate = this.growTreeIterations % 10 == 1 && this.isTreeGrowing || this.afterGrowthIterations % 10 == 1 && this.isGrowthFinished;\n\n this.totalDisplacement = 0;\n this.graphManager.updateBounds();\n this.calcSpringForces();\n this.calcRepulsionForces(gridUpdateAllowed, forceToNodeSurroundingUpdate);\n this.calcGravitationalForces();\n this.moveNodes();\n this.animate();\n\n return false; // Layout is not ended yet return false\n};\n\nCoSELayout.prototype.getPositionsData = function () {\n var allNodes = this.graphManager.getAllNodes();\n var pData = {};\n for (var i = 0; i < allNodes.length; i++) {\n var rect = allNodes[i].rect;\n var id = allNodes[i].id;\n pData[id] = {\n id: id,\n x: rect.getCenterX(),\n y: rect.getCenterY(),\n w: rect.width,\n h: rect.height\n };\n }\n\n return pData;\n};\n\nCoSELayout.prototype.runSpringEmbedder = function () {\n this.initialAnimationPeriod = 25;\n this.animationPeriod = this.initialAnimationPeriod;\n var layoutEnded = false;\n\n // If aminate option is 'during' signal that layout is supposed to start iterating\n if (FDLayoutConstants.ANIMATE === 'during') {\n this.emit('layoutstarted');\n } else {\n // If aminate option is 'during' tick() function will be called on index.js\n while (!layoutEnded) {\n layoutEnded = this.tick();\n }\n\n this.graphManager.updateBounds();\n }\n};\n\n// overrides moveNodes method in FDLayout\nCoSELayout.prototype.moveNodes = function () {\n var lNodes = this.getAllNodes();\n var node;\n\n // calculate displacement for each node \n for (var i = 0; i < lNodes.length; i++) {\n node = lNodes[i];\n node.calculateDisplacement();\n }\n\n if (Object.keys(this.constraints).length > 0) {\n this.updateDisplacements();\n }\n\n // move each node\n for (var i = 0; i < lNodes.length; i++) {\n node = lNodes[i];\n node.move();\n }\n};\n\n// constraint related methods: initConstraintVariables and updateDisplacements\n\n// initialize constraint related variables\nCoSELayout.prototype.initConstraintVariables = function () {\n var self = this;\n this.idToNodeMap = new Map();\n this.fixedNodeSet = new Set();\n\n var allNodes = this.graphManager.getAllNodes();\n\n // fill idToNodeMap\n for (var i = 0; i < allNodes.length; i++) {\n var node = allNodes[i];\n this.idToNodeMap.set(node.id, node);\n }\n\n // calculate fixed node weight for given compound node\n var calculateCompoundWeight = function calculateCompoundWeight(compoundNode) {\n var nodes = compoundNode.getChild().getNodes();\n var node;\n var fixedNodeWeight = 0;\n for (var i = 0; i < nodes.length; i++) {\n node = nodes[i];\n if (node.getChild() == null) {\n if (self.fixedNodeSet.has(node.id)) {\n fixedNodeWeight += 100;\n }\n } else {\n fixedNodeWeight += calculateCompoundWeight(node);\n }\n }\n return fixedNodeWeight;\n };\n\n if (this.constraints.fixedNodeConstraint) {\n // fill fixedNodeSet\n this.constraints.fixedNodeConstraint.forEach(function (nodeData) {\n self.fixedNodeSet.add(nodeData.nodeId);\n });\n\n // assign fixed node weights to compounds if they contain fixed nodes\n var allNodes = this.graphManager.getAllNodes();\n var node;\n\n for (var i = 0; i < allNodes.length; i++) {\n node = allNodes[i];\n if (node.getChild() != null) {\n var fixedNodeWeight = calculateCompoundWeight(node);\n if (fixedNodeWeight > 0) {\n node.fixedNodeWeight = fixedNodeWeight;\n }\n }\n }\n }\n\n if (this.constraints.relativePlacementConstraint) {\n var nodeToDummyForVerticalAlignment = new Map();\n var nodeToDummyForHorizontalAlignment = new Map();\n this.dummyToNodeForVerticalAlignment = new Map();\n this.dummyToNodeForHorizontalAlignment = new Map();\n this.fixedNodesOnHorizontal = new Set();\n this.fixedNodesOnVertical = new Set();\n\n // fill maps and sets\n this.fixedNodeSet.forEach(function (nodeId) {\n self.fixedNodesOnHorizontal.add(nodeId);\n self.fixedNodesOnVertical.add(nodeId);\n });\n\n if (this.constraints.alignmentConstraint) {\n if (this.constraints.alignmentConstraint.vertical) {\n var verticalAlignment = this.constraints.alignmentConstraint.vertical;\n for (var i = 0; i < verticalAlignment.length; i++) {\n this.dummyToNodeForVerticalAlignment.set(\"dummy\" + i, []);\n verticalAlignment[i].forEach(function (nodeId) {\n nodeToDummyForVerticalAlignment.set(nodeId, \"dummy\" + i);\n self.dummyToNodeForVerticalAlignment.get(\"dummy\" + i).push(nodeId);\n if (self.fixedNodeSet.has(nodeId)) {\n self.fixedNodesOnHorizontal.add(\"dummy\" + i);\n }\n });\n }\n }\n if (this.constraints.alignmentConstraint.horizontal) {\n var horizontalAlignment = this.constraints.alignmentConstraint.horizontal;\n for (var i = 0; i < horizontalAlignment.length; i++) {\n this.dummyToNodeForHorizontalAlignment.set(\"dummy\" + i, []);\n horizontalAlignment[i].forEach(function (nodeId) {\n nodeToDummyForHorizontalAlignment.set(nodeId, \"dummy\" + i);\n self.dummyToNodeForHorizontalAlignment.get(\"dummy\" + i).push(nodeId);\n if (self.fixedNodeSet.has(nodeId)) {\n self.fixedNodesOnVertical.add(\"dummy\" + i);\n }\n });\n }\n }\n }\n\n if (CoSEConstants.RELAX_MOVEMENT_ON_CONSTRAINTS) {\n\n this.shuffle = function (array) {\n var j, x, i;\n for (i = array.length - 1; i >= 2 * array.length / 3; i--) {\n j = Math.floor(Math.random() * (i + 1));\n x = array[i];\n array[i] = array[j];\n array[j] = x;\n }\n return array;\n };\n\n this.nodesInRelativeHorizontal = [];\n this.nodesInRelativeVertical = [];\n this.nodeToRelativeConstraintMapHorizontal = new Map();\n this.nodeToRelativeConstraintMapVertical = new Map();\n this.nodeToTempPositionMapHorizontal = new Map();\n this.nodeToTempPositionMapVertical = new Map();\n\n // fill arrays and maps\n this.constraints.relativePlacementConstraint.forEach(function (constraint) {\n if (constraint.left) {\n var nodeIdLeft = nodeToDummyForVerticalAlignment.has(constraint.left) ? nodeToDummyForVerticalAlignment.get(constraint.left) : constraint.left;\n var nodeIdRight = nodeToDummyForVerticalAlignment.has(constraint.right) ? nodeToDummyForVerticalAlignment.get(constraint.right) : constraint.right;\n\n if (!self.nodesInRelativeHorizontal.includes(nodeIdLeft)) {\n self.nodesInRelativeHorizontal.push(nodeIdLeft);\n self.nodeToRelativeConstraintMapHorizontal.set(nodeIdLeft, []);\n if (self.dummyToNodeForVerticalAlignment.has(nodeIdLeft)) {\n self.nodeToTempPositionMapHorizontal.set(nodeIdLeft, self.idToNodeMap.get(self.dummyToNodeForVerticalAlignment.get(nodeIdLeft)[0]).getCenterX());\n } else {\n self.nodeToTempPositionMapHorizontal.set(nodeIdLeft, self.idToNodeMap.get(nodeIdLeft).getCenterX());\n }\n }\n if (!self.nodesInRelativeHorizontal.includes(nodeIdRight)) {\n self.nodesInRelativeHorizontal.push(nodeIdRight);\n self.nodeToRelativeConstraintMapHorizontal.set(nodeIdRight, []);\n if (self.dummyToNodeForVerticalAlignment.has(nodeIdRight)) {\n self.nodeToTempPositionMapHorizontal.set(nodeIdRight, self.idToNodeMap.get(self.dummyToNodeForVerticalAlignment.get(nodeIdRight)[0]).getCenterX());\n } else {\n self.nodeToTempPositionMapHorizontal.set(nodeIdRight, self.idToNodeMap.get(nodeIdRight).getCenterX());\n }\n }\n\n self.nodeToRelativeConstraintMapHorizontal.get(nodeIdLeft).push({ right: nodeIdRight, gap: constraint.gap });\n self.nodeToRelativeConstraintMapHorizontal.get(nodeIdRight).push({ left: nodeIdLeft, gap: constraint.gap });\n } else {\n var nodeIdTop = nodeToDummyForHorizontalAlignment.has(constraint.top) ? nodeToDummyForHorizontalAlignment.get(constraint.top) : constraint.top;\n var nodeIdBottom = nodeToDummyForHorizontalAlignment.has(constraint.bottom) ? nodeToDummyForHorizontalAlignment.get(constraint.bottom) : constraint.bottom;\n\n if (!self.nodesInRelativeVertical.includes(nodeIdTop)) {\n self.nodesInRelativeVertical.push(nodeIdTop);\n self.nodeToRelativeConstraintMapVertical.set(nodeIdTop, []);\n if (self.dummyToNodeForHorizontalAlignment.has(nodeIdTop)) {\n self.nodeToTempPositionMapVertical.set(nodeIdTop, self.idToNodeMap.get(self.dummyToNodeForHorizontalAlignment.get(nodeIdTop)[0]).getCenterY());\n } else {\n self.nodeToTempPositionMapVertical.set(nodeIdTop, self.idToNodeMap.get(nodeIdTop).getCenterY());\n }\n }\n if (!self.nodesInRelativeVertical.includes(nodeIdBottom)) {\n self.nodesInRelativeVertical.push(nodeIdBottom);\n self.nodeToRelativeConstraintMapVertical.set(nodeIdBottom, []);\n if (self.dummyToNodeForHorizontalAlignment.has(nodeIdBottom)) {\n self.nodeToTempPositionMapVertical.set(nodeIdBottom, self.idToNodeMap.get(self.dummyToNodeForHorizontalAlignment.get(nodeIdBottom)[0]).getCenterY());\n } else {\n self.nodeToTempPositionMapVertical.set(nodeIdBottom, self.idToNodeMap.get(nodeIdBottom).getCenterY());\n }\n }\n self.nodeToRelativeConstraintMapVertical.get(nodeIdTop).push({ bottom: nodeIdBottom, gap: constraint.gap });\n self.nodeToRelativeConstraintMapVertical.get(nodeIdBottom).push({ top: nodeIdTop, gap: constraint.gap });\n }\n });\n } else {\n var subGraphOnHorizontal = new Map(); // subgraph from vertical RP constraints\n var subGraphOnVertical = new Map(); // subgraph from vertical RP constraints\n\n // construct subgraphs from relative placement constraints \n this.constraints.relativePlacementConstraint.forEach(function (constraint) {\n if (constraint.left) {\n var left = nodeToDummyForVerticalAlignment.has(constraint.left) ? nodeToDummyForVerticalAlignment.get(constraint.left) : constraint.left;\n var right = nodeToDummyForVerticalAlignment.has(constraint.right) ? nodeToDummyForVerticalAlignment.get(constraint.right) : constraint.right;\n if (subGraphOnHorizontal.has(left)) {\n subGraphOnHorizontal.get(left).push(right);\n } else {\n subGraphOnHorizontal.set(left, [right]);\n }\n if (subGraphOnHorizontal.has(right)) {\n subGraphOnHorizontal.get(right).push(left);\n } else {\n subGraphOnHorizontal.set(right, [left]);\n }\n } else {\n var top = nodeToDummyForHorizontalAlignment.has(constraint.top) ? nodeToDummyForHorizontalAlignment.get(constraint.top) : constraint.top;\n var bottom = nodeToDummyForHorizontalAlignment.has(constraint.bottom) ? nodeToDummyForHorizontalAlignment.get(constraint.bottom) : constraint.bottom;\n if (subGraphOnVertical.has(top)) {\n subGraphOnVertical.get(top).push(bottom);\n } else {\n subGraphOnVertical.set(top, [bottom]);\n }\n if (subGraphOnVertical.has(bottom)) {\n subGraphOnVertical.get(bottom).push(top);\n } else {\n subGraphOnVertical.set(bottom, [top]);\n }\n }\n });\n\n // function to construct components from a given graph \n // also returns an array that keeps whether each component contains fixed node\n var constructComponents = function constructComponents(graph, fixedNodes) {\n var components = [];\n var isFixed = [];\n var queue = new LinkedList();\n var visited = new Set();\n var count = 0;\n\n graph.forEach(function (value, key) {\n if (!visited.has(key)) {\n components[count] = [];\n isFixed[count] = false;\n var currentNode = key;\n queue.push(currentNode);\n visited.add(currentNode);\n components[count].push(currentNode);\n\n while (queue.length != 0) {\n currentNode = queue.shift();\n if (fixedNodes.has(currentNode)) {\n isFixed[count] = true;\n }\n var neighbors = graph.get(currentNode);\n neighbors.forEach(function (neighbor) {\n if (!visited.has(neighbor)) {\n queue.push(neighbor);\n visited.add(neighbor);\n components[count].push(neighbor);\n }\n });\n }\n count++;\n }\n });\n\n return { components: components, isFixed: isFixed };\n };\n\n var resultOnHorizontal = constructComponents(subGraphOnHorizontal, self.fixedNodesOnHorizontal);\n this.componentsOnHorizontal = resultOnHorizontal.components;\n this.fixedComponentsOnHorizontal = resultOnHorizontal.isFixed;\n var resultOnVertical = constructComponents(subGraphOnVertical, self.fixedNodesOnVertical);\n this.componentsOnVertical = resultOnVertical.components;\n this.fixedComponentsOnVertical = resultOnVertical.isFixed;\n }\n }\n};\n\n// updates node displacements based on constraints\nCoSELayout.prototype.updateDisplacements = function () {\n var self = this;\n if (this.constraints.fixedNodeConstraint) {\n this.constraints.fixedNodeConstraint.forEach(function (nodeData) {\n var fixedNode = self.idToNodeMap.get(nodeData.nodeId);\n fixedNode.displacementX = 0;\n fixedNode.displacementY = 0;\n });\n }\n\n if (this.constraints.alignmentConstraint) {\n if (this.constraints.alignmentConstraint.vertical) {\n var allVerticalAlignments = this.constraints.alignmentConstraint.vertical;\n for (var i = 0; i < allVerticalAlignments.length; i++) {\n var totalDisplacementX = 0;\n for (var j = 0; j < allVerticalAlignments[i].length; j++) {\n if (this.fixedNodeSet.has(allVerticalAlignments[i][j])) {\n totalDisplacementX = 0;\n break;\n }\n totalDisplacementX += this.idToNodeMap.get(allVerticalAlignments[i][j]).displacementX;\n }\n var averageDisplacementX = totalDisplacementX / allVerticalAlignments[i].length;\n for (var j = 0; j < allVerticalAlignments[i].length; j++) {\n this.idToNodeMap.get(allVerticalAlignments[i][j]).displacementX = averageDisplacementX;\n }\n }\n }\n if (this.constraints.alignmentConstraint.horizontal) {\n var allHorizontalAlignments = this.constraints.alignmentConstraint.horizontal;\n for (var i = 0; i < allHorizontalAlignments.length; i++) {\n var totalDisplacementY = 0;\n for (var j = 0; j < allHorizontalAlignments[i].length; j++) {\n if (this.fixedNodeSet.has(allHorizontalAlignments[i][j])) {\n totalDisplacementY = 0;\n break;\n }\n totalDisplacementY += this.idToNodeMap.get(allHorizontalAlignments[i][j]).displacementY;\n }\n var averageDisplacementY = totalDisplacementY / allHorizontalAlignments[i].length;\n for (var j = 0; j < allHorizontalAlignments[i].length; j++) {\n this.idToNodeMap.get(allHorizontalAlignments[i][j]).displacementY = averageDisplacementY;\n }\n }\n }\n }\n\n if (this.constraints.relativePlacementConstraint) {\n\n if (CoSEConstants.RELAX_MOVEMENT_ON_CONSTRAINTS) {\n // shuffle array to randomize node processing order\n if (this.totalIterations % 10 == 0) {\n this.shuffle(this.nodesInRelativeHorizontal);\n this.shuffle(this.nodesInRelativeVertical);\n }\n\n this.nodesInRelativeHorizontal.forEach(function (nodeId) {\n if (!self.fixedNodesOnHorizontal.has(nodeId)) {\n var displacement = 0;\n if (self.dummyToNodeForVerticalAlignment.has(nodeId)) {\n displacement = self.idToNodeMap.get(self.dummyToNodeForVerticalAlignment.get(nodeId)[0]).displacementX;\n } else {\n displacement = self.idToNodeMap.get(nodeId).displacementX;\n }\n self.nodeToRelativeConstraintMapHorizontal.get(nodeId).forEach(function (constraint) {\n if (constraint.right) {\n var diff = self.nodeToTempPositionMapHorizontal.get(constraint.right) - self.nodeToTempPositionMapHorizontal.get(nodeId) - displacement;\n if (diff < constraint.gap) {\n displacement -= constraint.gap - diff;\n }\n } else {\n var diff = self.nodeToTempPositionMapHorizontal.get(nodeId) - self.nodeToTempPositionMapHorizontal.get(constraint.left) + displacement;\n if (diff < constraint.gap) {\n displacement += constraint.gap - diff;\n }\n }\n });\n self.nodeToTempPositionMapHorizontal.set(nodeId, self.nodeToTempPositionMapHorizontal.get(nodeId) + displacement);\n if (self.dummyToNodeForVerticalAlignment.has(nodeId)) {\n self.dummyToNodeForVerticalAlignment.get(nodeId).forEach(function (nodeId) {\n self.idToNodeMap.get(nodeId).displacementX = displacement;\n });\n } else {\n self.idToNodeMap.get(nodeId).displacementX = displacement;\n }\n }\n });\n\n this.nodesInRelativeVertical.forEach(function (nodeId) {\n if (!self.fixedNodesOnHorizontal.has(nodeId)) {\n var displacement = 0;\n if (self.dummyToNodeForHorizontalAlignment.has(nodeId)) {\n displacement = self.idToNodeMap.get(self.dummyToNodeForHorizontalAlignment.get(nodeId)[0]).displacementY;\n } else {\n displacement = self.idToNodeMap.get(nodeId).displacementY;\n }\n self.nodeToRelativeConstraintMapVertical.get(nodeId).forEach(function (constraint) {\n if (constraint.bottom) {\n var diff = self.nodeToTempPositionMapVertical.get(constraint.bottom) - self.nodeToTempPositionMapVertical.get(nodeId) - displacement;\n if (diff < constraint.gap) {\n displacement -= constraint.gap - diff;\n }\n } else {\n var diff = self.nodeToTempPositionMapVertical.get(nodeId) - self.nodeToTempPositionMapVertical.get(constraint.top) + displacement;\n if (diff < constraint.gap) {\n displacement += constraint.gap - diff;\n }\n }\n });\n self.nodeToTempPositionMapVertical.set(nodeId, self.nodeToTempPositionMapVertical.get(nodeId) + displacement);\n if (self.dummyToNodeForHorizontalAlignment.has(nodeId)) {\n self.dummyToNodeForHorizontalAlignment.get(nodeId).forEach(function (nodeId) {\n self.idToNodeMap.get(nodeId).displacementY = displacement;\n });\n } else {\n self.idToNodeMap.get(nodeId).displacementY = displacement;\n }\n }\n });\n } else {\n for (var i = 0; i < this.componentsOnHorizontal.length; i++) {\n var component = this.componentsOnHorizontal[i];\n if (this.fixedComponentsOnHorizontal[i]) {\n for (var j = 0; j < component.length; j++) {\n if (this.dummyToNodeForVerticalAlignment.has(component[j])) {\n this.dummyToNodeForVerticalAlignment.get(component[j]).forEach(function (nodeId) {\n self.idToNodeMap.get(nodeId).displacementX = 0;\n });\n } else {\n this.idToNodeMap.get(component[j]).displacementX = 0;\n }\n }\n } else {\n var sum = 0;\n var count = 0;\n for (var j = 0; j < component.length; j++) {\n if (this.dummyToNodeForVerticalAlignment.has(component[j])) {\n var actualNodes = this.dummyToNodeForVerticalAlignment.get(component[j]);\n sum += actualNodes.length * this.idToNodeMap.get(actualNodes[0]).displacementX;\n count += actualNodes.length;\n } else {\n sum += this.idToNodeMap.get(component[j]).displacementX;\n count++;\n }\n }\n var averageDisplacement = sum / count;\n for (var j = 0; j < component.length; j++) {\n if (this.dummyToNodeForVerticalAlignment.has(component[j])) {\n this.dummyToNodeForVerticalAlignment.get(component[j]).forEach(function (nodeId) {\n self.idToNodeMap.get(nodeId).displacementX = averageDisplacement;\n });\n } else {\n this.idToNodeMap.get(component[j]).displacementX = averageDisplacement;\n }\n }\n }\n }\n\n for (var i = 0; i < this.componentsOnVertical.length; i++) {\n var component = this.componentsOnVertical[i];\n if (this.fixedComponentsOnVertical[i]) {\n for (var j = 0; j < component.length; j++) {\n if (this.dummyToNodeForHorizontalAlignment.has(component[j])) {\n this.dummyToNodeForHorizontalAlignment.get(component[j]).forEach(function (nodeId) {\n self.idToNodeMap.get(nodeId).displacementY = 0;\n });\n } else {\n this.idToNodeMap.get(component[j]).displacementY = 0;\n }\n }\n } else {\n var sum = 0;\n var count = 0;\n for (var j = 0; j < component.length; j++) {\n if (this.dummyToNodeForHorizontalAlignment.has(component[j])) {\n var actualNodes = this.dummyToNodeForHorizontalAlignment.get(component[j]);\n sum += actualNodes.length * this.idToNodeMap.get(actualNodes[0]).displacementY;\n count += actualNodes.length;\n } else {\n sum += this.idToNodeMap.get(component[j]).displacementY;\n count++;\n }\n }\n var averageDisplacement = sum / count;\n for (var j = 0; j < component.length; j++) {\n if (this.dummyToNodeForHorizontalAlignment.has(component[j])) {\n this.dummyToNodeForHorizontalAlignment.get(component[j]).forEach(function (nodeId) {\n self.idToNodeMap.get(nodeId).displacementY = averageDisplacement;\n });\n } else {\n this.idToNodeMap.get(component[j]).displacementY = averageDisplacement;\n }\n }\n }\n }\n }\n }\n};\n\nCoSELayout.prototype.calculateNodesToApplyGravitationTo = function () {\n var nodeList = [];\n var graph;\n\n var graphs = this.graphManager.getGraphs();\n var size = graphs.length;\n var i;\n for (i = 0; i < size; i++) {\n graph = graphs[i];\n\n graph.updateConnected();\n\n if (!graph.isConnected) {\n nodeList = nodeList.concat(graph.getNodes());\n }\n }\n\n return nodeList;\n};\n\nCoSELayout.prototype.createBendpoints = function () {\n var edges = [];\n edges = edges.concat(this.graphManager.getAllEdges());\n var visited = new Set();\n var i;\n for (i = 0; i < edges.length; i++) {\n var edge = edges[i];\n\n if (!visited.has(edge)) {\n var source = edge.getSource();\n var target = edge.getTarget();\n\n if (source == target) {\n edge.getBendpoints().push(new PointD());\n edge.getBendpoints().push(new PointD());\n this.createDummyNodesForBendpoints(edge);\n visited.add(edge);\n } else {\n var edgeList = [];\n\n edgeList = edgeList.concat(source.getEdgeListToNode(target));\n edgeList = edgeList.concat(target.getEdgeListToNode(source));\n\n if (!visited.has(edgeList[0])) {\n if (edgeList.length > 1) {\n var k;\n for (k = 0; k < edgeList.length; k++) {\n var multiEdge = edgeList[k];\n multiEdge.getBendpoints().push(new PointD());\n this.createDummyNodesForBendpoints(multiEdge);\n }\n }\n edgeList.forEach(function (edge) {\n visited.add(edge);\n });\n }\n }\n }\n\n if (visited.size == edges.length) {\n break;\n }\n }\n};\n\nCoSELayout.prototype.positionNodesRadially = function (forest) {\n // We tile the trees to a grid row by row; first tree starts at (0,0)\n var currentStartingPoint = new Point(0, 0);\n var numberOfColumns = Math.ceil(Math.sqrt(forest.length));\n var height = 0;\n var currentY = 0;\n var currentX = 0;\n var point = new PointD(0, 0);\n\n for (var i = 0; i < forest.length; i++) {\n if (i % numberOfColumns == 0) {\n // Start of a new row, make the x coordinate 0, increment the\n // y coordinate with the max height of the previous row\n currentX = 0;\n currentY = height;\n\n if (i != 0) {\n currentY += CoSEConstants.DEFAULT_COMPONENT_SEPERATION;\n }\n\n height = 0;\n }\n\n var tree = forest[i];\n\n // Find the center of the tree\n var centerNode = Layout.findCenterOfTree(tree);\n\n // Set the staring point of the next tree\n currentStartingPoint.x = currentX;\n currentStartingPoint.y = currentY;\n\n // Do a radial layout starting with the center\n point = CoSELayout.radialLayout(tree, centerNode, currentStartingPoint);\n\n if (point.y > height) {\n height = Math.floor(point.y);\n }\n\n currentX = Math.floor(point.x + CoSEConstants.DEFAULT_COMPONENT_SEPERATION);\n }\n\n this.transform(new PointD(LayoutConstants.WORLD_CENTER_X - point.x / 2, LayoutConstants.WORLD_CENTER_Y - point.y / 2));\n};\n\nCoSELayout.radialLayout = function (tree, centerNode, startingPoint) {\n var radialSep = Math.max(this.maxDiagonalInTree(tree), CoSEConstants.DEFAULT_RADIAL_SEPARATION);\n CoSELayout.branchRadialLayout(centerNode, null, 0, 359, 0, radialSep);\n var bounds = LGraph.calculateBounds(tree);\n\n var transform = new Transform();\n transform.setDeviceOrgX(bounds.getMinX());\n transform.setDeviceOrgY(bounds.getMinY());\n transform.setWorldOrgX(startingPoint.x);\n transform.setWorldOrgY(startingPoint.y);\n\n for (var i = 0; i < tree.length; i++) {\n var node = tree[i];\n node.transform(transform);\n }\n\n var bottomRight = new PointD(bounds.getMaxX(), bounds.getMaxY());\n\n return transform.inverseTransformPoint(bottomRight);\n};\n\nCoSELayout.branchRadialLayout = function (node, parentOfNode, startAngle, endAngle, distance, radialSeparation) {\n // First, position this node by finding its angle.\n var halfInterval = (endAngle - startAngle + 1) / 2;\n\n if (halfInterval < 0) {\n halfInterval += 180;\n }\n\n var nodeAngle = (halfInterval + startAngle) % 360;\n var teta = nodeAngle * IGeometry.TWO_PI / 360;\n\n // Make polar to java cordinate conversion.\n var cos_teta = Math.cos(teta);\n var x_ = distance * Math.cos(teta);\n var y_ = distance * Math.sin(teta);\n\n node.setCenter(x_, y_);\n\n // Traverse all neighbors of this node and recursively call this\n // function.\n var neighborEdges = [];\n neighborEdges = neighborEdges.concat(node.getEdges());\n var childCount = neighborEdges.length;\n\n if (parentOfNode != null) {\n childCount--;\n }\n\n var branchCount = 0;\n\n var incEdgesCount = neighborEdges.length;\n var startIndex;\n\n var edges = node.getEdgesBetween(parentOfNode);\n\n // If there are multiple edges, prune them until there remains only one\n // edge.\n while (edges.length > 1) {\n //neighborEdges.remove(edges.remove(0));\n var temp = edges[0];\n edges.splice(0, 1);\n var index = neighborEdges.indexOf(temp);\n if (index >= 0) {\n neighborEdges.splice(index, 1);\n }\n incEdgesCount--;\n childCount--;\n }\n\n if (parentOfNode != null) {\n //assert edges.length == 1;\n startIndex = (neighborEdges.indexOf(edges[0]) + 1) % incEdgesCount;\n } else {\n startIndex = 0;\n }\n\n var stepAngle = Math.abs(endAngle - startAngle) / childCount;\n\n for (var i = startIndex; branchCount != childCount; i = ++i % incEdgesCount) {\n var currentNeighbor = neighborEdges[i].getOtherEnd(node);\n\n // Don't back traverse to root node in current tree.\n if (currentNeighbor == parentOfNode) {\n continue;\n }\n\n var childStartAngle = (startAngle + branchCount * stepAngle) % 360;\n var childEndAngle = (childStartAngle + stepAngle) % 360;\n\n CoSELayout.branchRadialLayout(currentNeighbor, node, childStartAngle, childEndAngle, distance + radialSeparation, radialSeparation);\n\n branchCount++;\n }\n};\n\nCoSELayout.maxDiagonalInTree = function (tree) {\n var maxDiagonal = Integer.MIN_VALUE;\n\n for (var i = 0; i < tree.length; i++) {\n var node = tree[i];\n var diagonal = node.getDiagonal();\n\n if (diagonal > maxDiagonal) {\n maxDiagonal = diagonal;\n }\n }\n\n return maxDiagonal;\n};\n\nCoSELayout.prototype.calcRepulsionRange = function () {\n // formula is 2 x (level + 1) x idealEdgeLength\n return 2 * (this.level + 1) * this.idealEdgeLength;\n};\n\n// Tiling methods\n\n// Group zero degree members whose parents are not to be tiled, create dummy parents where needed and fill memberGroups by their dummp parent id's\nCoSELayout.prototype.groupZeroDegreeMembers = function () {\n var self = this;\n // array of [parent_id x oneDegreeNode_id]\n var tempMemberGroups = {}; // A temporary map of parent node and its zero degree members\n this.memberGroups = {}; // A map of dummy parent node and its zero degree members whose parents are not to be tiled\n this.idToDummyNode = {}; // A map of id to dummy node \n\n var zeroDegree = []; // List of zero degree nodes whose parents are not to be tiled\n var allNodes = this.graphManager.getAllNodes();\n\n // Fill zero degree list\n for (var i = 0; i < allNodes.length; i++) {\n var node = allNodes[i];\n var parent = node.getParent();\n // If a node has zero degree and its parent is not to be tiled if exists add that node to zeroDegres list\n if (this.getNodeDegreeWithChildren(node) === 0 && (parent.id == undefined || !this.getToBeTiled(parent))) {\n zeroDegree.push(node);\n }\n }\n\n // Create a map of parent node and its zero degree members\n for (var i = 0; i < zeroDegree.length; i++) {\n var node = zeroDegree[i]; // Zero degree node itself\n var p_id = node.getParent().id; // Parent id\n\n if (typeof tempMemberGroups[p_id] === \"undefined\") tempMemberGroups[p_id] = [];\n\n tempMemberGroups[p_id] = tempMemberGroups[p_id].concat(node); // Push node to the list belongs to its parent in tempMemberGroups\n }\n\n // If there are at least two nodes at a level, create a dummy compound for them\n Object.keys(tempMemberGroups).forEach(function (p_id) {\n if (tempMemberGroups[p_id].length > 1) {\n var dummyCompoundId = \"DummyCompound_\" + p_id; // The id of dummy compound which will be created soon\n self.memberGroups[dummyCompoundId] = tempMemberGroups[p_id]; // Add dummy compound to memberGroups\n\n var parent = tempMemberGroups[p_id][0].getParent(); // The parent of zero degree nodes will be the parent of new dummy compound\n\n // Create a dummy compound with calculated id\n var dummyCompound = new CoSENode(self.graphManager);\n dummyCompound.id = dummyCompoundId;\n dummyCompound.paddingLeft = parent.paddingLeft || 0;\n dummyCompound.paddingRight = parent.paddingRight || 0;\n dummyCompound.paddingBottom = parent.paddingBottom || 0;\n dummyCompound.paddingTop = parent.paddingTop || 0;\n\n self.idToDummyNode[dummyCompoundId] = dummyCompound;\n\n var dummyParentGraph = self.getGraphManager().add(self.newGraph(), dummyCompound);\n var parentGraph = parent.getChild();\n\n // Add dummy compound to parent the graph\n parentGraph.add(dummyCompound);\n\n // For each zero degree node in this level remove it from its parent graph and add it to the graph of dummy parent\n for (var i = 0; i < tempMemberGroups[p_id].length; i++) {\n var node = tempMemberGroups[p_id][i];\n\n parentGraph.remove(node);\n dummyParentGraph.add(node);\n }\n }\n });\n};\n\nCoSELayout.prototype.clearCompounds = function () {\n var childGraphMap = {};\n var idToNode = {};\n\n // Get compound ordering by finding the inner one first\n this.performDFSOnCompounds();\n\n for (var i = 0; i < this.compoundOrder.length; i++) {\n\n idToNode[this.compoundOrder[i].id] = this.compoundOrder[i];\n childGraphMap[this.compoundOrder[i].id] = [].concat(this.compoundOrder[i].getChild().getNodes());\n\n // Remove children of compounds\n this.graphManager.remove(this.compoundOrder[i].getChild());\n this.compoundOrder[i].child = null;\n }\n\n this.graphManager.resetAllNodes();\n\n // Tile the removed children\n this.tileCompoundMembers(childGraphMap, idToNode);\n};\n\nCoSELayout.prototype.clearZeroDegreeMembers = function () {\n var self = this;\n var tiledZeroDegreePack = this.tiledZeroDegreePack = [];\n\n Object.keys(this.memberGroups).forEach(function (id) {\n var compoundNode = self.idToDummyNode[id]; // Get the dummy compound\n\n tiledZeroDegreePack[id] = self.tileNodes(self.memberGroups[id], compoundNode.paddingLeft + compoundNode.paddingRight);\n\n // Set the width and height of the dummy compound as calculated\n compoundNode.rect.width = tiledZeroDegreePack[id].width;\n compoundNode.rect.height = tiledZeroDegreePack[id].height;\n compoundNode.setCenter(tiledZeroDegreePack[id].centerX, tiledZeroDegreePack[id].centerY);\n\n // compound left and top margings for labels\n // when node labels are included, these values may be set to different values below and are used in tilingPostLayout,\n // otherwise they stay as zero\n compoundNode.labelMarginLeft = 0;\n compoundNode.labelMarginTop = 0;\n\n // Update compound bounds considering its label properties and set label margins for left and top\n if (CoSEConstants.NODE_DIMENSIONS_INCLUDE_LABELS) {\n\n var width = compoundNode.rect.width;\n var height = compoundNode.rect.height;\n\n if (compoundNode.labelWidth) {\n if (compoundNode.labelPosHorizontal == \"left\") {\n compoundNode.rect.x -= compoundNode.labelWidth;\n compoundNode.setWidth(width + compoundNode.labelWidth);\n compoundNode.labelMarginLeft = compoundNode.labelWidth;\n } else if (compoundNode.labelPosHorizontal == \"center\" && compoundNode.labelWidth > width) {\n compoundNode.rect.x -= (compoundNode.labelWidth - width) / 2;\n compoundNode.setWidth(compoundNode.labelWidth);\n compoundNode.labelMarginLeft = (compoundNode.labelWidth - width) / 2;\n } else if (compoundNode.labelPosHorizontal == \"right\") {\n compoundNode.setWidth(width + compoundNode.labelWidth);\n }\n }\n\n if (compoundNode.labelHeight) {\n if (compoundNode.labelPosVertical == \"top\") {\n compoundNode.rect.y -= compoundNode.labelHeight;\n compoundNode.setHeight(height + compoundNode.labelHeight);\n compoundNode.labelMarginTop = compoundNode.labelHeight;\n } else if (compoundNode.labelPosVertical == \"center\" && compoundNode.labelHeight > height) {\n compoundNode.rect.y -= (compoundNode.labelHeight - height) / 2;\n compoundNode.setHeight(compoundNode.labelHeight);\n compoundNode.labelMarginTop = (compoundNode.labelHeight - height) / 2;\n } else if (compoundNode.labelPosVertical == \"bottom\") {\n compoundNode.setHeight(height + compoundNode.labelHeight);\n }\n }\n }\n });\n};\n\nCoSELayout.prototype.repopulateCompounds = function () {\n for (var i = this.compoundOrder.length - 1; i >= 0; i--) {\n var lCompoundNode = this.compoundOrder[i];\n var id = lCompoundNode.id;\n var horizontalMargin = lCompoundNode.paddingLeft;\n var verticalMargin = lCompoundNode.paddingTop;\n var labelMarginLeft = lCompoundNode.labelMarginLeft;\n var labelMarginTop = lCompoundNode.labelMarginTop;\n\n this.adjustLocations(this.tiledMemberPack[id], lCompoundNode.rect.x, lCompoundNode.rect.y, horizontalMargin, verticalMargin, labelMarginLeft, labelMarginTop);\n }\n};\n\nCoSELayout.prototype.repopulateZeroDegreeMembers = function () {\n var self = this;\n var tiledPack = this.tiledZeroDegreePack;\n\n Object.keys(tiledPack).forEach(function (id) {\n var compoundNode = self.idToDummyNode[id]; // Get the dummy compound by its id\n var horizontalMargin = compoundNode.paddingLeft;\n var verticalMargin = compoundNode.paddingTop;\n var labelMarginLeft = compoundNode.labelMarginLeft;\n var labelMarginTop = compoundNode.labelMarginTop;\n\n // Adjust the positions of nodes wrt its compound\n self.adjustLocations(tiledPack[id], compoundNode.rect.x, compoundNode.rect.y, horizontalMargin, verticalMargin, labelMarginLeft, labelMarginTop);\n });\n};\n\nCoSELayout.prototype.getToBeTiled = function (node) {\n var id = node.id;\n //firstly check the previous results\n if (this.toBeTiled[id] != null) {\n return this.toBeTiled[id];\n }\n\n //only compound nodes are to be tiled\n var childGraph = node.getChild();\n if (childGraph == null) {\n this.toBeTiled[id] = false;\n return false;\n }\n\n var children = childGraph.getNodes(); // Get the children nodes\n\n //a compound node is not to be tiled if all of its compound children are not to be tiled\n for (var i = 0; i < children.length; i++) {\n var theChild = children[i];\n\n if (this.getNodeDegree(theChild) > 0) {\n this.toBeTiled[id] = false;\n return false;\n }\n\n //pass the children not having the compound structure\n if (theChild.getChild() == null) {\n this.toBeTiled[theChild.id] = false;\n continue;\n }\n\n if (!this.getToBeTiled(theChild)) {\n this.toBeTiled[id] = false;\n return false;\n }\n }\n this.toBeTiled[id] = true;\n return true;\n};\n\n// Get degree of a node depending of its edges and independent of its children\nCoSELayout.prototype.getNodeDegree = function (node) {\n var id = node.id;\n var edges = node.getEdges();\n var degree = 0;\n\n // For the edges connected\n for (var i = 0; i < edges.length; i++) {\n var edge = edges[i];\n if (edge.getSource().id !== edge.getTarget().id) {\n degree = degree + 1;\n }\n }\n return degree;\n};\n\n// Get degree of a node with its children\nCoSELayout.prototype.getNodeDegreeWithChildren = function (node) {\n var degree = this.getNodeDegree(node);\n if (node.getChild() == null) {\n return degree;\n }\n var children = node.getChild().getNodes();\n for (var i = 0; i < children.length; i++) {\n var child = children[i];\n degree += this.getNodeDegreeWithChildren(child);\n }\n return degree;\n};\n\nCoSELayout.prototype.performDFSOnCompounds = function () {\n this.compoundOrder = [];\n this.fillCompexOrderByDFS(this.graphManager.getRoot().getNodes());\n};\n\nCoSELayout.prototype.fillCompexOrderByDFS = function (children) {\n for (var i = 0; i < children.length; i++) {\n var child = children[i];\n if (child.getChild() != null) {\n this.fillCompexOrderByDFS(child.getChild().getNodes());\n }\n if (this.getToBeTiled(child)) {\n this.compoundOrder.push(child);\n }\n }\n};\n\n/**\n* This method places each zero degree member wrt given (x,y) coordinates (top left).\n*/\nCoSELayout.prototype.adjustLocations = function (organization, x, y, compoundHorizontalMargin, compoundVerticalMargin, compoundLabelMarginLeft, compoundLabelMarginTop) {\n x += compoundHorizontalMargin + compoundLabelMarginLeft;\n y += compoundVerticalMargin + compoundLabelMarginTop;\n\n var left = x;\n\n for (var i = 0; i < organization.rows.length; i++) {\n var row = organization.rows[i];\n x = left;\n var maxHeight = 0;\n\n for (var j = 0; j < row.length; j++) {\n var lnode = row[j];\n\n lnode.rect.x = x; // + lnode.rect.width / 2;\n lnode.rect.y = y; // + lnode.rect.height / 2;\n\n x += lnode.rect.width + organization.horizontalPadding;\n\n if (lnode.rect.height > maxHeight) maxHeight = lnode.rect.height;\n }\n\n y += maxHeight + organization.verticalPadding;\n }\n};\n\nCoSELayout.prototype.tileCompoundMembers = function (childGraphMap, idToNode) {\n var self = this;\n this.tiledMemberPack = [];\n\n Object.keys(childGraphMap).forEach(function (id) {\n // Get the compound node\n var compoundNode = idToNode[id];\n\n self.tiledMemberPack[id] = self.tileNodes(childGraphMap[id], compoundNode.paddingLeft + compoundNode.paddingRight);\n\n compoundNode.rect.width = self.tiledMemberPack[id].width;\n compoundNode.rect.height = self.tiledMemberPack[id].height;\n compoundNode.setCenter(self.tiledMemberPack[id].centerX, self.tiledMemberPack[id].centerY);\n\n // compound left and top margings for labels\n // when node labels are included, these values may be set to different values below and are used in tilingPostLayout,\n // otherwise they stay as zero\n compoundNode.labelMarginLeft = 0;\n compoundNode.labelMarginTop = 0;\n\n // Update compound bounds considering its label properties and set label margins for left and top\n if (CoSEConstants.NODE_DIMENSIONS_INCLUDE_LABELS) {\n\n var width = compoundNode.rect.width;\n var height = compoundNode.rect.height;\n\n if (compoundNode.labelWidth) {\n if (compoundNode.labelPosHorizontal == \"left\") {\n compoundNode.rect.x -= compoundNode.labelWidth;\n compoundNode.setWidth(width + compoundNode.labelWidth);\n compoundNode.labelMarginLeft = compoundNode.labelWidth;\n } else if (compoundNode.labelPosHorizontal == \"center\" && compoundNode.labelWidth > width) {\n compoundNode.rect.x -= (compoundNode.labelWidth - width) / 2;\n compoundNode.setWidth(compoundNode.labelWidth);\n compoundNode.labelMarginLeft = (compoundNode.labelWidth - width) / 2;\n } else if (compoundNode.labelPosHorizontal == \"right\") {\n compoundNode.setWidth(width + compoundNode.labelWidth);\n }\n }\n\n if (compoundNode.labelHeight) {\n if (compoundNode.labelPosVertical == \"top\") {\n compoundNode.rect.y -= compoundNode.labelHeight;\n compoundNode.setHeight(height + compoundNode.labelHeight);\n compoundNode.labelMarginTop = compoundNode.labelHeight;\n } else if (compoundNode.labelPosVertical == \"center\" && compoundNode.labelHeight > height) {\n compoundNode.rect.y -= (compoundNode.labelHeight - height) / 2;\n compoundNode.setHeight(compoundNode.labelHeight);\n compoundNode.labelMarginTop = (compoundNode.labelHeight - height) / 2;\n } else if (compoundNode.labelPosVertical == \"bottom\") {\n compoundNode.setHeight(height + compoundNode.labelHeight);\n }\n }\n }\n });\n};\n\nCoSELayout.prototype.tileNodes = function (nodes, minWidth) {\n var horizontalOrg = this.tileNodesByFavoringDim(nodes, minWidth, true);\n var verticalOrg = this.tileNodesByFavoringDim(nodes, minWidth, false);\n\n var horizontalRatio = this.getOrgRatio(horizontalOrg);\n var verticalRatio = this.getOrgRatio(verticalOrg);\n var bestOrg;\n\n // the best ratio is the one that is closer to 1 since the ratios are already normalized\n // and the best organization is the one that has the best ratio\n if (verticalRatio < horizontalRatio) {\n bestOrg = verticalOrg;\n } else {\n bestOrg = horizontalOrg;\n }\n\n return bestOrg;\n};\n\n// get the width/height ratio of the organization that is normalized so that it will not be less than 1\nCoSELayout.prototype.getOrgRatio = function (organization) {\n // get dimensions and calculate the initial ratio\n var width = organization.width;\n var height = organization.height;\n var ratio = width / height;\n\n // if the initial ratio is less then 1 then inverse it\n if (ratio < 1) {\n ratio = 1 / ratio;\n }\n\n // return the normalized ratio\n return ratio;\n};\n\n/*\n * Calculates the ideal width for the rows. This method assumes that\n * each node has the same sizes and calculates the ideal row width that\n * approximates a square shaped complex accordingly. However, since nodes would\n * have different sizes some rows would have different sizes and the resulting\n * shape would not be an exact square.\n */\nCoSELayout.prototype.calcIdealRowWidth = function (members, favorHorizontalDim) {\n // To approximate a square shaped complex we need to make complex width equal to complex height.\n // To achieve this we need to solve the following equation system for hc:\n // (x + bx) * hc - bx = (y + by) * vc - by, hc * vc = n\n // where x is the avarage width of the nodes, y is the avarage height of nodes\n // bx and by are the buffer sizes in horizontal and vertical dimensions accordingly,\n // hc and vc are the number of rows in horizontal and vertical dimensions\n // n is number of members.\n\n var verticalPadding = CoSEConstants.TILING_PADDING_VERTICAL;\n var horizontalPadding = CoSEConstants.TILING_PADDING_HORIZONTAL;\n\n // number of members\n var membersSize = members.length;\n\n // sum of the width of all members\n var totalWidth = 0;\n\n // sum of the height of all members\n var totalHeight = 0;\n\n var maxWidth = 0;\n\n // traverse all members to calculate total width and total height and get the maximum members width\n members.forEach(function (node) {\n totalWidth += node.getWidth();\n totalHeight += node.getHeight();\n\n if (node.getWidth() > maxWidth) {\n maxWidth = node.getWidth();\n }\n });\n\n // average width of the members\n var averageWidth = totalWidth / membersSize;\n\n // average height of the members\n var averageHeight = totalHeight / membersSize;\n\n // solving the initial equation system for the hc yields the following second degree equation:\n // hc^2 * (x+bx) + hc * (by - bx) - n * (y + by) = 0\n\n // the delta value to solve the equation above for hc\n var delta = Math.pow(verticalPadding - horizontalPadding, 2) + 4 * (averageWidth + horizontalPadding) * (averageHeight + verticalPadding) * membersSize;\n\n // solve the equation using delta value to calculate the horizontal count\n // that represents the number of nodes in an ideal row\n var horizontalCountDouble = (horizontalPadding - verticalPadding + Math.sqrt(delta)) / (2 * (averageWidth + horizontalPadding));\n // round the calculated horizontal count up or down according to the favored dimension\n var horizontalCount;\n\n if (favorHorizontalDim) {\n horizontalCount = Math.ceil(horizontalCountDouble);\n // if horizontalCount count is not a float value then both of rounding to floor and ceil\n // will yield the same values. Instead of repeating the same calculation try going up\n // while favoring horizontal dimension in such cases\n if (horizontalCount == horizontalCountDouble) {\n horizontalCount++;\n }\n } else {\n horizontalCount = Math.floor(horizontalCountDouble);\n }\n\n // ideal width to be calculated\n var idealWidth = horizontalCount * (averageWidth + horizontalPadding) - horizontalPadding;\n\n // if max width is bigger than calculated ideal width reset ideal width to it\n if (maxWidth > idealWidth) {\n idealWidth = maxWidth;\n }\n\n // add the left-right margins to the ideal row width\n idealWidth += horizontalPadding * 2;\n\n // return the ideal row width1\n return idealWidth;\n};\n\nCoSELayout.prototype.tileNodesByFavoringDim = function (nodes, minWidth, favorHorizontalDim) {\n var verticalPadding = CoSEConstants.TILING_PADDING_VERTICAL;\n var horizontalPadding = CoSEConstants.TILING_PADDING_HORIZONTAL;\n var tilingCompareBy = CoSEConstants.TILING_COMPARE_BY;\n var organization = {\n rows: [],\n rowWidth: [],\n rowHeight: [],\n width: 0,\n height: minWidth, // assume minHeight equals to minWidth\n verticalPadding: verticalPadding,\n horizontalPadding: horizontalPadding,\n centerX: 0,\n centerY: 0\n };\n\n if (tilingCompareBy) {\n organization.idealRowWidth = this.calcIdealRowWidth(nodes, favorHorizontalDim);\n }\n\n var getNodeArea = function getNodeArea(n) {\n return n.rect.width * n.rect.height;\n };\n\n var areaCompareFcn = function areaCompareFcn(n1, n2) {\n return getNodeArea(n2) - getNodeArea(n1);\n };\n\n // Sort the nodes in descending order of their areas\n nodes.sort(function (n1, n2) {\n var cmpBy = areaCompareFcn;\n if (organization.idealRowWidth) {\n cmpBy = tilingCompareBy;\n return cmpBy(n1.id, n2.id);\n }\n return cmpBy(n1, n2);\n });\n\n // Create the organization -> calculate compound center\n var sumCenterX = 0;\n var sumCenterY = 0;\n for (var i = 0; i < nodes.length; i++) {\n var lNode = nodes[i];\n\n sumCenterX += lNode.getCenterX();\n sumCenterY += lNode.getCenterY();\n }\n\n organization.centerX = sumCenterX / nodes.length;\n organization.centerY = sumCenterY / nodes.length;\n\n // Create the organization -> tile members\n for (var i = 0; i < nodes.length; i++) {\n var lNode = nodes[i];\n\n if (organization.rows.length == 0) {\n this.insertNodeToRow(organization, lNode, 0, minWidth);\n } else if (this.canAddHorizontal(organization, lNode.rect.width, lNode.rect.height)) {\n var rowIndex = organization.rows.length - 1;\n if (!organization.idealRowWidth) {\n rowIndex = this.getShortestRowIndex(organization);\n }\n this.insertNodeToRow(organization, lNode, rowIndex, minWidth);\n } else {\n this.insertNodeToRow(organization, lNode, organization.rows.length, minWidth);\n }\n\n this.shiftToLastRow(organization);\n }\n\n return organization;\n};\n\nCoSELayout.prototype.insertNodeToRow = function (organization, node, rowIndex, minWidth) {\n var minCompoundSize = minWidth;\n\n // Add new row if needed\n if (rowIndex == organization.rows.length) {\n var secondDimension = [];\n\n organization.rows.push(secondDimension);\n organization.rowWidth.push(minCompoundSize);\n organization.rowHeight.push(0);\n }\n\n // Update row width\n var w = organization.rowWidth[rowIndex] + node.rect.width;\n\n if (organization.rows[rowIndex].length > 0) {\n w += organization.horizontalPadding;\n }\n\n organization.rowWidth[rowIndex] = w;\n // Update compound width\n if (organization.width < w) {\n organization.width = w;\n }\n\n // Update height\n var h = node.rect.height;\n if (rowIndex > 0) h += organization.verticalPadding;\n\n var extraHeight = 0;\n if (h > organization.rowHeight[rowIndex]) {\n extraHeight = organization.rowHeight[rowIndex];\n organization.rowHeight[rowIndex] = h;\n extraHeight = organization.rowHeight[rowIndex] - extraHeight;\n }\n\n organization.height += extraHeight;\n\n // Insert node\n organization.rows[rowIndex].push(node);\n};\n\n//Scans the rows of an organization and returns the one with the min width\nCoSELayout.prototype.getShortestRowIndex = function (organization) {\n var r = -1;\n var min = Number.MAX_VALUE;\n\n for (var i = 0; i < organization.rows.length; i++) {\n if (organization.rowWidth[i] < min) {\n r = i;\n min = organization.rowWidth[i];\n }\n }\n return r;\n};\n\n//Scans the rows of an organization and returns the one with the max width\nCoSELayout.prototype.getLongestRowIndex = function (organization) {\n var r = -1;\n var max = Number.MIN_VALUE;\n\n for (var i = 0; i < organization.rows.length; i++) {\n\n if (organization.rowWidth[i] > max) {\n r = i;\n max = organization.rowWidth[i];\n }\n }\n\n return r;\n};\n\n/**\n* This method checks whether adding extra width to the organization violates\n* the aspect ratio(1) or not.\n*/\nCoSELayout.prototype.canAddHorizontal = function (organization, extraWidth, extraHeight) {\n\n // if there is an ideal row width specified use it instead of checking the aspect ratio\n if (organization.idealRowWidth) {\n var lastRowIndex = organization.rows.length - 1;\n var lastRowWidth = organization.rowWidth[lastRowIndex];\n\n // check and return if ideal row width will be exceed if the node is added to the row\n return lastRowWidth + extraWidth + organization.horizontalPadding <= organization.idealRowWidth;\n }\n\n var sri = this.getShortestRowIndex(organization);\n\n if (sri < 0) {\n return true;\n }\n\n var min = organization.rowWidth[sri];\n\n if (min + organization.horizontalPadding + extraWidth <= organization.width) return true;\n\n var hDiff = 0;\n\n // Adding to an existing row\n if (organization.rowHeight[sri] < extraHeight) {\n if (sri > 0) hDiff = extraHeight + organization.verticalPadding - organization.rowHeight[sri];\n }\n\n var add_to_row_ratio;\n if (organization.width - min >= extraWidth + organization.horizontalPadding) {\n add_to_row_ratio = (organization.height + hDiff) / (min + extraWidth + organization.horizontalPadding);\n } else {\n add_to_row_ratio = (organization.height + hDiff) / organization.width;\n }\n\n // Adding a new row for this node\n hDiff = extraHeight + organization.verticalPadding;\n var add_new_row_ratio;\n if (organization.width < extraWidth) {\n add_new_row_ratio = (organization.height + hDiff) / extraWidth;\n } else {\n add_new_row_ratio = (organization.height + hDiff) / organization.width;\n }\n\n if (add_new_row_ratio < 1) add_new_row_ratio = 1 / add_new_row_ratio;\n\n if (add_to_row_ratio < 1) add_to_row_ratio = 1 / add_to_row_ratio;\n\n return add_to_row_ratio < add_new_row_ratio;\n};\n\n//If moving the last node from the longest row and adding it to the last\n//row makes the bounding box smaller, do it.\nCoSELayout.prototype.shiftToLastRow = function (organization) {\n var longest = this.getLongestRowIndex(organization);\n var last = organization.rowWidth.length - 1;\n var row = organization.rows[longest];\n var node = row[row.length - 1];\n\n var diff = node.width + organization.horizontalPadding;\n\n // Check if there is enough space on the last row\n if (organization.width - organization.rowWidth[last] > diff && longest != last) {\n // Remove the last element of the longest row\n row.splice(-1, 1);\n\n // Push it to the last row\n organization.rows[last].push(node);\n\n organization.rowWidth[longest] = organization.rowWidth[longest] - diff;\n organization.rowWidth[last] = organization.rowWidth[last] + diff;\n organization.width = organization.rowWidth[instance.getLongestRowIndex(organization)];\n\n // Update heights of the organization\n var maxHeight = Number.MIN_VALUE;\n for (var i = 0; i < row.length; i++) {\n if (row[i].height > maxHeight) maxHeight = row[i].height;\n }\n if (longest > 0) maxHeight += organization.verticalPadding;\n\n var prevTotal = organization.rowHeight[longest] + organization.rowHeight[last];\n\n organization.rowHeight[longest] = maxHeight;\n if (organization.rowHeight[last] < node.height + organization.verticalPadding) organization.rowHeight[last] = node.height + organization.verticalPadding;\n\n var finalTotal = organization.rowHeight[longest] + organization.rowHeight[last];\n organization.height += finalTotal - prevTotal;\n\n this.shiftToLastRow(organization);\n }\n};\n\nCoSELayout.prototype.tilingPreLayout = function () {\n if (CoSEConstants.TILE) {\n // Find zero degree nodes and create a compound for each level\n this.groupZeroDegreeMembers();\n // Tile and clear children of each compound\n this.clearCompounds();\n // Separately tile and clear zero degree nodes for each level\n this.clearZeroDegreeMembers();\n }\n};\n\nCoSELayout.prototype.tilingPostLayout = function () {\n if (CoSEConstants.TILE) {\n this.repopulateZeroDegreeMembers();\n this.repopulateCompounds();\n }\n};\n\n// -----------------------------------------------------------------------------\n// Section: Tree Reduction methods\n// -----------------------------------------------------------------------------\n// Reduce trees \nCoSELayout.prototype.reduceTrees = function () {\n var prunedNodesAll = [];\n var containsLeaf = true;\n var node;\n\n while (containsLeaf) {\n var allNodes = this.graphManager.getAllNodes();\n var prunedNodesInStepTemp = [];\n containsLeaf = false;\n\n for (var i = 0; i < allNodes.length; i++) {\n node = allNodes[i];\n if (node.getEdges().length == 1 && !node.getEdges()[0].isInterGraph && node.getChild() == null) {\n if (CoSEConstants.PURE_INCREMENTAL) {\n var otherEnd = node.getEdges()[0].getOtherEnd(node);\n var relativePosition = new DimensionD(node.getCenterX() - otherEnd.getCenterX(), node.getCenterY() - otherEnd.getCenterY());\n prunedNodesInStepTemp.push([node, node.getEdges()[0], node.getOwner(), relativePosition]);\n } else {\n prunedNodesInStepTemp.push([node, node.getEdges()[0], node.getOwner()]);\n }\n containsLeaf = true;\n }\n }\n if (containsLeaf == true) {\n var prunedNodesInStep = [];\n for (var j = 0; j < prunedNodesInStepTemp.length; j++) {\n if (prunedNodesInStepTemp[j][0].getEdges().length == 1) {\n prunedNodesInStep.push(prunedNodesInStepTemp[j]);\n prunedNodesInStepTemp[j][0].getOwner().remove(prunedNodesInStepTemp[j][0]);\n }\n }\n prunedNodesAll.push(prunedNodesInStep);\n this.graphManager.resetAllNodes();\n this.graphManager.resetAllEdges();\n }\n }\n this.prunedNodesAll = prunedNodesAll;\n};\n\n// Grow tree one step \nCoSELayout.prototype.growTree = function (prunedNodesAll) {\n var lengthOfPrunedNodesInStep = prunedNodesAll.length;\n var prunedNodesInStep = prunedNodesAll[lengthOfPrunedNodesInStep - 1];\n\n var nodeData;\n for (var i = 0; i < prunedNodesInStep.length; i++) {\n nodeData = prunedNodesInStep[i];\n\n this.findPlaceforPrunedNode(nodeData);\n\n nodeData[2].add(nodeData[0]);\n nodeData[2].add(nodeData[1], nodeData[1].source, nodeData[1].target);\n }\n\n prunedNodesAll.splice(prunedNodesAll.length - 1, 1);\n this.graphManager.resetAllNodes();\n this.graphManager.resetAllEdges();\n};\n\n// Find an appropriate position to replace pruned node, this method can be improved\nCoSELayout.prototype.findPlaceforPrunedNode = function (nodeData) {\n\n var gridForPrunedNode;\n var nodeToConnect;\n var prunedNode = nodeData[0];\n if (prunedNode == nodeData[1].source) {\n nodeToConnect = nodeData[1].target;\n } else {\n nodeToConnect = nodeData[1].source;\n }\n\n if (CoSEConstants.PURE_INCREMENTAL) {\n prunedNode.setCenter(nodeToConnect.getCenterX() + nodeData[3].getWidth(), nodeToConnect.getCenterY() + nodeData[3].getHeight());\n } else {\n var startGridX = nodeToConnect.startX;\n var finishGridX = nodeToConnect.finishX;\n var startGridY = nodeToConnect.startY;\n var finishGridY = nodeToConnect.finishY;\n\n var upNodeCount = 0;\n var downNodeCount = 0;\n var rightNodeCount = 0;\n var leftNodeCount = 0;\n var controlRegions = [upNodeCount, rightNodeCount, downNodeCount, leftNodeCount];\n\n if (startGridY > 0) {\n for (var i = startGridX; i <= finishGridX; i++) {\n controlRegions[0] += this.grid[i][startGridY - 1].length + this.grid[i][startGridY].length - 1;\n }\n }\n if (finishGridX < this.grid.length - 1) {\n for (var i = startGridY; i <= finishGridY; i++) {\n controlRegions[1] += this.grid[finishGridX + 1][i].length + this.grid[finishGridX][i].length - 1;\n }\n }\n if (finishGridY < this.grid[0].length - 1) {\n for (var i = startGridX; i <= finishGridX; i++) {\n controlRegions[2] += this.grid[i][finishGridY + 1].length + this.grid[i][finishGridY].length - 1;\n }\n }\n if (startGridX > 0) {\n for (var i = startGridY; i <= finishGridY; i++) {\n controlRegions[3] += this.grid[startGridX - 1][i].length + this.grid[startGridX][i].length - 1;\n }\n }\n var min = Integer.MAX_VALUE;\n var minCount;\n var minIndex;\n for (var j = 0; j < controlRegions.length; j++) {\n if (controlRegions[j] < min) {\n min = controlRegions[j];\n minCount = 1;\n minIndex = j;\n } else if (controlRegions[j] == min) {\n minCount++;\n }\n }\n\n if (minCount == 3 && min == 0) {\n if (controlRegions[0] == 0 && controlRegions[1] == 0 && controlRegions[2] == 0) {\n gridForPrunedNode = 1;\n } else if (controlRegions[0] == 0 && controlRegions[1] == 0 && controlRegions[3] == 0) {\n gridForPrunedNode = 0;\n } else if (controlRegions[0] == 0 && controlRegions[2] == 0 && controlRegions[3] == 0) {\n gridForPrunedNode = 3;\n } else if (controlRegions[1] == 0 && controlRegions[2] == 0 && controlRegions[3] == 0) {\n gridForPrunedNode = 2;\n }\n } else if (minCount == 2 && min == 0) {\n var random = Math.floor(Math.random() * 2);\n if (controlRegions[0] == 0 && controlRegions[1] == 0) {\n ;\n if (random == 0) {\n gridForPrunedNode = 0;\n } else {\n gridForPrunedNode = 1;\n }\n } else if (controlRegions[0] == 0 && controlRegions[2] == 0) {\n if (random == 0) {\n gridForPrunedNode = 0;\n } else {\n gridForPrunedNode = 2;\n }\n } else if (controlRegions[0] == 0 && controlRegions[3] == 0) {\n if (random == 0) {\n gridForPrunedNode = 0;\n } else {\n gridForPrunedNode = 3;\n }\n } else if (controlRegions[1] == 0 && controlRegions[2] == 0) {\n if (random == 0) {\n gridForPrunedNode = 1;\n } else {\n gridForPrunedNode = 2;\n }\n } else if (controlRegions[1] == 0 && controlRegions[3] == 0) {\n if (random == 0) {\n gridForPrunedNode = 1;\n } else {\n gridForPrunedNode = 3;\n }\n } else {\n if (random == 0) {\n gridForPrunedNode = 2;\n } else {\n gridForPrunedNode = 3;\n }\n }\n } else if (minCount == 4 && min == 0) {\n var random = Math.floor(Math.random() * 4);\n gridForPrunedNode = random;\n } else {\n gridForPrunedNode = minIndex;\n }\n\n if (gridForPrunedNode == 0) {\n prunedNode.setCenter(nodeToConnect.getCenterX(), nodeToConnect.getCenterY() - nodeToConnect.getHeight() / 2 - FDLayoutConstants.DEFAULT_EDGE_LENGTH - prunedNode.getHeight() / 2);\n } else if (gridForPrunedNode == 1) {\n prunedNode.setCenter(nodeToConnect.getCenterX() + nodeToConnect.getWidth() / 2 + FDLayoutConstants.DEFAULT_EDGE_LENGTH + prunedNode.getWidth() / 2, nodeToConnect.getCenterY());\n } else if (gridForPrunedNode == 2) {\n prunedNode.setCenter(nodeToConnect.getCenterX(), nodeToConnect.getCenterY() + nodeToConnect.getHeight() / 2 + FDLayoutConstants.DEFAULT_EDGE_LENGTH + prunedNode.getHeight() / 2);\n } else {\n prunedNode.setCenter(nodeToConnect.getCenterX() - nodeToConnect.getWidth() / 2 - FDLayoutConstants.DEFAULT_EDGE_LENGTH - prunedNode.getWidth() / 2, nodeToConnect.getCenterY());\n }\n }\n};\n\nmodule.exports = CoSELayout;\n\n/***/ }),\n\n/***/ 991:\n/***/ ((module, __unused_webpack_exports, __webpack_require__) => {\n\n\n\nvar FDLayoutNode = __webpack_require__(551).FDLayoutNode;\nvar IMath = __webpack_require__(551).IMath;\n\nfunction CoSENode(gm, loc, size, vNode) {\n FDLayoutNode.call(this, gm, loc, size, vNode);\n}\n\nCoSENode.prototype = Object.create(FDLayoutNode.prototype);\nfor (var prop in FDLayoutNode) {\n CoSENode[prop] = FDLayoutNode[prop];\n}\n\nCoSENode.prototype.calculateDisplacement = function () {\n var layout = this.graphManager.getLayout();\n // this check is for compound nodes that contain fixed nodes\n if (this.getChild() != null && this.fixedNodeWeight) {\n this.displacementX += layout.coolingFactor * (this.springForceX + this.repulsionForceX + this.gravitationForceX) / this.fixedNodeWeight;\n this.displacementY += layout.coolingFactor * (this.springForceY + this.repulsionForceY + this.gravitationForceY) / this.fixedNodeWeight;\n } else {\n this.displacementX += layout.coolingFactor * (this.springForceX + this.repulsionForceX + this.gravitationForceX) / this.noOfChildren;\n this.displacementY += layout.coolingFactor * (this.springForceY + this.repulsionForceY + this.gravitationForceY) / this.noOfChildren;\n }\n\n if (Math.abs(this.displacementX) > layout.coolingFactor * layout.maxNodeDisplacement) {\n this.displacementX = layout.coolingFactor * layout.maxNodeDisplacement * IMath.sign(this.displacementX);\n }\n\n if (Math.abs(this.displacementY) > layout.coolingFactor * layout.maxNodeDisplacement) {\n this.displacementY = layout.coolingFactor * layout.maxNodeDisplacement * IMath.sign(this.displacementY);\n }\n\n // non-empty compound node, propogate movement to children as well\n if (this.child && this.child.getNodes().length > 0) {\n this.propogateDisplacementToChildren(this.displacementX, this.displacementY);\n }\n};\n\nCoSENode.prototype.propogateDisplacementToChildren = function (dX, dY) {\n var nodes = this.getChild().getNodes();\n var node;\n for (var i = 0; i < nodes.length; i++) {\n node = nodes[i];\n if (node.getChild() == null) {\n node.displacementX += dX;\n node.displacementY += dY;\n } else {\n node.propogateDisplacementToChildren(dX, dY);\n }\n }\n};\n\nCoSENode.prototype.move = function () {\n var layout = this.graphManager.getLayout();\n\n // a simple node or an empty compound node, move it\n if (this.child == null || this.child.getNodes().length == 0) {\n this.moveBy(this.displacementX, this.displacementY);\n\n layout.totalDisplacement += Math.abs(this.displacementX) + Math.abs(this.displacementY);\n }\n\n this.springForceX = 0;\n this.springForceY = 0;\n this.repulsionForceX = 0;\n this.repulsionForceY = 0;\n this.gravitationForceX = 0;\n this.gravitationForceY = 0;\n this.displacementX = 0;\n this.displacementY = 0;\n};\n\nCoSENode.prototype.setPred1 = function (pred1) {\n this.pred1 = pred1;\n};\n\nCoSENode.prototype.getPred1 = function () {\n return pred1;\n};\n\nCoSENode.prototype.getPred2 = function () {\n return pred2;\n};\n\nCoSENode.prototype.setNext = function (next) {\n this.next = next;\n};\n\nCoSENode.prototype.getNext = function () {\n return next;\n};\n\nCoSENode.prototype.setProcessed = function (processed) {\n this.processed = processed;\n};\n\nCoSENode.prototype.isProcessed = function () {\n return processed;\n};\n\nmodule.exports = CoSENode;\n\n/***/ }),\n\n/***/ 902:\n/***/ ((module, __unused_webpack_exports, __webpack_require__) => {\n\n\n\nfunction _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }\n\nvar CoSEConstants = __webpack_require__(806);\nvar LinkedList = __webpack_require__(551).LinkedList;\nvar Matrix = __webpack_require__(551).Matrix;\nvar SVD = __webpack_require__(551).SVD;\n\nfunction ConstraintHandler() {}\n\nConstraintHandler.handleConstraints = function (layout) {\n // let layout = this.graphManager.getLayout();\n\n // get constraints from layout\n var constraints = {};\n constraints.fixedNodeConstraint = layout.constraints.fixedNodeConstraint;\n constraints.alignmentConstraint = layout.constraints.alignmentConstraint;\n constraints.relativePlacementConstraint = layout.constraints.relativePlacementConstraint;\n\n var idToNodeMap = new Map();\n var nodeIndexes = new Map();\n var xCoords = [];\n var yCoords = [];\n\n var allNodes = layout.getAllNodes();\n var index = 0;\n // fill index map and coordinates\n for (var i = 0; i < allNodes.length; i++) {\n var node = allNodes[i];\n if (node.getChild() == null) {\n nodeIndexes.set(node.id, index++);\n xCoords.push(node.getCenterX());\n yCoords.push(node.getCenterY());\n idToNodeMap.set(node.id, node);\n }\n }\n\n // if there exists relative placement constraint without gap value, set it to default \n if (constraints.relativePlacementConstraint) {\n constraints.relativePlacementConstraint.forEach(function (constraint) {\n if (!constraint.gap && constraint.gap != 0) {\n if (constraint.left) {\n constraint.gap = CoSEConstants.DEFAULT_EDGE_LENGTH + idToNodeMap.get(constraint.left).getWidth() / 2 + idToNodeMap.get(constraint.right).getWidth() / 2;\n } else {\n constraint.gap = CoSEConstants.DEFAULT_EDGE_LENGTH + idToNodeMap.get(constraint.top).getHeight() / 2 + idToNodeMap.get(constraint.bottom).getHeight() / 2;\n }\n }\n });\n }\n\n /* auxiliary functions */\n\n // calculate difference between two position objects\n var calculatePositionDiff = function calculatePositionDiff(pos1, pos2) {\n return { x: pos1.x - pos2.x, y: pos1.y - pos2.y };\n };\n\n // calculate average position of the nodes\n var calculateAvgPosition = function calculateAvgPosition(nodeIdSet) {\n var xPosSum = 0;\n var yPosSum = 0;\n nodeIdSet.forEach(function (nodeId) {\n xPosSum += xCoords[nodeIndexes.get(nodeId)];\n yPosSum += yCoords[nodeIndexes.get(nodeId)];\n });\n\n return { x: xPosSum / nodeIdSet.size, y: yPosSum / nodeIdSet.size };\n };\n\n // find an appropriate positioning for the nodes in a given graph according to relative placement constraints\n // this function also takes the fixed nodes and alignment constraints into account\n // graph: dag to be evaluated, direction: \"horizontal\" or \"vertical\", \n // fixedNodes: set of fixed nodes to consider during evaluation, dummyPositions: appropriate coordinates of the dummy nodes \n var findAppropriatePositionForRelativePlacement = function findAppropriatePositionForRelativePlacement(graph, direction, fixedNodes, dummyPositions, componentSources) {\n\n // find union of two sets\n function setUnion(setA, setB) {\n var union = new Set(setA);\n var _iteratorNormalCompletion = true;\n var _didIteratorError = false;\n var _iteratorError = undefined;\n\n try {\n for (var _iterator = setB[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n var elem = _step.value;\n\n union.add(elem);\n }\n } catch (err) {\n _didIteratorError = true;\n _iteratorError = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion && _iterator.return) {\n _iterator.return();\n }\n } finally {\n if (_didIteratorError) {\n throw _iteratorError;\n }\n }\n }\n\n return union;\n }\n\n // find indegree count for each node\n var inDegrees = new Map();\n\n graph.forEach(function (value, key) {\n inDegrees.set(key, 0);\n });\n graph.forEach(function (value, key) {\n value.forEach(function (adjacent) {\n inDegrees.set(adjacent.id, inDegrees.get(adjacent.id) + 1);\n });\n });\n\n var positionMap = new Map(); // keeps the position for each node\n var pastMap = new Map(); // keeps the predecessors(past) of a node\n var queue = new LinkedList();\n inDegrees.forEach(function (value, key) {\n if (value == 0) {\n queue.push(key);\n if (!fixedNodes) {\n if (direction == \"horizontal\") {\n positionMap.set(key, nodeIndexes.has(key) ? xCoords[nodeIndexes.get(key)] : dummyPositions.get(key));\n } else {\n positionMap.set(key, nodeIndexes.has(key) ? yCoords[nodeIndexes.get(key)] : dummyPositions.get(key));\n }\n }\n } else {\n positionMap.set(key, Number.NEGATIVE_INFINITY);\n }\n if (fixedNodes) {\n pastMap.set(key, new Set([key]));\n }\n });\n\n // align sources of each component in enforcement phase\n if (fixedNodes) {\n componentSources.forEach(function (component) {\n var fixedIds = [];\n component.forEach(function (nodeId) {\n if (fixedNodes.has(nodeId)) {\n fixedIds.push(nodeId);\n }\n });\n if (fixedIds.length > 0) {\n var position = 0;\n fixedIds.forEach(function (fixedId) {\n if (direction == \"horizontal\") {\n positionMap.set(fixedId, nodeIndexes.has(fixedId) ? xCoords[nodeIndexes.get(fixedId)] : dummyPositions.get(fixedId));\n position += positionMap.get(fixedId);\n } else {\n positionMap.set(fixedId, nodeIndexes.has(fixedId) ? yCoords[nodeIndexes.get(fixedId)] : dummyPositions.get(fixedId));\n position += positionMap.get(fixedId);\n }\n });\n position = position / fixedIds.length;\n component.forEach(function (nodeId) {\n if (!fixedNodes.has(nodeId)) {\n positionMap.set(nodeId, position);\n }\n });\n } else {\n var _position = 0;\n component.forEach(function (nodeId) {\n if (direction == \"horizontal\") {\n _position += nodeIndexes.has(nodeId) ? xCoords[nodeIndexes.get(nodeId)] : dummyPositions.get(nodeId);\n } else {\n _position += nodeIndexes.has(nodeId) ? yCoords[nodeIndexes.get(nodeId)] : dummyPositions.get(nodeId);\n }\n });\n _position = _position / component.length;\n component.forEach(function (nodeId) {\n positionMap.set(nodeId, _position);\n });\n }\n });\n }\n\n // calculate positions of the nodes\n\n var _loop = function _loop() {\n var currentNode = queue.shift();\n var neighbors = graph.get(currentNode);\n neighbors.forEach(function (neighbor) {\n if (positionMap.get(neighbor.id) < positionMap.get(currentNode) + neighbor.gap) {\n if (fixedNodes && fixedNodes.has(neighbor.id)) {\n var fixedPosition = void 0;\n if (direction == \"horizontal\") {\n fixedPosition = nodeIndexes.has(neighbor.id) ? xCoords[nodeIndexes.get(neighbor.id)] : dummyPositions.get(neighbor.id);\n } else {\n fixedPosition = nodeIndexes.has(neighbor.id) ? yCoords[nodeIndexes.get(neighbor.id)] : dummyPositions.get(neighbor.id);\n }\n positionMap.set(neighbor.id, fixedPosition); // TODO: may do unnecessary work\n if (fixedPosition < positionMap.get(currentNode) + neighbor.gap) {\n var diff = positionMap.get(currentNode) + neighbor.gap - fixedPosition;\n pastMap.get(currentNode).forEach(function (nodeId) {\n positionMap.set(nodeId, positionMap.get(nodeId) - diff);\n });\n }\n } else {\n positionMap.set(neighbor.id, positionMap.get(currentNode) + neighbor.gap);\n }\n }\n inDegrees.set(neighbor.id, inDegrees.get(neighbor.id) - 1);\n if (inDegrees.get(neighbor.id) == 0) {\n queue.push(neighbor.id);\n }\n if (fixedNodes) {\n pastMap.set(neighbor.id, setUnion(pastMap.get(currentNode), pastMap.get(neighbor.id)));\n }\n });\n };\n\n while (queue.length != 0) {\n _loop();\n }\n\n // readjust position of the nodes after enforcement\n if (fixedNodes) {\n // find indegree count for each node\n var sinkNodes = new Set();\n\n graph.forEach(function (value, key) {\n if (value.length == 0) {\n sinkNodes.add(key);\n }\n });\n\n var _components = [];\n pastMap.forEach(function (value, key) {\n if (sinkNodes.has(key)) {\n var isFixedComponent = false;\n var _iteratorNormalCompletion2 = true;\n var _didIteratorError2 = false;\n var _iteratorError2 = undefined;\n\n try {\n for (var _iterator2 = value[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {\n var nodeId = _step2.value;\n\n if (fixedNodes.has(nodeId)) {\n isFixedComponent = true;\n }\n }\n } catch (err) {\n _didIteratorError2 = true;\n _iteratorError2 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion2 && _iterator2.return) {\n _iterator2.return();\n }\n } finally {\n if (_didIteratorError2) {\n throw _iteratorError2;\n }\n }\n }\n\n if (!isFixedComponent) {\n var isExist = false;\n var existAt = void 0;\n _components.forEach(function (component, index) {\n if (component.has([].concat(_toConsumableArray(value))[0])) {\n isExist = true;\n existAt = index;\n }\n });\n if (!isExist) {\n _components.push(new Set(value));\n } else {\n value.forEach(function (ele) {\n _components[existAt].add(ele);\n });\n }\n }\n }\n });\n\n _components.forEach(function (component, index) {\n var minBefore = Number.POSITIVE_INFINITY;\n var minAfter = Number.POSITIVE_INFINITY;\n var maxBefore = Number.NEGATIVE_INFINITY;\n var maxAfter = Number.NEGATIVE_INFINITY;\n\n var _iteratorNormalCompletion3 = true;\n var _didIteratorError3 = false;\n var _iteratorError3 = undefined;\n\n try {\n for (var _iterator3 = component[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {\n var nodeId = _step3.value;\n\n var posBefore = void 0;\n if (direction == \"horizontal\") {\n posBefore = nodeIndexes.has(nodeId) ? xCoords[nodeIndexes.get(nodeId)] : dummyPositions.get(nodeId);\n } else {\n posBefore = nodeIndexes.has(nodeId) ? yCoords[nodeIndexes.get(nodeId)] : dummyPositions.get(nodeId);\n }\n var posAfter = positionMap.get(nodeId);\n if (posBefore < minBefore) {\n minBefore = posBefore;\n }\n if (posBefore > maxBefore) {\n maxBefore = posBefore;\n }\n if (posAfter < minAfter) {\n minAfter = posAfter;\n }\n if (posAfter > maxAfter) {\n maxAfter = posAfter;\n }\n }\n } catch (err) {\n _didIteratorError3 = true;\n _iteratorError3 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion3 && _iterator3.return) {\n _iterator3.return();\n }\n } finally {\n if (_didIteratorError3) {\n throw _iteratorError3;\n }\n }\n }\n\n var diff = (minBefore + maxBefore) / 2 - (minAfter + maxAfter) / 2;\n\n var _iteratorNormalCompletion4 = true;\n var _didIteratorError4 = false;\n var _iteratorError4 = undefined;\n\n try {\n for (var _iterator4 = component[Symbol.iterator](), _step4; !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = true) {\n var _nodeId = _step4.value;\n\n positionMap.set(_nodeId, positionMap.get(_nodeId) + diff);\n }\n } catch (err) {\n _didIteratorError4 = true;\n _iteratorError4 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion4 && _iterator4.return) {\n _iterator4.return();\n }\n } finally {\n if (_didIteratorError4) {\n throw _iteratorError4;\n }\n }\n }\n });\n }\n\n return positionMap;\n };\n\n // find transformation based on rel. placement constraints if there are both alignment and rel. placement constraints\n // or if there are only rel. placement contraints where the largest component isn't sufficiently large\n var applyReflectionForRelativePlacement = function applyReflectionForRelativePlacement(relativePlacementConstraints) {\n // variables to count votes\n var reflectOnY = 0,\n notReflectOnY = 0;\n var reflectOnX = 0,\n notReflectOnX = 0;\n\n relativePlacementConstraints.forEach(function (constraint) {\n if (constraint.left) {\n xCoords[nodeIndexes.get(constraint.left)] - xCoords[nodeIndexes.get(constraint.right)] >= 0 ? reflectOnY++ : notReflectOnY++;\n } else {\n yCoords[nodeIndexes.get(constraint.top)] - yCoords[nodeIndexes.get(constraint.bottom)] >= 0 ? reflectOnX++ : notReflectOnX++;\n }\n });\n\n if (reflectOnY > notReflectOnY && reflectOnX > notReflectOnX) {\n for (var _i = 0; _i < nodeIndexes.size; _i++) {\n xCoords[_i] = -1 * xCoords[_i];\n yCoords[_i] = -1 * yCoords[_i];\n }\n } else if (reflectOnY > notReflectOnY) {\n for (var _i2 = 0; _i2 < nodeIndexes.size; _i2++) {\n xCoords[_i2] = -1 * xCoords[_i2];\n }\n } else if (reflectOnX > notReflectOnX) {\n for (var _i3 = 0; _i3 < nodeIndexes.size; _i3++) {\n yCoords[_i3] = -1 * yCoords[_i3];\n }\n }\n };\n\n // find weakly connected components in undirected graph\n var findComponents = function findComponents(graph) {\n // find weakly connected components in dag\n var components = [];\n var queue = new LinkedList();\n var visited = new Set();\n var count = 0;\n\n graph.forEach(function (value, key) {\n if (!visited.has(key)) {\n components[count] = [];\n var _currentNode = key;\n queue.push(_currentNode);\n visited.add(_currentNode);\n components[count].push(_currentNode);\n\n while (queue.length != 0) {\n _currentNode = queue.shift();\n var neighbors = graph.get(_currentNode);\n neighbors.forEach(function (neighbor) {\n if (!visited.has(neighbor.id)) {\n queue.push(neighbor.id);\n visited.add(neighbor.id);\n components[count].push(neighbor.id);\n }\n });\n }\n count++;\n }\n });\n return components;\n };\n\n // return undirected version of given dag\n var dagToUndirected = function dagToUndirected(dag) {\n var undirected = new Map();\n\n dag.forEach(function (value, key) {\n undirected.set(key, []);\n });\n\n dag.forEach(function (value, key) {\n value.forEach(function (adjacent) {\n undirected.get(key).push(adjacent);\n undirected.get(adjacent.id).push({ id: key, gap: adjacent.gap, direction: adjacent.direction });\n });\n });\n\n return undirected;\n };\n\n // return reversed (directions inverted) version of given dag\n var dagToReversed = function dagToReversed(dag) {\n var reversed = new Map();\n\n dag.forEach(function (value, key) {\n reversed.set(key, []);\n });\n\n dag.forEach(function (value, key) {\n value.forEach(function (adjacent) {\n reversed.get(adjacent.id).push({ id: key, gap: adjacent.gap, direction: adjacent.direction });\n });\n });\n\n return reversed;\n };\n\n /**** apply transformation to the initial draft layout to better align with constrained nodes ****/\n // solve the Orthogonal Procrustean Problem to rotate and/or reflect initial draft layout\n // here we follow the solution in Chapter 20.2 of Borg, I. & Groenen, P. (2005) Modern Multidimensional Scaling: Theory and Applications \n\n /* construct source and target configurations */\n\n var targetMatrix = []; // A - target configuration\n var sourceMatrix = []; // B - source configuration \n var standardTransformation = false; // false for no transformation, true for standart (Procrustes) transformation (rotation and/or reflection)\n var reflectionType = false; // false/true for reflection check, 'reflectOnX', 'reflectOnY' or 'reflectOnBoth' for reflection type if necessary\n var fixedNodes = new Set();\n var dag = new Map(); // adjacency list to keep directed acyclic graph (dag) that consists of relative placement constraints\n var dagUndirected = new Map(); // undirected version of the dag\n var components = []; // weakly connected components\n\n // fill fixedNodes collection to use later\n if (constraints.fixedNodeConstraint) {\n constraints.fixedNodeConstraint.forEach(function (nodeData) {\n fixedNodes.add(nodeData.nodeId);\n });\n }\n\n // construct dag from relative placement constraints \n if (constraints.relativePlacementConstraint) {\n // construct both directed and undirected version of the dag\n constraints.relativePlacementConstraint.forEach(function (constraint) {\n if (constraint.left) {\n if (dag.has(constraint.left)) {\n dag.get(constraint.left).push({ id: constraint.right, gap: constraint.gap, direction: \"horizontal\" });\n } else {\n dag.set(constraint.left, [{ id: constraint.right, gap: constraint.gap, direction: \"horizontal\" }]);\n }\n if (!dag.has(constraint.right)) {\n dag.set(constraint.right, []);\n }\n } else {\n if (dag.has(constraint.top)) {\n dag.get(constraint.top).push({ id: constraint.bottom, gap: constraint.gap, direction: \"vertical\" });\n } else {\n dag.set(constraint.top, [{ id: constraint.bottom, gap: constraint.gap, direction: \"vertical\" }]);\n }\n if (!dag.has(constraint.bottom)) {\n dag.set(constraint.bottom, []);\n }\n }\n });\n\n dagUndirected = dagToUndirected(dag);\n components = findComponents(dagUndirected);\n }\n\n if (CoSEConstants.TRANSFORM_ON_CONSTRAINT_HANDLING) {\n // first check fixed node constraint\n if (constraints.fixedNodeConstraint && constraints.fixedNodeConstraint.length > 1) {\n constraints.fixedNodeConstraint.forEach(function (nodeData, i) {\n targetMatrix[i] = [nodeData.position.x, nodeData.position.y];\n sourceMatrix[i] = [xCoords[nodeIndexes.get(nodeData.nodeId)], yCoords[nodeIndexes.get(nodeData.nodeId)]];\n });\n standardTransformation = true;\n } else if (constraints.alignmentConstraint) {\n (function () {\n // then check alignment constraint\n var count = 0;\n if (constraints.alignmentConstraint.vertical) {\n var verticalAlign = constraints.alignmentConstraint.vertical;\n\n var _loop2 = function _loop2(_i4) {\n var alignmentSet = new Set();\n verticalAlign[_i4].forEach(function (nodeId) {\n alignmentSet.add(nodeId);\n });\n var intersection = new Set([].concat(_toConsumableArray(alignmentSet)).filter(function (x) {\n return fixedNodes.has(x);\n }));\n var xPos = void 0;\n if (intersection.size > 0) xPos = xCoords[nodeIndexes.get(intersection.values().next().value)];else xPos = calculateAvgPosition(alignmentSet).x;\n\n verticalAlign[_i4].forEach(function (nodeId) {\n targetMatrix[count] = [xPos, yCoords[nodeIndexes.get(nodeId)]];\n sourceMatrix[count] = [xCoords[nodeIndexes.get(nodeId)], yCoords[nodeIndexes.get(nodeId)]];\n count++;\n });\n };\n\n for (var _i4 = 0; _i4 < verticalAlign.length; _i4++) {\n _loop2(_i4);\n }\n standardTransformation = true;\n }\n if (constraints.alignmentConstraint.horizontal) {\n var horizontalAlign = constraints.alignmentConstraint.horizontal;\n\n var _loop3 = function _loop3(_i5) {\n var alignmentSet = new Set();\n horizontalAlign[_i5].forEach(function (nodeId) {\n alignmentSet.add(nodeId);\n });\n var intersection = new Set([].concat(_toConsumableArray(alignmentSet)).filter(function (x) {\n return fixedNodes.has(x);\n }));\n var yPos = void 0;\n if (intersection.size > 0) yPos = xCoords[nodeIndexes.get(intersection.values().next().value)];else yPos = calculateAvgPosition(alignmentSet).y;\n\n horizontalAlign[_i5].forEach(function (nodeId) {\n targetMatrix[count] = [xCoords[nodeIndexes.get(nodeId)], yPos];\n sourceMatrix[count] = [xCoords[nodeIndexes.get(nodeId)], yCoords[nodeIndexes.get(nodeId)]];\n count++;\n });\n };\n\n for (var _i5 = 0; _i5 < horizontalAlign.length; _i5++) {\n _loop3(_i5);\n }\n standardTransformation = true;\n }\n if (constraints.relativePlacementConstraint) {\n reflectionType = true;\n }\n })();\n } else if (constraints.relativePlacementConstraint) {\n // finally check relative placement constraint\n // find largest component in dag\n var largestComponentSize = 0;\n var largestComponentIndex = 0;\n for (var _i6 = 0; _i6 < components.length; _i6++) {\n if (components[_i6].length > largestComponentSize) {\n largestComponentSize = components[_i6].length;\n largestComponentIndex = _i6;\n }\n }\n // if largest component isn't dominant, then take the votes for reflection\n if (largestComponentSize < dagUndirected.size / 2) {\n applyReflectionForRelativePlacement(constraints.relativePlacementConstraint);\n standardTransformation = false;\n reflectionType = false;\n } else {\n // use largest component for transformation\n // construct horizontal and vertical subgraphs in the largest component\n var subGraphOnHorizontal = new Map();\n var subGraphOnVertical = new Map();\n var constraintsInlargestComponent = [];\n\n components[largestComponentIndex].forEach(function (nodeId) {\n dag.get(nodeId).forEach(function (adjacent) {\n if (adjacent.direction == \"horizontal\") {\n if (subGraphOnHorizontal.has(nodeId)) {\n subGraphOnHorizontal.get(nodeId).push(adjacent);\n } else {\n subGraphOnHorizontal.set(nodeId, [adjacent]);\n }\n if (!subGraphOnHorizontal.has(adjacent.id)) {\n subGraphOnHorizontal.set(adjacent.id, []);\n }\n constraintsInlargestComponent.push({ left: nodeId, right: adjacent.id });\n } else {\n if (subGraphOnVertical.has(nodeId)) {\n subGraphOnVertical.get(nodeId).push(adjacent);\n } else {\n subGraphOnVertical.set(nodeId, [adjacent]);\n }\n if (!subGraphOnVertical.has(adjacent.id)) {\n subGraphOnVertical.set(adjacent.id, []);\n }\n constraintsInlargestComponent.push({ top: nodeId, bottom: adjacent.id });\n }\n });\n });\n\n applyReflectionForRelativePlacement(constraintsInlargestComponent);\n reflectionType = false;\n\n // calculate appropriate positioning for subgraphs\n var positionMapHorizontal = findAppropriatePositionForRelativePlacement(subGraphOnHorizontal, \"horizontal\");\n var positionMapVertical = findAppropriatePositionForRelativePlacement(subGraphOnVertical, \"vertical\");\n\n // construct source and target configuration\n components[largestComponentIndex].forEach(function (nodeId, i) {\n sourceMatrix[i] = [xCoords[nodeIndexes.get(nodeId)], yCoords[nodeIndexes.get(nodeId)]];\n targetMatrix[i] = [];\n if (positionMapHorizontal.has(nodeId)) {\n targetMatrix[i][0] = positionMapHorizontal.get(nodeId);\n } else {\n targetMatrix[i][0] = xCoords[nodeIndexes.get(nodeId)];\n }\n if (positionMapVertical.has(nodeId)) {\n targetMatrix[i][1] = positionMapVertical.get(nodeId);\n } else {\n targetMatrix[i][1] = yCoords[nodeIndexes.get(nodeId)];\n }\n });\n\n standardTransformation = true;\n }\n }\n\n // if transformation is required, then calculate and apply transformation matrix\n if (standardTransformation) {\n /* calculate transformation matrix */\n var transformationMatrix = void 0;\n var targetMatrixTranspose = Matrix.transpose(targetMatrix); // A'\n var sourceMatrixTranspose = Matrix.transpose(sourceMatrix); // B'\n\n // centralize transpose matrices\n for (var _i7 = 0; _i7 < targetMatrixTranspose.length; _i7++) {\n targetMatrixTranspose[_i7] = Matrix.multGamma(targetMatrixTranspose[_i7]);\n sourceMatrixTranspose[_i7] = Matrix.multGamma(sourceMatrixTranspose[_i7]);\n }\n\n // do actual calculation for transformation matrix\n var tempMatrix = Matrix.multMat(targetMatrixTranspose, Matrix.transpose(sourceMatrixTranspose)); // tempMatrix = A'B\n var SVDResult = SVD.svd(tempMatrix); // SVD(A'B) = USV', svd function returns U, S and V \n transformationMatrix = Matrix.multMat(SVDResult.V, Matrix.transpose(SVDResult.U)); // transformationMatrix = T = VU'\n\n /* apply found transformation matrix to obtain final draft layout */\n for (var _i8 = 0; _i8 < nodeIndexes.size; _i8++) {\n var temp1 = [xCoords[_i8], yCoords[_i8]];\n var temp2 = [transformationMatrix[0][0], transformationMatrix[1][0]];\n var temp3 = [transformationMatrix[0][1], transformationMatrix[1][1]];\n xCoords[_i8] = Matrix.dotProduct(temp1, temp2);\n yCoords[_i8] = Matrix.dotProduct(temp1, temp3);\n }\n\n // applied only both alignment and rel. placement constraints exist\n if (reflectionType) {\n applyReflectionForRelativePlacement(constraints.relativePlacementConstraint);\n }\n }\n }\n\n if (CoSEConstants.ENFORCE_CONSTRAINTS) {\n /**** enforce constraints on the transformed draft layout ****/\n\n /* first enforce fixed node constraint */\n\n if (constraints.fixedNodeConstraint && constraints.fixedNodeConstraint.length > 0) {\n var translationAmount = { x: 0, y: 0 };\n constraints.fixedNodeConstraint.forEach(function (nodeData, i) {\n var posInTheory = { x: xCoords[nodeIndexes.get(nodeData.nodeId)], y: yCoords[nodeIndexes.get(nodeData.nodeId)] };\n var posDesired = nodeData.position;\n var posDiff = calculatePositionDiff(posDesired, posInTheory);\n translationAmount.x += posDiff.x;\n translationAmount.y += posDiff.y;\n });\n translationAmount.x /= constraints.fixedNodeConstraint.length;\n translationAmount.y /= constraints.fixedNodeConstraint.length;\n\n xCoords.forEach(function (value, i) {\n xCoords[i] += translationAmount.x;\n });\n\n yCoords.forEach(function (value, i) {\n yCoords[i] += translationAmount.y;\n });\n\n constraints.fixedNodeConstraint.forEach(function (nodeData) {\n xCoords[nodeIndexes.get(nodeData.nodeId)] = nodeData.position.x;\n yCoords[nodeIndexes.get(nodeData.nodeId)] = nodeData.position.y;\n });\n }\n\n /* then enforce alignment constraint */\n\n if (constraints.alignmentConstraint) {\n if (constraints.alignmentConstraint.vertical) {\n var xAlign = constraints.alignmentConstraint.vertical;\n\n var _loop4 = function _loop4(_i9) {\n var alignmentSet = new Set();\n xAlign[_i9].forEach(function (nodeId) {\n alignmentSet.add(nodeId);\n });\n var intersection = new Set([].concat(_toConsumableArray(alignmentSet)).filter(function (x) {\n return fixedNodes.has(x);\n }));\n var xPos = void 0;\n if (intersection.size > 0) xPos = xCoords[nodeIndexes.get(intersection.values().next().value)];else xPos = calculateAvgPosition(alignmentSet).x;\n\n alignmentSet.forEach(function (nodeId) {\n if (!fixedNodes.has(nodeId)) xCoords[nodeIndexes.get(nodeId)] = xPos;\n });\n };\n\n for (var _i9 = 0; _i9 < xAlign.length; _i9++) {\n _loop4(_i9);\n }\n }\n if (constraints.alignmentConstraint.horizontal) {\n var yAlign = constraints.alignmentConstraint.horizontal;\n\n var _loop5 = function _loop5(_i10) {\n var alignmentSet = new Set();\n yAlign[_i10].forEach(function (nodeId) {\n alignmentSet.add(nodeId);\n });\n var intersection = new Set([].concat(_toConsumableArray(alignmentSet)).filter(function (x) {\n return fixedNodes.has(x);\n }));\n var yPos = void 0;\n if (intersection.size > 0) yPos = yCoords[nodeIndexes.get(intersection.values().next().value)];else yPos = calculateAvgPosition(alignmentSet).y;\n\n alignmentSet.forEach(function (nodeId) {\n if (!fixedNodes.has(nodeId)) yCoords[nodeIndexes.get(nodeId)] = yPos;\n });\n };\n\n for (var _i10 = 0; _i10 < yAlign.length; _i10++) {\n _loop5(_i10);\n }\n }\n }\n\n /* finally enforce relative placement constraint */\n\n if (constraints.relativePlacementConstraint) {\n (function () {\n var nodeToDummyForVerticalAlignment = new Map();\n var nodeToDummyForHorizontalAlignment = new Map();\n var dummyToNodeForVerticalAlignment = new Map();\n var dummyToNodeForHorizontalAlignment = new Map();\n var dummyPositionsForVerticalAlignment = new Map();\n var dummyPositionsForHorizontalAlignment = new Map();\n var fixedNodesOnHorizontal = new Set();\n var fixedNodesOnVertical = new Set();\n\n // fill maps and sets \n fixedNodes.forEach(function (nodeId) {\n fixedNodesOnHorizontal.add(nodeId);\n fixedNodesOnVertical.add(nodeId);\n });\n\n if (constraints.alignmentConstraint) {\n if (constraints.alignmentConstraint.vertical) {\n var verticalAlignment = constraints.alignmentConstraint.vertical;\n\n var _loop6 = function _loop6(_i11) {\n dummyToNodeForVerticalAlignment.set(\"dummy\" + _i11, []);\n verticalAlignment[_i11].forEach(function (nodeId) {\n nodeToDummyForVerticalAlignment.set(nodeId, \"dummy\" + _i11);\n dummyToNodeForVerticalAlignment.get(\"dummy\" + _i11).push(nodeId);\n if (fixedNodes.has(nodeId)) {\n fixedNodesOnHorizontal.add(\"dummy\" + _i11);\n }\n });\n dummyPositionsForVerticalAlignment.set(\"dummy\" + _i11, xCoords[nodeIndexes.get(verticalAlignment[_i11][0])]);\n };\n\n for (var _i11 = 0; _i11 < verticalAlignment.length; _i11++) {\n _loop6(_i11);\n }\n }\n if (constraints.alignmentConstraint.horizontal) {\n var horizontalAlignment = constraints.alignmentConstraint.horizontal;\n\n var _loop7 = function _loop7(_i12) {\n dummyToNodeForHorizontalAlignment.set(\"dummy\" + _i12, []);\n horizontalAlignment[_i12].forEach(function (nodeId) {\n nodeToDummyForHorizontalAlignment.set(nodeId, \"dummy\" + _i12);\n dummyToNodeForHorizontalAlignment.get(\"dummy\" + _i12).push(nodeId);\n if (fixedNodes.has(nodeId)) {\n fixedNodesOnVertical.add(\"dummy\" + _i12);\n }\n });\n dummyPositionsForHorizontalAlignment.set(\"dummy\" + _i12, yCoords[nodeIndexes.get(horizontalAlignment[_i12][0])]);\n };\n\n for (var _i12 = 0; _i12 < horizontalAlignment.length; _i12++) {\n _loop7(_i12);\n }\n }\n }\n\n // construct horizontal and vertical dags (subgraphs) from overall dag\n var dagOnHorizontal = new Map();\n var dagOnVertical = new Map();\n\n var _loop8 = function _loop8(nodeId) {\n dag.get(nodeId).forEach(function (adjacent) {\n var sourceId = void 0;\n var targetNode = void 0;\n if (adjacent[\"direction\"] == \"horizontal\") {\n sourceId = nodeToDummyForVerticalAlignment.get(nodeId) ? nodeToDummyForVerticalAlignment.get(nodeId) : nodeId;\n if (nodeToDummyForVerticalAlignment.get(adjacent.id)) {\n targetNode = { id: nodeToDummyForVerticalAlignment.get(adjacent.id), gap: adjacent.gap, direction: adjacent.direction };\n } else {\n targetNode = adjacent;\n }\n if (dagOnHorizontal.has(sourceId)) {\n dagOnHorizontal.get(sourceId).push(targetNode);\n } else {\n dagOnHorizontal.set(sourceId, [targetNode]);\n }\n if (!dagOnHorizontal.has(targetNode.id)) {\n dagOnHorizontal.set(targetNode.id, []);\n }\n } else {\n sourceId = nodeToDummyForHorizontalAlignment.get(nodeId) ? nodeToDummyForHorizontalAlignment.get(nodeId) : nodeId;\n if (nodeToDummyForHorizontalAlignment.get(adjacent.id)) {\n targetNode = { id: nodeToDummyForHorizontalAlignment.get(adjacent.id), gap: adjacent.gap, direction: adjacent.direction };\n } else {\n targetNode = adjacent;\n }\n if (dagOnVertical.has(sourceId)) {\n dagOnVertical.get(sourceId).push(targetNode);\n } else {\n dagOnVertical.set(sourceId, [targetNode]);\n }\n if (!dagOnVertical.has(targetNode.id)) {\n dagOnVertical.set(targetNode.id, []);\n }\n }\n });\n };\n\n var _iteratorNormalCompletion5 = true;\n var _didIteratorError5 = false;\n var _iteratorError5 = undefined;\n\n try {\n for (var _iterator5 = dag.keys()[Symbol.iterator](), _step5; !(_iteratorNormalCompletion5 = (_step5 = _iterator5.next()).done); _iteratorNormalCompletion5 = true) {\n var nodeId = _step5.value;\n\n _loop8(nodeId);\n }\n\n // find source nodes of each component in horizontal and vertical dags\n } catch (err) {\n _didIteratorError5 = true;\n _iteratorError5 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion5 && _iterator5.return) {\n _iterator5.return();\n }\n } finally {\n if (_didIteratorError5) {\n throw _iteratorError5;\n }\n }\n }\n\n var undirectedOnHorizontal = dagToUndirected(dagOnHorizontal);\n var undirectedOnVertical = dagToUndirected(dagOnVertical);\n var componentsOnHorizontal = findComponents(undirectedOnHorizontal);\n var componentsOnVertical = findComponents(undirectedOnVertical);\n var reversedDagOnHorizontal = dagToReversed(dagOnHorizontal);\n var reversedDagOnVertical = dagToReversed(dagOnVertical);\n var componentSourcesOnHorizontal = [];\n var componentSourcesOnVertical = [];\n\n componentsOnHorizontal.forEach(function (component, index) {\n componentSourcesOnHorizontal[index] = [];\n component.forEach(function (nodeId) {\n if (reversedDagOnHorizontal.get(nodeId).length == 0) {\n componentSourcesOnHorizontal[index].push(nodeId);\n }\n });\n });\n\n componentsOnVertical.forEach(function (component, index) {\n componentSourcesOnVertical[index] = [];\n component.forEach(function (nodeId) {\n if (reversedDagOnVertical.get(nodeId).length == 0) {\n componentSourcesOnVertical[index].push(nodeId);\n }\n });\n });\n\n // calculate appropriate positioning for subgraphs\n var positionMapHorizontal = findAppropriatePositionForRelativePlacement(dagOnHorizontal, \"horizontal\", fixedNodesOnHorizontal, dummyPositionsForVerticalAlignment, componentSourcesOnHorizontal);\n var positionMapVertical = findAppropriatePositionForRelativePlacement(dagOnVertical, \"vertical\", fixedNodesOnVertical, dummyPositionsForHorizontalAlignment, componentSourcesOnVertical);\n\n // update positions of the nodes based on relative placement constraints\n\n var _loop9 = function _loop9(key) {\n if (dummyToNodeForVerticalAlignment.get(key)) {\n dummyToNodeForVerticalAlignment.get(key).forEach(function (nodeId) {\n xCoords[nodeIndexes.get(nodeId)] = positionMapHorizontal.get(key);\n });\n } else {\n xCoords[nodeIndexes.get(key)] = positionMapHorizontal.get(key);\n }\n };\n\n var _iteratorNormalCompletion6 = true;\n var _didIteratorError6 = false;\n var _iteratorError6 = undefined;\n\n try {\n for (var _iterator6 = positionMapHorizontal.keys()[Symbol.iterator](), _step6; !(_iteratorNormalCompletion6 = (_step6 = _iterator6.next()).done); _iteratorNormalCompletion6 = true) {\n var key = _step6.value;\n\n _loop9(key);\n }\n } catch (err) {\n _didIteratorError6 = true;\n _iteratorError6 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion6 && _iterator6.return) {\n _iterator6.return();\n }\n } finally {\n if (_didIteratorError6) {\n throw _iteratorError6;\n }\n }\n }\n\n var _loop10 = function _loop10(key) {\n if (dummyToNodeForHorizontalAlignment.get(key)) {\n dummyToNodeForHorizontalAlignment.get(key).forEach(function (nodeId) {\n yCoords[nodeIndexes.get(nodeId)] = positionMapVertical.get(key);\n });\n } else {\n yCoords[nodeIndexes.get(key)] = positionMapVertical.get(key);\n }\n };\n\n var _iteratorNormalCompletion7 = true;\n var _didIteratorError7 = false;\n var _iteratorError7 = undefined;\n\n try {\n for (var _iterator7 = positionMapVertical.keys()[Symbol.iterator](), _step7; !(_iteratorNormalCompletion7 = (_step7 = _iterator7.next()).done); _iteratorNormalCompletion7 = true) {\n var key = _step7.value;\n\n _loop10(key);\n }\n } catch (err) {\n _didIteratorError7 = true;\n _iteratorError7 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion7 && _iterator7.return) {\n _iterator7.return();\n }\n } finally {\n if (_didIteratorError7) {\n throw _iteratorError7;\n }\n }\n }\n })();\n }\n }\n\n // assign new coordinates to nodes after constraint handling\n for (var _i13 = 0; _i13 < allNodes.length; _i13++) {\n var _node = allNodes[_i13];\n if (_node.getChild() == null) {\n _node.setCenter(xCoords[nodeIndexes.get(_node.id)], yCoords[nodeIndexes.get(_node.id)]);\n }\n }\n};\n\nmodule.exports = ConstraintHandler;\n\n/***/ }),\n\n/***/ 551:\n/***/ ((module) => {\n\nmodule.exports = __WEBPACK_EXTERNAL_MODULE__551__;\n\n/***/ })\n\n/******/ \t});\n/************************************************************************/\n/******/ \t// The module cache\n/******/ \tvar __webpack_module_cache__ = {};\n/******/ \t\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/ \t\t// Check if module is in cache\n/******/ \t\tvar cachedModule = __webpack_module_cache__[moduleId];\n/******/ \t\tif (cachedModule !== undefined) {\n/******/ \t\t\treturn cachedModule.exports;\n/******/ \t\t}\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = __webpack_module_cache__[moduleId] = {\n/******/ \t\t\t// no module.id needed\n/******/ \t\t\t// no module.loaded needed\n/******/ \t\t\texports: {}\n/******/ \t\t};\n/******/ \t\n/******/ \t\t// Execute the module function\n/******/ \t\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n/******/ \t\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/ \t\n/************************************************************************/\n/******/ \t\n/******/ \t// startup\n/******/ \t// Load entry module and return exports\n/******/ \t// This entry module is referenced by other modules so it can't be inlined\n/******/ \tvar __webpack_exports__ = __webpack_require__(45);\n/******/ \t\n/******/ \treturn __webpack_exports__;\n/******/ })()\n;\n});"],"names":["root","factory","module","require$$0","this","__WEBPACK_EXTERNAL_MODULE__551__","__webpack_modules__","__unused_webpack_exports","__webpack_require__","coseBase","FDLayoutConstants","CoSEConstants","prop","FDLayoutEdge","CoSEEdge","source","target","vEdge","LGraph","CoSEGraph","parent","graphMgr","vGraph","LGraphManager","CoSEGraphManager","layout","FDLayout","CoSENode","ConstraintHandler","LayoutConstants","Point","PointD","DimensionD","Layout","Integer","IGeometry","Transform","LinkedList","CoSELayout","gm","vNode","createBendsAsNeeded","allNodes","intersection","x","forest","gridUpdateAllowed","forceToNodeSurroundingUpdate","pData","i","rect","id","layoutEnded","lNodes","node","self","calculateCompoundWeight","compoundNode","nodes","fixedNodeWeight","nodeData","nodeToDummyForVerticalAlignment","nodeToDummyForHorizontalAlignment","nodeId","verticalAlignment","horizontalAlignment","array","j","constraint","nodeIdLeft","nodeIdRight","nodeIdTop","nodeIdBottom","subGraphOnHorizontal","subGraphOnVertical","left","right","top","bottom","constructComponents","graph","fixedNodes","components","isFixed","queue","visited","count","value","key","currentNode","neighbors","neighbor","resultOnHorizontal","resultOnVertical","fixedNode","allVerticalAlignments","totalDisplacementX","averageDisplacementX","allHorizontalAlignments","totalDisplacementY","averageDisplacementY","displacement","diff","component","sum","actualNodes","averageDisplacement","nodeList","graphs","size","edges","edge","edgeList","k","multiEdge","currentStartingPoint","numberOfColumns","height","currentY","currentX","point","tree","centerNode","startingPoint","radialSep","bounds","transform","bottomRight","parentOfNode","startAngle","endAngle","distance","radialSeparation","halfInterval","nodeAngle","teta","x_","y_","neighborEdges","childCount","branchCount","incEdgesCount","startIndex","temp","index","stepAngle","currentNeighbor","childStartAngle","childEndAngle","maxDiagonal","diagonal","tempMemberGroups","zeroDegree","p_id","dummyCompoundId","dummyCompound","dummyParentGraph","parentGraph","childGraphMap","idToNode","tiledZeroDegreePack","width","lCompoundNode","horizontalMargin","verticalMargin","labelMarginLeft","labelMarginTop","tiledPack","childGraph","children","theChild","degree","child","organization","y","compoundHorizontalMargin","compoundVerticalMargin","compoundLabelMarginLeft","compoundLabelMarginTop","row","maxHeight","lnode","minWidth","horizontalOrg","verticalOrg","horizontalRatio","verticalRatio","bestOrg","ratio","members","favorHorizontalDim","verticalPadding","horizontalPadding","membersSize","totalWidth","totalHeight","maxWidth","averageWidth","averageHeight","delta","horizontalCountDouble","horizontalCount","idealWidth","tilingCompareBy","getNodeArea","n","areaCompareFcn","n1","n2","cmpBy","sumCenterX","sumCenterY","lNode","rowIndex","minCompoundSize","secondDimension","w","extraHeight","r","min","max","extraWidth","lastRowIndex","lastRowWidth","sri","hDiff","add_to_row_ratio","add_new_row_ratio","longest","last","prevTotal","finalTotal","prunedNodesAll","containsLeaf","prunedNodesInStepTemp","otherEnd","relativePosition","prunedNodesInStep","lengthOfPrunedNodesInStep","gridForPrunedNode","nodeToConnect","prunedNode","startGridX","finishGridX","startGridY","finishGridY","upNodeCount","downNodeCount","rightNodeCount","leftNodeCount","controlRegions","minCount","minIndex","random","FDLayoutNode","IMath","loc","dX","dY","pred1","next","processed","_toConsumableArray","arr","arr2","Matrix","SVD","constraints","idToNodeMap","nodeIndexes","xCoords","yCoords","calculatePositionDiff","pos1","pos2","calculateAvgPosition","nodeIdSet","xPosSum","yPosSum","findAppropriatePositionForRelativePlacement","direction","dummyPositions","componentSources","setUnion","setA","setB","union","_iteratorNormalCompletion","_didIteratorError","_iteratorError","_iterator","_step","elem","err","inDegrees","adjacent","positionMap","pastMap","fixedIds","position","fixedId","_position","_loop","fixedPosition","sinkNodes","_components","isFixedComponent","_iteratorNormalCompletion2","_didIteratorError2","_iteratorError2","_iterator2","_step2","isExist","existAt","ele","minBefore","minAfter","maxBefore","maxAfter","_iteratorNormalCompletion3","_didIteratorError3","_iteratorError3","_iterator3","_step3","posBefore","posAfter","_iteratorNormalCompletion4","_didIteratorError4","_iteratorError4","_iterator4","_step4","_nodeId","applyReflectionForRelativePlacement","relativePlacementConstraints","reflectOnY","notReflectOnY","reflectOnX","notReflectOnX","_i","_i2","_i3","findComponents","_currentNode","dagToUndirected","dag","undirected","dagToReversed","reversed","targetMatrix","sourceMatrix","standardTransformation","reflectionType","dagUndirected","verticalAlign","_loop2","_i4","alignmentSet","xPos","horizontalAlign","_loop3","_i5","yPos","largestComponentSize","largestComponentIndex","_i6","constraintsInlargestComponent","positionMapHorizontal","positionMapVertical","transformationMatrix","targetMatrixTranspose","sourceMatrixTranspose","_i7","tempMatrix","SVDResult","_i8","temp1","temp2","temp3","translationAmount","posInTheory","posDesired","posDiff","xAlign","_loop4","_i9","yAlign","_loop5","_i10","dummyToNodeForVerticalAlignment","dummyToNodeForHorizontalAlignment","dummyPositionsForVerticalAlignment","dummyPositionsForHorizontalAlignment","fixedNodesOnHorizontal","fixedNodesOnVertical","_loop6","_i11","_loop7","_i12","dagOnHorizontal","dagOnVertical","_loop8","sourceId","targetNode","_iteratorNormalCompletion5","_didIteratorError5","_iteratorError5","_iterator5","_step5","undirectedOnHorizontal","undirectedOnVertical","componentsOnHorizontal","componentsOnVertical","reversedDagOnHorizontal","reversedDagOnVertical","componentSourcesOnHorizontal","componentSourcesOnVertical","_loop9","_iteratorNormalCompletion6","_didIteratorError6","_iteratorError6","_iterator6","_step6","_loop10","_iteratorNormalCompletion7","_didIteratorError7","_iteratorError7","_iterator7","_step7","_i13","_node","__webpack_module_cache__","moduleId","cachedModule","__webpack_exports__"],"mappings":"yQAAC,SAA0CA,GAAMC,GAAS,CAExDC,GAAA,QAAiB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":"cose-base.cjs.js","sources":["../../../../../node_modules/cytoscape-fcose/node_modules/cose-base/cose-base.js"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory(require(\"layout-base\"));\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([\"layout-base\"], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"coseBase\"] = factory(require(\"layout-base\"));\n\telse\n\t\troot[\"coseBase\"] = factory(root[\"layoutBase\"]);\n})(this, function(__WEBPACK_EXTERNAL_MODULE__551__) {\nreturn /******/ (() => { // webpackBootstrap\n/******/ \t\"use strict\";\n/******/ \tvar __webpack_modules__ = ({\n\n/***/ 45:\n/***/ ((module, __unused_webpack_exports, __webpack_require__) => {\n\n\n\nvar coseBase = {};\n\ncoseBase.layoutBase = __webpack_require__(551);\ncoseBase.CoSEConstants = __webpack_require__(806);\ncoseBase.CoSEEdge = __webpack_require__(767);\ncoseBase.CoSEGraph = __webpack_require__(880);\ncoseBase.CoSEGraphManager = __webpack_require__(578);\ncoseBase.CoSELayout = __webpack_require__(765);\ncoseBase.CoSENode = __webpack_require__(991);\ncoseBase.ConstraintHandler = __webpack_require__(902);\n\nmodule.exports = coseBase;\n\n/***/ }),\n\n/***/ 806:\n/***/ ((module, __unused_webpack_exports, __webpack_require__) => {\n\n\n\nvar FDLayoutConstants = __webpack_require__(551).FDLayoutConstants;\n\nfunction CoSEConstants() {}\n\n//CoSEConstants inherits static props in FDLayoutConstants\nfor (var prop in FDLayoutConstants) {\n CoSEConstants[prop] = FDLayoutConstants[prop];\n}\n\nCoSEConstants.DEFAULT_USE_MULTI_LEVEL_SCALING = false;\nCoSEConstants.DEFAULT_RADIAL_SEPARATION = FDLayoutConstants.DEFAULT_EDGE_LENGTH;\nCoSEConstants.DEFAULT_COMPONENT_SEPERATION = 60;\nCoSEConstants.TILE = true;\nCoSEConstants.TILING_PADDING_VERTICAL = 10;\nCoSEConstants.TILING_PADDING_HORIZONTAL = 10;\nCoSEConstants.TRANSFORM_ON_CONSTRAINT_HANDLING = true;\nCoSEConstants.ENFORCE_CONSTRAINTS = true;\nCoSEConstants.APPLY_LAYOUT = true;\nCoSEConstants.RELAX_MOVEMENT_ON_CONSTRAINTS = true;\nCoSEConstants.TREE_REDUCTION_ON_INCREMENTAL = true; // this should be set to false if there will be a constraint\n// This constant is for differentiating whether actual layout algorithm that uses cose-base wants to apply only incremental layout or \n// an incremental layout on top of a randomized layout. If it is only incremental layout, then this constant should be true.\nCoSEConstants.PURE_INCREMENTAL = CoSEConstants.DEFAULT_INCREMENTAL;\n\nmodule.exports = CoSEConstants;\n\n/***/ }),\n\n/***/ 767:\n/***/ ((module, __unused_webpack_exports, __webpack_require__) => {\n\n\n\nvar FDLayoutEdge = __webpack_require__(551).FDLayoutEdge;\n\nfunction CoSEEdge(source, target, vEdge) {\n FDLayoutEdge.call(this, source, target, vEdge);\n}\n\nCoSEEdge.prototype = Object.create(FDLayoutEdge.prototype);\nfor (var prop in FDLayoutEdge) {\n CoSEEdge[prop] = FDLayoutEdge[prop];\n}\n\nmodule.exports = CoSEEdge;\n\n/***/ }),\n\n/***/ 880:\n/***/ ((module, __unused_webpack_exports, __webpack_require__) => {\n\n\n\nvar LGraph = __webpack_require__(551).LGraph;\n\nfunction CoSEGraph(parent, graphMgr, vGraph) {\n LGraph.call(this, parent, graphMgr, vGraph);\n}\n\nCoSEGraph.prototype = Object.create(LGraph.prototype);\nfor (var prop in LGraph) {\n CoSEGraph[prop] = LGraph[prop];\n}\n\nmodule.exports = CoSEGraph;\n\n/***/ }),\n\n/***/ 578:\n/***/ ((module, __unused_webpack_exports, __webpack_require__) => {\n\n\n\nvar LGraphManager = __webpack_require__(551).LGraphManager;\n\nfunction CoSEGraphManager(layout) {\n LGraphManager.call(this, layout);\n}\n\nCoSEGraphManager.prototype = Object.create(LGraphManager.prototype);\nfor (var prop in LGraphManager) {\n CoSEGraphManager[prop] = LGraphManager[prop];\n}\n\nmodule.exports = CoSEGraphManager;\n\n/***/ }),\n\n/***/ 765:\n/***/ ((module, __unused_webpack_exports, __webpack_require__) => {\n\n\n\nvar FDLayout = __webpack_require__(551).FDLayout;\nvar CoSEGraphManager = __webpack_require__(578);\nvar CoSEGraph = __webpack_require__(880);\nvar CoSENode = __webpack_require__(991);\nvar CoSEEdge = __webpack_require__(767);\nvar CoSEConstants = __webpack_require__(806);\nvar ConstraintHandler = __webpack_require__(902);\nvar FDLayoutConstants = __webpack_require__(551).FDLayoutConstants;\nvar LayoutConstants = __webpack_require__(551).LayoutConstants;\nvar Point = __webpack_require__(551).Point;\nvar PointD = __webpack_require__(551).PointD;\nvar DimensionD = __webpack_require__(551).DimensionD;\nvar Layout = __webpack_require__(551).Layout;\nvar Integer = __webpack_require__(551).Integer;\nvar IGeometry = __webpack_require__(551).IGeometry;\nvar LGraph = __webpack_require__(551).LGraph;\nvar Transform = __webpack_require__(551).Transform;\nvar LinkedList = __webpack_require__(551).LinkedList;\n\nfunction CoSELayout() {\n FDLayout.call(this);\n\n this.toBeTiled = {}; // Memorize if a node is to be tiled or is tiled\n this.constraints = {}; // keep layout constraints\n}\n\nCoSELayout.prototype = Object.create(FDLayout.prototype);\n\nfor (var prop in FDLayout) {\n CoSELayout[prop] = FDLayout[prop];\n}\n\nCoSELayout.prototype.newGraphManager = function () {\n var gm = new CoSEGraphManager(this);\n this.graphManager = gm;\n return gm;\n};\n\nCoSELayout.prototype.newGraph = function (vGraph) {\n return new CoSEGraph(null, this.graphManager, vGraph);\n};\n\nCoSELayout.prototype.newNode = function (vNode) {\n return new CoSENode(this.graphManager, vNode);\n};\n\nCoSELayout.prototype.newEdge = function (vEdge) {\n return new CoSEEdge(null, null, vEdge);\n};\n\nCoSELayout.prototype.initParameters = function () {\n FDLayout.prototype.initParameters.call(this, arguments);\n if (!this.isSubLayout) {\n if (CoSEConstants.DEFAULT_EDGE_LENGTH < 10) {\n this.idealEdgeLength = 10;\n } else {\n this.idealEdgeLength = CoSEConstants.DEFAULT_EDGE_LENGTH;\n }\n\n this.useSmartIdealEdgeLengthCalculation = CoSEConstants.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION;\n this.gravityConstant = FDLayoutConstants.DEFAULT_GRAVITY_STRENGTH;\n this.compoundGravityConstant = FDLayoutConstants.DEFAULT_COMPOUND_GRAVITY_STRENGTH;\n this.gravityRangeFactor = FDLayoutConstants.DEFAULT_GRAVITY_RANGE_FACTOR;\n this.compoundGravityRangeFactor = FDLayoutConstants.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR;\n\n // variables for tree reduction support\n this.prunedNodesAll = [];\n this.growTreeIterations = 0;\n this.afterGrowthIterations = 0;\n this.isTreeGrowing = false;\n this.isGrowthFinished = false;\n }\n};\n\n// This method is used to set CoSE related parameters used by spring embedder.\nCoSELayout.prototype.initSpringEmbedder = function () {\n FDLayout.prototype.initSpringEmbedder.call(this);\n\n // variables for cooling\n this.coolingCycle = 0;\n this.maxCoolingCycle = this.maxIterations / FDLayoutConstants.CONVERGENCE_CHECK_PERIOD;\n this.finalTemperature = 0.04;\n this.coolingAdjuster = 1;\n};\n\nCoSELayout.prototype.layout = function () {\n var createBendsAsNeeded = LayoutConstants.DEFAULT_CREATE_BENDS_AS_NEEDED;\n if (createBendsAsNeeded) {\n this.createBendpoints();\n this.graphManager.resetAllEdges();\n }\n\n this.level = 0;\n return this.classicLayout();\n};\n\nCoSELayout.prototype.classicLayout = function () {\n this.nodesWithGravity = this.calculateNodesToApplyGravitationTo();\n this.graphManager.setAllNodesToApplyGravitation(this.nodesWithGravity);\n this.calcNoOfChildrenForAllNodes();\n this.graphManager.calcLowestCommonAncestors();\n this.graphManager.calcInclusionTreeDepths();\n this.graphManager.getRoot().calcEstimatedSize();\n this.calcIdealEdgeLengths();\n\n if (!this.incremental) {\n var forest = this.getFlatForest();\n\n // The graph associated with this layout is flat and a forest\n if (forest.length > 0) {\n this.positionNodesRadially(forest);\n }\n // The graph associated with this layout is not flat or a forest\n else {\n // Reduce the trees when incremental mode is not enabled and graph is not a forest \n this.reduceTrees();\n // Update nodes that gravity will be applied\n this.graphManager.resetAllNodesToApplyGravitation();\n var allNodes = new Set(this.getAllNodes());\n var intersection = this.nodesWithGravity.filter(function (x) {\n return allNodes.has(x);\n });\n this.graphManager.setAllNodesToApplyGravitation(intersection);\n\n this.positionNodesRandomly();\n }\n } else {\n if (CoSEConstants.TREE_REDUCTION_ON_INCREMENTAL) {\n // Reduce the trees in incremental mode if only this constant is set to true \n this.reduceTrees();\n // Update nodes that gravity will be applied\n this.graphManager.resetAllNodesToApplyGravitation();\n var allNodes = new Set(this.getAllNodes());\n var intersection = this.nodesWithGravity.filter(function (x) {\n return allNodes.has(x);\n });\n this.graphManager.setAllNodesToApplyGravitation(intersection);\n }\n }\n\n if (Object.keys(this.constraints).length > 0) {\n ConstraintHandler.handleConstraints(this);\n this.initConstraintVariables();\n }\n\n this.initSpringEmbedder();\n if (CoSEConstants.APPLY_LAYOUT) {\n this.runSpringEmbedder();\n }\n\n return true;\n};\n\nCoSELayout.prototype.tick = function () {\n this.totalIterations++;\n\n if (this.totalIterations === this.maxIterations && !this.isTreeGrowing && !this.isGrowthFinished) {\n if (this.prunedNodesAll.length > 0) {\n this.isTreeGrowing = true;\n } else {\n return true;\n }\n }\n\n if (this.totalIterations % FDLayoutConstants.CONVERGENCE_CHECK_PERIOD == 0 && !this.isTreeGrowing && !this.isGrowthFinished) {\n if (this.isConverged()) {\n if (this.prunedNodesAll.length > 0) {\n this.isTreeGrowing = true;\n } else {\n return true;\n }\n }\n\n this.coolingCycle++;\n\n if (this.layoutQuality == 0) {\n // quality - \"draft\"\n this.coolingAdjuster = this.coolingCycle;\n } else if (this.layoutQuality == 1) {\n // quality - \"default\"\n this.coolingAdjuster = this.coolingCycle / 3;\n }\n\n // cooling schedule is based on http://www.btluke.com/simanf1.html -> cooling schedule 3\n this.coolingFactor = Math.max(this.initialCoolingFactor - Math.pow(this.coolingCycle, Math.log(100 * (this.initialCoolingFactor - this.finalTemperature)) / Math.log(this.maxCoolingCycle)) / 100 * this.coolingAdjuster, this.finalTemperature);\n this.animationPeriod = Math.ceil(this.initialAnimationPeriod * Math.sqrt(this.coolingFactor));\n }\n // Operations while tree is growing again \n if (this.isTreeGrowing) {\n if (this.growTreeIterations % 10 == 0) {\n if (this.prunedNodesAll.length > 0) {\n this.graphManager.updateBounds();\n this.updateGrid();\n this.growTree(this.prunedNodesAll);\n // Update nodes that gravity will be applied\n this.graphManager.resetAllNodesToApplyGravitation();\n var allNodes = new Set(this.getAllNodes());\n var intersection = this.nodesWithGravity.filter(function (x) {\n return allNodes.has(x);\n });\n this.graphManager.setAllNodesToApplyGravitation(intersection);\n\n this.graphManager.updateBounds();\n this.updateGrid();\n if (CoSEConstants.PURE_INCREMENTAL) this.coolingFactor = FDLayoutConstants.DEFAULT_COOLING_FACTOR_INCREMENTAL / 2;else this.coolingFactor = FDLayoutConstants.DEFAULT_COOLING_FACTOR_INCREMENTAL;\n } else {\n this.isTreeGrowing = false;\n this.isGrowthFinished = true;\n }\n }\n this.growTreeIterations++;\n }\n // Operations after growth is finished\n if (this.isGrowthFinished) {\n if (this.isConverged()) {\n return true;\n }\n if (this.afterGrowthIterations % 10 == 0) {\n this.graphManager.updateBounds();\n this.updateGrid();\n }\n if (CoSEConstants.PURE_INCREMENTAL) this.coolingFactor = FDLayoutConstants.DEFAULT_COOLING_FACTOR_INCREMENTAL / 2 * ((100 - this.afterGrowthIterations) / 100);else this.coolingFactor = FDLayoutConstants.DEFAULT_COOLING_FACTOR_INCREMENTAL * ((100 - this.afterGrowthIterations) / 100);\n this.afterGrowthIterations++;\n }\n\n var gridUpdateAllowed = !this.isTreeGrowing && !this.isGrowthFinished;\n var forceToNodeSurroundingUpdate = this.growTreeIterations % 10 == 1 && this.isTreeGrowing || this.afterGrowthIterations % 10 == 1 && this.isGrowthFinished;\n\n this.totalDisplacement = 0;\n this.graphManager.updateBounds();\n this.calcSpringForces();\n this.calcRepulsionForces(gridUpdateAllowed, forceToNodeSurroundingUpdate);\n this.calcGravitationalForces();\n this.moveNodes();\n this.animate();\n\n return false; // Layout is not ended yet return false\n};\n\nCoSELayout.prototype.getPositionsData = function () {\n var allNodes = this.graphManager.getAllNodes();\n var pData = {};\n for (var i = 0; i < allNodes.length; i++) {\n var rect = allNodes[i].rect;\n var id = allNodes[i].id;\n pData[id] = {\n id: id,\n x: rect.getCenterX(),\n y: rect.getCenterY(),\n w: rect.width,\n h: rect.height\n };\n }\n\n return pData;\n};\n\nCoSELayout.prototype.runSpringEmbedder = function () {\n this.initialAnimationPeriod = 25;\n this.animationPeriod = this.initialAnimationPeriod;\n var layoutEnded = false;\n\n // If aminate option is 'during' signal that layout is supposed to start iterating\n if (FDLayoutConstants.ANIMATE === 'during') {\n this.emit('layoutstarted');\n } else {\n // If aminate option is 'during' tick() function will be called on index.js\n while (!layoutEnded) {\n layoutEnded = this.tick();\n }\n\n this.graphManager.updateBounds();\n }\n};\n\n// overrides moveNodes method in FDLayout\nCoSELayout.prototype.moveNodes = function () {\n var lNodes = this.getAllNodes();\n var node;\n\n // calculate displacement for each node \n for (var i = 0; i < lNodes.length; i++) {\n node = lNodes[i];\n node.calculateDisplacement();\n }\n\n if (Object.keys(this.constraints).length > 0) {\n this.updateDisplacements();\n }\n\n // move each node\n for (var i = 0; i < lNodes.length; i++) {\n node = lNodes[i];\n node.move();\n }\n};\n\n// constraint related methods: initConstraintVariables and updateDisplacements\n\n// initialize constraint related variables\nCoSELayout.prototype.initConstraintVariables = function () {\n var self = this;\n this.idToNodeMap = new Map();\n this.fixedNodeSet = new Set();\n\n var allNodes = this.graphManager.getAllNodes();\n\n // fill idToNodeMap\n for (var i = 0; i < allNodes.length; i++) {\n var node = allNodes[i];\n this.idToNodeMap.set(node.id, node);\n }\n\n // calculate fixed node weight for given compound node\n var calculateCompoundWeight = function calculateCompoundWeight(compoundNode) {\n var nodes = compoundNode.getChild().getNodes();\n var node;\n var fixedNodeWeight = 0;\n for (var i = 0; i < nodes.length; i++) {\n node = nodes[i];\n if (node.getChild() == null) {\n if (self.fixedNodeSet.has(node.id)) {\n fixedNodeWeight += 100;\n }\n } else {\n fixedNodeWeight += calculateCompoundWeight(node);\n }\n }\n return fixedNodeWeight;\n };\n\n if (this.constraints.fixedNodeConstraint) {\n // fill fixedNodeSet\n this.constraints.fixedNodeConstraint.forEach(function (nodeData) {\n self.fixedNodeSet.add(nodeData.nodeId);\n });\n\n // assign fixed node weights to compounds if they contain fixed nodes\n var allNodes = this.graphManager.getAllNodes();\n var node;\n\n for (var i = 0; i < allNodes.length; i++) {\n node = allNodes[i];\n if (node.getChild() != null) {\n var fixedNodeWeight = calculateCompoundWeight(node);\n if (fixedNodeWeight > 0) {\n node.fixedNodeWeight = fixedNodeWeight;\n }\n }\n }\n }\n\n if (this.constraints.relativePlacementConstraint) {\n var nodeToDummyForVerticalAlignment = new Map();\n var nodeToDummyForHorizontalAlignment = new Map();\n this.dummyToNodeForVerticalAlignment = new Map();\n this.dummyToNodeForHorizontalAlignment = new Map();\n this.fixedNodesOnHorizontal = new Set();\n this.fixedNodesOnVertical = new Set();\n\n // fill maps and sets\n this.fixedNodeSet.forEach(function (nodeId) {\n self.fixedNodesOnHorizontal.add(nodeId);\n self.fixedNodesOnVertical.add(nodeId);\n });\n\n if (this.constraints.alignmentConstraint) {\n if (this.constraints.alignmentConstraint.vertical) {\n var verticalAlignment = this.constraints.alignmentConstraint.vertical;\n for (var i = 0; i < verticalAlignment.length; i++) {\n this.dummyToNodeForVerticalAlignment.set(\"dummy\" + i, []);\n verticalAlignment[i].forEach(function (nodeId) {\n nodeToDummyForVerticalAlignment.set(nodeId, \"dummy\" + i);\n self.dummyToNodeForVerticalAlignment.get(\"dummy\" + i).push(nodeId);\n if (self.fixedNodeSet.has(nodeId)) {\n self.fixedNodesOnHorizontal.add(\"dummy\" + i);\n }\n });\n }\n }\n if (this.constraints.alignmentConstraint.horizontal) {\n var horizontalAlignment = this.constraints.alignmentConstraint.horizontal;\n for (var i = 0; i < horizontalAlignment.length; i++) {\n this.dummyToNodeForHorizontalAlignment.set(\"dummy\" + i, []);\n horizontalAlignment[i].forEach(function (nodeId) {\n nodeToDummyForHorizontalAlignment.set(nodeId, \"dummy\" + i);\n self.dummyToNodeForHorizontalAlignment.get(\"dummy\" + i).push(nodeId);\n if (self.fixedNodeSet.has(nodeId)) {\n self.fixedNodesOnVertical.add(\"dummy\" + i);\n }\n });\n }\n }\n }\n\n if (CoSEConstants.RELAX_MOVEMENT_ON_CONSTRAINTS) {\n\n this.shuffle = function (array) {\n var j, x, i;\n for (i = array.length - 1; i >= 2 * array.length / 3; i--) {\n j = Math.floor(Math.random() * (i + 1));\n x = array[i];\n array[i] = array[j];\n array[j] = x;\n }\n return array;\n };\n\n this.nodesInRelativeHorizontal = [];\n this.nodesInRelativeVertical = [];\n this.nodeToRelativeConstraintMapHorizontal = new Map();\n this.nodeToRelativeConstraintMapVertical = new Map();\n this.nodeToTempPositionMapHorizontal = new Map();\n this.nodeToTempPositionMapVertical = new Map();\n\n // fill arrays and maps\n this.constraints.relativePlacementConstraint.forEach(function (constraint) {\n if (constraint.left) {\n var nodeIdLeft = nodeToDummyForVerticalAlignment.has(constraint.left) ? nodeToDummyForVerticalAlignment.get(constraint.left) : constraint.left;\n var nodeIdRight = nodeToDummyForVerticalAlignment.has(constraint.right) ? nodeToDummyForVerticalAlignment.get(constraint.right) : constraint.right;\n\n if (!self.nodesInRelativeHorizontal.includes(nodeIdLeft)) {\n self.nodesInRelativeHorizontal.push(nodeIdLeft);\n self.nodeToRelativeConstraintMapHorizontal.set(nodeIdLeft, []);\n if (self.dummyToNodeForVerticalAlignment.has(nodeIdLeft)) {\n self.nodeToTempPositionMapHorizontal.set(nodeIdLeft, self.idToNodeMap.get(self.dummyToNodeForVerticalAlignment.get(nodeIdLeft)[0]).getCenterX());\n } else {\n self.nodeToTempPositionMapHorizontal.set(nodeIdLeft, self.idToNodeMap.get(nodeIdLeft).getCenterX());\n }\n }\n if (!self.nodesInRelativeHorizontal.includes(nodeIdRight)) {\n self.nodesInRelativeHorizontal.push(nodeIdRight);\n self.nodeToRelativeConstraintMapHorizontal.set(nodeIdRight, []);\n if (self.dummyToNodeForVerticalAlignment.has(nodeIdRight)) {\n self.nodeToTempPositionMapHorizontal.set(nodeIdRight, self.idToNodeMap.get(self.dummyToNodeForVerticalAlignment.get(nodeIdRight)[0]).getCenterX());\n } else {\n self.nodeToTempPositionMapHorizontal.set(nodeIdRight, self.idToNodeMap.get(nodeIdRight).getCenterX());\n }\n }\n\n self.nodeToRelativeConstraintMapHorizontal.get(nodeIdLeft).push({ right: nodeIdRight, gap: constraint.gap });\n self.nodeToRelativeConstraintMapHorizontal.get(nodeIdRight).push({ left: nodeIdLeft, gap: constraint.gap });\n } else {\n var nodeIdTop = nodeToDummyForHorizontalAlignment.has(constraint.top) ? nodeToDummyForHorizontalAlignment.get(constraint.top) : constraint.top;\n var nodeIdBottom = nodeToDummyForHorizontalAlignment.has(constraint.bottom) ? nodeToDummyForHorizontalAlignment.get(constraint.bottom) : constraint.bottom;\n\n if (!self.nodesInRelativeVertical.includes(nodeIdTop)) {\n self.nodesInRelativeVertical.push(nodeIdTop);\n self.nodeToRelativeConstraintMapVertical.set(nodeIdTop, []);\n if (self.dummyToNodeForHorizontalAlignment.has(nodeIdTop)) {\n self.nodeToTempPositionMapVertical.set(nodeIdTop, self.idToNodeMap.get(self.dummyToNodeForHorizontalAlignment.get(nodeIdTop)[0]).getCenterY());\n } else {\n self.nodeToTempPositionMapVertical.set(nodeIdTop, self.idToNodeMap.get(nodeIdTop).getCenterY());\n }\n }\n if (!self.nodesInRelativeVertical.includes(nodeIdBottom)) {\n self.nodesInRelativeVertical.push(nodeIdBottom);\n self.nodeToRelativeConstraintMapVertical.set(nodeIdBottom, []);\n if (self.dummyToNodeForHorizontalAlignment.has(nodeIdBottom)) {\n self.nodeToTempPositionMapVertical.set(nodeIdBottom, self.idToNodeMap.get(self.dummyToNodeForHorizontalAlignment.get(nodeIdBottom)[0]).getCenterY());\n } else {\n self.nodeToTempPositionMapVertical.set(nodeIdBottom, self.idToNodeMap.get(nodeIdBottom).getCenterY());\n }\n }\n self.nodeToRelativeConstraintMapVertical.get(nodeIdTop).push({ bottom: nodeIdBottom, gap: constraint.gap });\n self.nodeToRelativeConstraintMapVertical.get(nodeIdBottom).push({ top: nodeIdTop, gap: constraint.gap });\n }\n });\n } else {\n var subGraphOnHorizontal = new Map(); // subgraph from vertical RP constraints\n var subGraphOnVertical = new Map(); // subgraph from vertical RP constraints\n\n // construct subgraphs from relative placement constraints \n this.constraints.relativePlacementConstraint.forEach(function (constraint) {\n if (constraint.left) {\n var left = nodeToDummyForVerticalAlignment.has(constraint.left) ? nodeToDummyForVerticalAlignment.get(constraint.left) : constraint.left;\n var right = nodeToDummyForVerticalAlignment.has(constraint.right) ? nodeToDummyForVerticalAlignment.get(constraint.right) : constraint.right;\n if (subGraphOnHorizontal.has(left)) {\n subGraphOnHorizontal.get(left).push(right);\n } else {\n subGraphOnHorizontal.set(left, [right]);\n }\n if (subGraphOnHorizontal.has(right)) {\n subGraphOnHorizontal.get(right).push(left);\n } else {\n subGraphOnHorizontal.set(right, [left]);\n }\n } else {\n var top = nodeToDummyForHorizontalAlignment.has(constraint.top) ? nodeToDummyForHorizontalAlignment.get(constraint.top) : constraint.top;\n var bottom = nodeToDummyForHorizontalAlignment.has(constraint.bottom) ? nodeToDummyForHorizontalAlignment.get(constraint.bottom) : constraint.bottom;\n if (subGraphOnVertical.has(top)) {\n subGraphOnVertical.get(top).push(bottom);\n } else {\n subGraphOnVertical.set(top, [bottom]);\n }\n if (subGraphOnVertical.has(bottom)) {\n subGraphOnVertical.get(bottom).push(top);\n } else {\n subGraphOnVertical.set(bottom, [top]);\n }\n }\n });\n\n // function to construct components from a given graph \n // also returns an array that keeps whether each component contains fixed node\n var constructComponents = function constructComponents(graph, fixedNodes) {\n var components = [];\n var isFixed = [];\n var queue = new LinkedList();\n var visited = new Set();\n var count = 0;\n\n graph.forEach(function (value, key) {\n if (!visited.has(key)) {\n components[count] = [];\n isFixed[count] = false;\n var currentNode = key;\n queue.push(currentNode);\n visited.add(currentNode);\n components[count].push(currentNode);\n\n while (queue.length != 0) {\n currentNode = queue.shift();\n if (fixedNodes.has(currentNode)) {\n isFixed[count] = true;\n }\n var neighbors = graph.get(currentNode);\n neighbors.forEach(function (neighbor) {\n if (!visited.has(neighbor)) {\n queue.push(neighbor);\n visited.add(neighbor);\n components[count].push(neighbor);\n }\n });\n }\n count++;\n }\n });\n\n return { components: components, isFixed: isFixed };\n };\n\n var resultOnHorizontal = constructComponents(subGraphOnHorizontal, self.fixedNodesOnHorizontal);\n this.componentsOnHorizontal = resultOnHorizontal.components;\n this.fixedComponentsOnHorizontal = resultOnHorizontal.isFixed;\n var resultOnVertical = constructComponents(subGraphOnVertical, self.fixedNodesOnVertical);\n this.componentsOnVertical = resultOnVertical.components;\n this.fixedComponentsOnVertical = resultOnVertical.isFixed;\n }\n }\n};\n\n// updates node displacements based on constraints\nCoSELayout.prototype.updateDisplacements = function () {\n var self = this;\n if (this.constraints.fixedNodeConstraint) {\n this.constraints.fixedNodeConstraint.forEach(function (nodeData) {\n var fixedNode = self.idToNodeMap.get(nodeData.nodeId);\n fixedNode.displacementX = 0;\n fixedNode.displacementY = 0;\n });\n }\n\n if (this.constraints.alignmentConstraint) {\n if (this.constraints.alignmentConstraint.vertical) {\n var allVerticalAlignments = this.constraints.alignmentConstraint.vertical;\n for (var i = 0; i < allVerticalAlignments.length; i++) {\n var totalDisplacementX = 0;\n for (var j = 0; j < allVerticalAlignments[i].length; j++) {\n if (this.fixedNodeSet.has(allVerticalAlignments[i][j])) {\n totalDisplacementX = 0;\n break;\n }\n totalDisplacementX += this.idToNodeMap.get(allVerticalAlignments[i][j]).displacementX;\n }\n var averageDisplacementX = totalDisplacementX / allVerticalAlignments[i].length;\n for (var j = 0; j < allVerticalAlignments[i].length; j++) {\n this.idToNodeMap.get(allVerticalAlignments[i][j]).displacementX = averageDisplacementX;\n }\n }\n }\n if (this.constraints.alignmentConstraint.horizontal) {\n var allHorizontalAlignments = this.constraints.alignmentConstraint.horizontal;\n for (var i = 0; i < allHorizontalAlignments.length; i++) {\n var totalDisplacementY = 0;\n for (var j = 0; j < allHorizontalAlignments[i].length; j++) {\n if (this.fixedNodeSet.has(allHorizontalAlignments[i][j])) {\n totalDisplacementY = 0;\n break;\n }\n totalDisplacementY += this.idToNodeMap.get(allHorizontalAlignments[i][j]).displacementY;\n }\n var averageDisplacementY = totalDisplacementY / allHorizontalAlignments[i].length;\n for (var j = 0; j < allHorizontalAlignments[i].length; j++) {\n this.idToNodeMap.get(allHorizontalAlignments[i][j]).displacementY = averageDisplacementY;\n }\n }\n }\n }\n\n if (this.constraints.relativePlacementConstraint) {\n\n if (CoSEConstants.RELAX_MOVEMENT_ON_CONSTRAINTS) {\n // shuffle array to randomize node processing order\n if (this.totalIterations % 10 == 0) {\n this.shuffle(this.nodesInRelativeHorizontal);\n this.shuffle(this.nodesInRelativeVertical);\n }\n\n this.nodesInRelativeHorizontal.forEach(function (nodeId) {\n if (!self.fixedNodesOnHorizontal.has(nodeId)) {\n var displacement = 0;\n if (self.dummyToNodeForVerticalAlignment.has(nodeId)) {\n displacement = self.idToNodeMap.get(self.dummyToNodeForVerticalAlignment.get(nodeId)[0]).displacementX;\n } else {\n displacement = self.idToNodeMap.get(nodeId).displacementX;\n }\n self.nodeToRelativeConstraintMapHorizontal.get(nodeId).forEach(function (constraint) {\n if (constraint.right) {\n var diff = self.nodeToTempPositionMapHorizontal.get(constraint.right) - self.nodeToTempPositionMapHorizontal.get(nodeId) - displacement;\n if (diff < constraint.gap) {\n displacement -= constraint.gap - diff;\n }\n } else {\n var diff = self.nodeToTempPositionMapHorizontal.get(nodeId) - self.nodeToTempPositionMapHorizontal.get(constraint.left) + displacement;\n if (diff < constraint.gap) {\n displacement += constraint.gap - diff;\n }\n }\n });\n self.nodeToTempPositionMapHorizontal.set(nodeId, self.nodeToTempPositionMapHorizontal.get(nodeId) + displacement);\n if (self.dummyToNodeForVerticalAlignment.has(nodeId)) {\n self.dummyToNodeForVerticalAlignment.get(nodeId).forEach(function (nodeId) {\n self.idToNodeMap.get(nodeId).displacementX = displacement;\n });\n } else {\n self.idToNodeMap.get(nodeId).displacementX = displacement;\n }\n }\n });\n\n this.nodesInRelativeVertical.forEach(function (nodeId) {\n if (!self.fixedNodesOnHorizontal.has(nodeId)) {\n var displacement = 0;\n if (self.dummyToNodeForHorizontalAlignment.has(nodeId)) {\n displacement = self.idToNodeMap.get(self.dummyToNodeForHorizontalAlignment.get(nodeId)[0]).displacementY;\n } else {\n displacement = self.idToNodeMap.get(nodeId).displacementY;\n }\n self.nodeToRelativeConstraintMapVertical.get(nodeId).forEach(function (constraint) {\n if (constraint.bottom) {\n var diff = self.nodeToTempPositionMapVertical.get(constraint.bottom) - self.nodeToTempPositionMapVertical.get(nodeId) - displacement;\n if (diff < constraint.gap) {\n displacement -= constraint.gap - diff;\n }\n } else {\n var diff = self.nodeToTempPositionMapVertical.get(nodeId) - self.nodeToTempPositionMapVertical.get(constraint.top) + displacement;\n if (diff < constraint.gap) {\n displacement += constraint.gap - diff;\n }\n }\n });\n self.nodeToTempPositionMapVertical.set(nodeId, self.nodeToTempPositionMapVertical.get(nodeId) + displacement);\n if (self.dummyToNodeForHorizontalAlignment.has(nodeId)) {\n self.dummyToNodeForHorizontalAlignment.get(nodeId).forEach(function (nodeId) {\n self.idToNodeMap.get(nodeId).displacementY = displacement;\n });\n } else {\n self.idToNodeMap.get(nodeId).displacementY = displacement;\n }\n }\n });\n } else {\n for (var i = 0; i < this.componentsOnHorizontal.length; i++) {\n var component = this.componentsOnHorizontal[i];\n if (this.fixedComponentsOnHorizontal[i]) {\n for (var j = 0; j < component.length; j++) {\n if (this.dummyToNodeForVerticalAlignment.has(component[j])) {\n this.dummyToNodeForVerticalAlignment.get(component[j]).forEach(function (nodeId) {\n self.idToNodeMap.get(nodeId).displacementX = 0;\n });\n } else {\n this.idToNodeMap.get(component[j]).displacementX = 0;\n }\n }\n } else {\n var sum = 0;\n var count = 0;\n for (var j = 0; j < component.length; j++) {\n if (this.dummyToNodeForVerticalAlignment.has(component[j])) {\n var actualNodes = this.dummyToNodeForVerticalAlignment.get(component[j]);\n sum += actualNodes.length * this.idToNodeMap.get(actualNodes[0]).displacementX;\n count += actualNodes.length;\n } else {\n sum += this.idToNodeMap.get(component[j]).displacementX;\n count++;\n }\n }\n var averageDisplacement = sum / count;\n for (var j = 0; j < component.length; j++) {\n if (this.dummyToNodeForVerticalAlignment.has(component[j])) {\n this.dummyToNodeForVerticalAlignment.get(component[j]).forEach(function (nodeId) {\n self.idToNodeMap.get(nodeId).displacementX = averageDisplacement;\n });\n } else {\n this.idToNodeMap.get(component[j]).displacementX = averageDisplacement;\n }\n }\n }\n }\n\n for (var i = 0; i < this.componentsOnVertical.length; i++) {\n var component = this.componentsOnVertical[i];\n if (this.fixedComponentsOnVertical[i]) {\n for (var j = 0; j < component.length; j++) {\n if (this.dummyToNodeForHorizontalAlignment.has(component[j])) {\n this.dummyToNodeForHorizontalAlignment.get(component[j]).forEach(function (nodeId) {\n self.idToNodeMap.get(nodeId).displacementY = 0;\n });\n } else {\n this.idToNodeMap.get(component[j]).displacementY = 0;\n }\n }\n } else {\n var sum = 0;\n var count = 0;\n for (var j = 0; j < component.length; j++) {\n if (this.dummyToNodeForHorizontalAlignment.has(component[j])) {\n var actualNodes = this.dummyToNodeForHorizontalAlignment.get(component[j]);\n sum += actualNodes.length * this.idToNodeMap.get(actualNodes[0]).displacementY;\n count += actualNodes.length;\n } else {\n sum += this.idToNodeMap.get(component[j]).displacementY;\n count++;\n }\n }\n var averageDisplacement = sum / count;\n for (var j = 0; j < component.length; j++) {\n if (this.dummyToNodeForHorizontalAlignment.has(component[j])) {\n this.dummyToNodeForHorizontalAlignment.get(component[j]).forEach(function (nodeId) {\n self.idToNodeMap.get(nodeId).displacementY = averageDisplacement;\n });\n } else {\n this.idToNodeMap.get(component[j]).displacementY = averageDisplacement;\n }\n }\n }\n }\n }\n }\n};\n\nCoSELayout.prototype.calculateNodesToApplyGravitationTo = function () {\n var nodeList = [];\n var graph;\n\n var graphs = this.graphManager.getGraphs();\n var size = graphs.length;\n var i;\n for (i = 0; i < size; i++) {\n graph = graphs[i];\n\n graph.updateConnected();\n\n if (!graph.isConnected) {\n nodeList = nodeList.concat(graph.getNodes());\n }\n }\n\n return nodeList;\n};\n\nCoSELayout.prototype.createBendpoints = function () {\n var edges = [];\n edges = edges.concat(this.graphManager.getAllEdges());\n var visited = new Set();\n var i;\n for (i = 0; i < edges.length; i++) {\n var edge = edges[i];\n\n if (!visited.has(edge)) {\n var source = edge.getSource();\n var target = edge.getTarget();\n\n if (source == target) {\n edge.getBendpoints().push(new PointD());\n edge.getBendpoints().push(new PointD());\n this.createDummyNodesForBendpoints(edge);\n visited.add(edge);\n } else {\n var edgeList = [];\n\n edgeList = edgeList.concat(source.getEdgeListToNode(target));\n edgeList = edgeList.concat(target.getEdgeListToNode(source));\n\n if (!visited.has(edgeList[0])) {\n if (edgeList.length > 1) {\n var k;\n for (k = 0; k < edgeList.length; k++) {\n var multiEdge = edgeList[k];\n multiEdge.getBendpoints().push(new PointD());\n this.createDummyNodesForBendpoints(multiEdge);\n }\n }\n edgeList.forEach(function (edge) {\n visited.add(edge);\n });\n }\n }\n }\n\n if (visited.size == edges.length) {\n break;\n }\n }\n};\n\nCoSELayout.prototype.positionNodesRadially = function (forest) {\n // We tile the trees to a grid row by row; first tree starts at (0,0)\n var currentStartingPoint = new Point(0, 0);\n var numberOfColumns = Math.ceil(Math.sqrt(forest.length));\n var height = 0;\n var currentY = 0;\n var currentX = 0;\n var point = new PointD(0, 0);\n\n for (var i = 0; i < forest.length; i++) {\n if (i % numberOfColumns == 0) {\n // Start of a new row, make the x coordinate 0, increment the\n // y coordinate with the max height of the previous row\n currentX = 0;\n currentY = height;\n\n if (i != 0) {\n currentY += CoSEConstants.DEFAULT_COMPONENT_SEPERATION;\n }\n\n height = 0;\n }\n\n var tree = forest[i];\n\n // Find the center of the tree\n var centerNode = Layout.findCenterOfTree(tree);\n\n // Set the staring point of the next tree\n currentStartingPoint.x = currentX;\n currentStartingPoint.y = currentY;\n\n // Do a radial layout starting with the center\n point = CoSELayout.radialLayout(tree, centerNode, currentStartingPoint);\n\n if (point.y > height) {\n height = Math.floor(point.y);\n }\n\n currentX = Math.floor(point.x + CoSEConstants.DEFAULT_COMPONENT_SEPERATION);\n }\n\n this.transform(new PointD(LayoutConstants.WORLD_CENTER_X - point.x / 2, LayoutConstants.WORLD_CENTER_Y - point.y / 2));\n};\n\nCoSELayout.radialLayout = function (tree, centerNode, startingPoint) {\n var radialSep = Math.max(this.maxDiagonalInTree(tree), CoSEConstants.DEFAULT_RADIAL_SEPARATION);\n CoSELayout.branchRadialLayout(centerNode, null, 0, 359, 0, radialSep);\n var bounds = LGraph.calculateBounds(tree);\n\n var transform = new Transform();\n transform.setDeviceOrgX(bounds.getMinX());\n transform.setDeviceOrgY(bounds.getMinY());\n transform.setWorldOrgX(startingPoint.x);\n transform.setWorldOrgY(startingPoint.y);\n\n for (var i = 0; i < tree.length; i++) {\n var node = tree[i];\n node.transform(transform);\n }\n\n var bottomRight = new PointD(bounds.getMaxX(), bounds.getMaxY());\n\n return transform.inverseTransformPoint(bottomRight);\n};\n\nCoSELayout.branchRadialLayout = function (node, parentOfNode, startAngle, endAngle, distance, radialSeparation) {\n // First, position this node by finding its angle.\n var halfInterval = (endAngle - startAngle + 1) / 2;\n\n if (halfInterval < 0) {\n halfInterval += 180;\n }\n\n var nodeAngle = (halfInterval + startAngle) % 360;\n var teta = nodeAngle * IGeometry.TWO_PI / 360;\n\n // Make polar to java cordinate conversion.\n var cos_teta = Math.cos(teta);\n var x_ = distance * Math.cos(teta);\n var y_ = distance * Math.sin(teta);\n\n node.setCenter(x_, y_);\n\n // Traverse all neighbors of this node and recursively call this\n // function.\n var neighborEdges = [];\n neighborEdges = neighborEdges.concat(node.getEdges());\n var childCount = neighborEdges.length;\n\n if (parentOfNode != null) {\n childCount--;\n }\n\n var branchCount = 0;\n\n var incEdgesCount = neighborEdges.length;\n var startIndex;\n\n var edges = node.getEdgesBetween(parentOfNode);\n\n // If there are multiple edges, prune them until there remains only one\n // edge.\n while (edges.length > 1) {\n //neighborEdges.remove(edges.remove(0));\n var temp = edges[0];\n edges.splice(0, 1);\n var index = neighborEdges.indexOf(temp);\n if (index >= 0) {\n neighborEdges.splice(index, 1);\n }\n incEdgesCount--;\n childCount--;\n }\n\n if (parentOfNode != null) {\n //assert edges.length == 1;\n startIndex = (neighborEdges.indexOf(edges[0]) + 1) % incEdgesCount;\n } else {\n startIndex = 0;\n }\n\n var stepAngle = Math.abs(endAngle - startAngle) / childCount;\n\n for (var i = startIndex; branchCount != childCount; i = ++i % incEdgesCount) {\n var currentNeighbor = neighborEdges[i].getOtherEnd(node);\n\n // Don't back traverse to root node in current tree.\n if (currentNeighbor == parentOfNode) {\n continue;\n }\n\n var childStartAngle = (startAngle + branchCount * stepAngle) % 360;\n var childEndAngle = (childStartAngle + stepAngle) % 360;\n\n CoSELayout.branchRadialLayout(currentNeighbor, node, childStartAngle, childEndAngle, distance + radialSeparation, radialSeparation);\n\n branchCount++;\n }\n};\n\nCoSELayout.maxDiagonalInTree = function (tree) {\n var maxDiagonal = Integer.MIN_VALUE;\n\n for (var i = 0; i < tree.length; i++) {\n var node = tree[i];\n var diagonal = node.getDiagonal();\n\n if (diagonal > maxDiagonal) {\n maxDiagonal = diagonal;\n }\n }\n\n return maxDiagonal;\n};\n\nCoSELayout.prototype.calcRepulsionRange = function () {\n // formula is 2 x (level + 1) x idealEdgeLength\n return 2 * (this.level + 1) * this.idealEdgeLength;\n};\n\n// Tiling methods\n\n// Group zero degree members whose parents are not to be tiled, create dummy parents where needed and fill memberGroups by their dummp parent id's\nCoSELayout.prototype.groupZeroDegreeMembers = function () {\n var self = this;\n // array of [parent_id x oneDegreeNode_id]\n var tempMemberGroups = {}; // A temporary map of parent node and its zero degree members\n this.memberGroups = {}; // A map of dummy parent node and its zero degree members whose parents are not to be tiled\n this.idToDummyNode = {}; // A map of id to dummy node \n\n var zeroDegree = []; // List of zero degree nodes whose parents are not to be tiled\n var allNodes = this.graphManager.getAllNodes();\n\n // Fill zero degree list\n for (var i = 0; i < allNodes.length; i++) {\n var node = allNodes[i];\n var parent = node.getParent();\n // If a node has zero degree and its parent is not to be tiled if exists add that node to zeroDegres list\n if (this.getNodeDegreeWithChildren(node) === 0 && (parent.id == undefined || !this.getToBeTiled(parent))) {\n zeroDegree.push(node);\n }\n }\n\n // Create a map of parent node and its zero degree members\n for (var i = 0; i < zeroDegree.length; i++) {\n var node = zeroDegree[i]; // Zero degree node itself\n var p_id = node.getParent().id; // Parent id\n\n if (typeof tempMemberGroups[p_id] === \"undefined\") tempMemberGroups[p_id] = [];\n\n tempMemberGroups[p_id] = tempMemberGroups[p_id].concat(node); // Push node to the list belongs to its parent in tempMemberGroups\n }\n\n // If there are at least two nodes at a level, create a dummy compound for them\n Object.keys(tempMemberGroups).forEach(function (p_id) {\n if (tempMemberGroups[p_id].length > 1) {\n var dummyCompoundId = \"DummyCompound_\" + p_id; // The id of dummy compound which will be created soon\n self.memberGroups[dummyCompoundId] = tempMemberGroups[p_id]; // Add dummy compound to memberGroups\n\n var parent = tempMemberGroups[p_id][0].getParent(); // The parent of zero degree nodes will be the parent of new dummy compound\n\n // Create a dummy compound with calculated id\n var dummyCompound = new CoSENode(self.graphManager);\n dummyCompound.id = dummyCompoundId;\n dummyCompound.paddingLeft = parent.paddingLeft || 0;\n dummyCompound.paddingRight = parent.paddingRight || 0;\n dummyCompound.paddingBottom = parent.paddingBottom || 0;\n dummyCompound.paddingTop = parent.paddingTop || 0;\n\n self.idToDummyNode[dummyCompoundId] = dummyCompound;\n\n var dummyParentGraph = self.getGraphManager().add(self.newGraph(), dummyCompound);\n var parentGraph = parent.getChild();\n\n // Add dummy compound to parent the graph\n parentGraph.add(dummyCompound);\n\n // For each zero degree node in this level remove it from its parent graph and add it to the graph of dummy parent\n for (var i = 0; i < tempMemberGroups[p_id].length; i++) {\n var node = tempMemberGroups[p_id][i];\n\n parentGraph.remove(node);\n dummyParentGraph.add(node);\n }\n }\n });\n};\n\nCoSELayout.prototype.clearCompounds = function () {\n var childGraphMap = {};\n var idToNode = {};\n\n // Get compound ordering by finding the inner one first\n this.performDFSOnCompounds();\n\n for (var i = 0; i < this.compoundOrder.length; i++) {\n\n idToNode[this.compoundOrder[i].id] = this.compoundOrder[i];\n childGraphMap[this.compoundOrder[i].id] = [].concat(this.compoundOrder[i].getChild().getNodes());\n\n // Remove children of compounds\n this.graphManager.remove(this.compoundOrder[i].getChild());\n this.compoundOrder[i].child = null;\n }\n\n this.graphManager.resetAllNodes();\n\n // Tile the removed children\n this.tileCompoundMembers(childGraphMap, idToNode);\n};\n\nCoSELayout.prototype.clearZeroDegreeMembers = function () {\n var self = this;\n var tiledZeroDegreePack = this.tiledZeroDegreePack = [];\n\n Object.keys(this.memberGroups).forEach(function (id) {\n var compoundNode = self.idToDummyNode[id]; // Get the dummy compound\n\n tiledZeroDegreePack[id] = self.tileNodes(self.memberGroups[id], compoundNode.paddingLeft + compoundNode.paddingRight);\n\n // Set the width and height of the dummy compound as calculated\n compoundNode.rect.width = tiledZeroDegreePack[id].width;\n compoundNode.rect.height = tiledZeroDegreePack[id].height;\n compoundNode.setCenter(tiledZeroDegreePack[id].centerX, tiledZeroDegreePack[id].centerY);\n\n // compound left and top margings for labels\n // when node labels are included, these values may be set to different values below and are used in tilingPostLayout,\n // otherwise they stay as zero\n compoundNode.labelMarginLeft = 0;\n compoundNode.labelMarginTop = 0;\n\n // Update compound bounds considering its label properties and set label margins for left and top\n if (CoSEConstants.NODE_DIMENSIONS_INCLUDE_LABELS) {\n\n var width = compoundNode.rect.width;\n var height = compoundNode.rect.height;\n\n if (compoundNode.labelWidth) {\n if (compoundNode.labelPosHorizontal == \"left\") {\n compoundNode.rect.x -= compoundNode.labelWidth;\n compoundNode.setWidth(width + compoundNode.labelWidth);\n compoundNode.labelMarginLeft = compoundNode.labelWidth;\n } else if (compoundNode.labelPosHorizontal == \"center\" && compoundNode.labelWidth > width) {\n compoundNode.rect.x -= (compoundNode.labelWidth - width) / 2;\n compoundNode.setWidth(compoundNode.labelWidth);\n compoundNode.labelMarginLeft = (compoundNode.labelWidth - width) / 2;\n } else if (compoundNode.labelPosHorizontal == \"right\") {\n compoundNode.setWidth(width + compoundNode.labelWidth);\n }\n }\n\n if (compoundNode.labelHeight) {\n if (compoundNode.labelPosVertical == \"top\") {\n compoundNode.rect.y -= compoundNode.labelHeight;\n compoundNode.setHeight(height + compoundNode.labelHeight);\n compoundNode.labelMarginTop = compoundNode.labelHeight;\n } else if (compoundNode.labelPosVertical == \"center\" && compoundNode.labelHeight > height) {\n compoundNode.rect.y -= (compoundNode.labelHeight - height) / 2;\n compoundNode.setHeight(compoundNode.labelHeight);\n compoundNode.labelMarginTop = (compoundNode.labelHeight - height) / 2;\n } else if (compoundNode.labelPosVertical == \"bottom\") {\n compoundNode.setHeight(height + compoundNode.labelHeight);\n }\n }\n }\n });\n};\n\nCoSELayout.prototype.repopulateCompounds = function () {\n for (var i = this.compoundOrder.length - 1; i >= 0; i--) {\n var lCompoundNode = this.compoundOrder[i];\n var id = lCompoundNode.id;\n var horizontalMargin = lCompoundNode.paddingLeft;\n var verticalMargin = lCompoundNode.paddingTop;\n var labelMarginLeft = lCompoundNode.labelMarginLeft;\n var labelMarginTop = lCompoundNode.labelMarginTop;\n\n this.adjustLocations(this.tiledMemberPack[id], lCompoundNode.rect.x, lCompoundNode.rect.y, horizontalMargin, verticalMargin, labelMarginLeft, labelMarginTop);\n }\n};\n\nCoSELayout.prototype.repopulateZeroDegreeMembers = function () {\n var self = this;\n var tiledPack = this.tiledZeroDegreePack;\n\n Object.keys(tiledPack).forEach(function (id) {\n var compoundNode = self.idToDummyNode[id]; // Get the dummy compound by its id\n var horizontalMargin = compoundNode.paddingLeft;\n var verticalMargin = compoundNode.paddingTop;\n var labelMarginLeft = compoundNode.labelMarginLeft;\n var labelMarginTop = compoundNode.labelMarginTop;\n\n // Adjust the positions of nodes wrt its compound\n self.adjustLocations(tiledPack[id], compoundNode.rect.x, compoundNode.rect.y, horizontalMargin, verticalMargin, labelMarginLeft, labelMarginTop);\n });\n};\n\nCoSELayout.prototype.getToBeTiled = function (node) {\n var id = node.id;\n //firstly check the previous results\n if (this.toBeTiled[id] != null) {\n return this.toBeTiled[id];\n }\n\n //only compound nodes are to be tiled\n var childGraph = node.getChild();\n if (childGraph == null) {\n this.toBeTiled[id] = false;\n return false;\n }\n\n var children = childGraph.getNodes(); // Get the children nodes\n\n //a compound node is not to be tiled if all of its compound children are not to be tiled\n for (var i = 0; i < children.length; i++) {\n var theChild = children[i];\n\n if (this.getNodeDegree(theChild) > 0) {\n this.toBeTiled[id] = false;\n return false;\n }\n\n //pass the children not having the compound structure\n if (theChild.getChild() == null) {\n this.toBeTiled[theChild.id] = false;\n continue;\n }\n\n if (!this.getToBeTiled(theChild)) {\n this.toBeTiled[id] = false;\n return false;\n }\n }\n this.toBeTiled[id] = true;\n return true;\n};\n\n// Get degree of a node depending of its edges and independent of its children\nCoSELayout.prototype.getNodeDegree = function (node) {\n var id = node.id;\n var edges = node.getEdges();\n var degree = 0;\n\n // For the edges connected\n for (var i = 0; i < edges.length; i++) {\n var edge = edges[i];\n if (edge.getSource().id !== edge.getTarget().id) {\n degree = degree + 1;\n }\n }\n return degree;\n};\n\n// Get degree of a node with its children\nCoSELayout.prototype.getNodeDegreeWithChildren = function (node) {\n var degree = this.getNodeDegree(node);\n if (node.getChild() == null) {\n return degree;\n }\n var children = node.getChild().getNodes();\n for (var i = 0; i < children.length; i++) {\n var child = children[i];\n degree += this.getNodeDegreeWithChildren(child);\n }\n return degree;\n};\n\nCoSELayout.prototype.performDFSOnCompounds = function () {\n this.compoundOrder = [];\n this.fillCompexOrderByDFS(this.graphManager.getRoot().getNodes());\n};\n\nCoSELayout.prototype.fillCompexOrderByDFS = function (children) {\n for (var i = 0; i < children.length; i++) {\n var child = children[i];\n if (child.getChild() != null) {\n this.fillCompexOrderByDFS(child.getChild().getNodes());\n }\n if (this.getToBeTiled(child)) {\n this.compoundOrder.push(child);\n }\n }\n};\n\n/**\n* This method places each zero degree member wrt given (x,y) coordinates (top left).\n*/\nCoSELayout.prototype.adjustLocations = function (organization, x, y, compoundHorizontalMargin, compoundVerticalMargin, compoundLabelMarginLeft, compoundLabelMarginTop) {\n x += compoundHorizontalMargin + compoundLabelMarginLeft;\n y += compoundVerticalMargin + compoundLabelMarginTop;\n\n var left = x;\n\n for (var i = 0; i < organization.rows.length; i++) {\n var row = organization.rows[i];\n x = left;\n var maxHeight = 0;\n\n for (var j = 0; j < row.length; j++) {\n var lnode = row[j];\n\n lnode.rect.x = x; // + lnode.rect.width / 2;\n lnode.rect.y = y; // + lnode.rect.height / 2;\n\n x += lnode.rect.width + organization.horizontalPadding;\n\n if (lnode.rect.height > maxHeight) maxHeight = lnode.rect.height;\n }\n\n y += maxHeight + organization.verticalPadding;\n }\n};\n\nCoSELayout.prototype.tileCompoundMembers = function (childGraphMap, idToNode) {\n var self = this;\n this.tiledMemberPack = [];\n\n Object.keys(childGraphMap).forEach(function (id) {\n // Get the compound node\n var compoundNode = idToNode[id];\n\n self.tiledMemberPack[id] = self.tileNodes(childGraphMap[id], compoundNode.paddingLeft + compoundNode.paddingRight);\n\n compoundNode.rect.width = self.tiledMemberPack[id].width;\n compoundNode.rect.height = self.tiledMemberPack[id].height;\n compoundNode.setCenter(self.tiledMemberPack[id].centerX, self.tiledMemberPack[id].centerY);\n\n // compound left and top margings for labels\n // when node labels are included, these values may be set to different values below and are used in tilingPostLayout,\n // otherwise they stay as zero\n compoundNode.labelMarginLeft = 0;\n compoundNode.labelMarginTop = 0;\n\n // Update compound bounds considering its label properties and set label margins for left and top\n if (CoSEConstants.NODE_DIMENSIONS_INCLUDE_LABELS) {\n\n var width = compoundNode.rect.width;\n var height = compoundNode.rect.height;\n\n if (compoundNode.labelWidth) {\n if (compoundNode.labelPosHorizontal == \"left\") {\n compoundNode.rect.x -= compoundNode.labelWidth;\n compoundNode.setWidth(width + compoundNode.labelWidth);\n compoundNode.labelMarginLeft = compoundNode.labelWidth;\n } else if (compoundNode.labelPosHorizontal == \"center\" && compoundNode.labelWidth > width) {\n compoundNode.rect.x -= (compoundNode.labelWidth - width) / 2;\n compoundNode.setWidth(compoundNode.labelWidth);\n compoundNode.labelMarginLeft = (compoundNode.labelWidth - width) / 2;\n } else if (compoundNode.labelPosHorizontal == \"right\") {\n compoundNode.setWidth(width + compoundNode.labelWidth);\n }\n }\n\n if (compoundNode.labelHeight) {\n if (compoundNode.labelPosVertical == \"top\") {\n compoundNode.rect.y -= compoundNode.labelHeight;\n compoundNode.setHeight(height + compoundNode.labelHeight);\n compoundNode.labelMarginTop = compoundNode.labelHeight;\n } else if (compoundNode.labelPosVertical == \"center\" && compoundNode.labelHeight > height) {\n compoundNode.rect.y -= (compoundNode.labelHeight - height) / 2;\n compoundNode.setHeight(compoundNode.labelHeight);\n compoundNode.labelMarginTop = (compoundNode.labelHeight - height) / 2;\n } else if (compoundNode.labelPosVertical == \"bottom\") {\n compoundNode.setHeight(height + compoundNode.labelHeight);\n }\n }\n }\n });\n};\n\nCoSELayout.prototype.tileNodes = function (nodes, minWidth) {\n var horizontalOrg = this.tileNodesByFavoringDim(nodes, minWidth, true);\n var verticalOrg = this.tileNodesByFavoringDim(nodes, minWidth, false);\n\n var horizontalRatio = this.getOrgRatio(horizontalOrg);\n var verticalRatio = this.getOrgRatio(verticalOrg);\n var bestOrg;\n\n // the best ratio is the one that is closer to 1 since the ratios are already normalized\n // and the best organization is the one that has the best ratio\n if (verticalRatio < horizontalRatio) {\n bestOrg = verticalOrg;\n } else {\n bestOrg = horizontalOrg;\n }\n\n return bestOrg;\n};\n\n// get the width/height ratio of the organization that is normalized so that it will not be less than 1\nCoSELayout.prototype.getOrgRatio = function (organization) {\n // get dimensions and calculate the initial ratio\n var width = organization.width;\n var height = organization.height;\n var ratio = width / height;\n\n // if the initial ratio is less then 1 then inverse it\n if (ratio < 1) {\n ratio = 1 / ratio;\n }\n\n // return the normalized ratio\n return ratio;\n};\n\n/*\n * Calculates the ideal width for the rows. This method assumes that\n * each node has the same sizes and calculates the ideal row width that\n * approximates a square shaped complex accordingly. However, since nodes would\n * have different sizes some rows would have different sizes and the resulting\n * shape would not be an exact square.\n */\nCoSELayout.prototype.calcIdealRowWidth = function (members, favorHorizontalDim) {\n // To approximate a square shaped complex we need to make complex width equal to complex height.\n // To achieve this we need to solve the following equation system for hc:\n // (x + bx) * hc - bx = (y + by) * vc - by, hc * vc = n\n // where x is the avarage width of the nodes, y is the avarage height of nodes\n // bx and by are the buffer sizes in horizontal and vertical dimensions accordingly,\n // hc and vc are the number of rows in horizontal and vertical dimensions\n // n is number of members.\n\n var verticalPadding = CoSEConstants.TILING_PADDING_VERTICAL;\n var horizontalPadding = CoSEConstants.TILING_PADDING_HORIZONTAL;\n\n // number of members\n var membersSize = members.length;\n\n // sum of the width of all members\n var totalWidth = 0;\n\n // sum of the height of all members\n var totalHeight = 0;\n\n var maxWidth = 0;\n\n // traverse all members to calculate total width and total height and get the maximum members width\n members.forEach(function (node) {\n totalWidth += node.getWidth();\n totalHeight += node.getHeight();\n\n if (node.getWidth() > maxWidth) {\n maxWidth = node.getWidth();\n }\n });\n\n // average width of the members\n var averageWidth = totalWidth / membersSize;\n\n // average height of the members\n var averageHeight = totalHeight / membersSize;\n\n // solving the initial equation system for the hc yields the following second degree equation:\n // hc^2 * (x+bx) + hc * (by - bx) - n * (y + by) = 0\n\n // the delta value to solve the equation above for hc\n var delta = Math.pow(verticalPadding - horizontalPadding, 2) + 4 * (averageWidth + horizontalPadding) * (averageHeight + verticalPadding) * membersSize;\n\n // solve the equation using delta value to calculate the horizontal count\n // that represents the number of nodes in an ideal row\n var horizontalCountDouble = (horizontalPadding - verticalPadding + Math.sqrt(delta)) / (2 * (averageWidth + horizontalPadding));\n // round the calculated horizontal count up or down according to the favored dimension\n var horizontalCount;\n\n if (favorHorizontalDim) {\n horizontalCount = Math.ceil(horizontalCountDouble);\n // if horizontalCount count is not a float value then both of rounding to floor and ceil\n // will yield the same values. Instead of repeating the same calculation try going up\n // while favoring horizontal dimension in such cases\n if (horizontalCount == horizontalCountDouble) {\n horizontalCount++;\n }\n } else {\n horizontalCount = Math.floor(horizontalCountDouble);\n }\n\n // ideal width to be calculated\n var idealWidth = horizontalCount * (averageWidth + horizontalPadding) - horizontalPadding;\n\n // if max width is bigger than calculated ideal width reset ideal width to it\n if (maxWidth > idealWidth) {\n idealWidth = maxWidth;\n }\n\n // add the left-right margins to the ideal row width\n idealWidth += horizontalPadding * 2;\n\n // return the ideal row width1\n return idealWidth;\n};\n\nCoSELayout.prototype.tileNodesByFavoringDim = function (nodes, minWidth, favorHorizontalDim) {\n var verticalPadding = CoSEConstants.TILING_PADDING_VERTICAL;\n var horizontalPadding = CoSEConstants.TILING_PADDING_HORIZONTAL;\n var tilingCompareBy = CoSEConstants.TILING_COMPARE_BY;\n var organization = {\n rows: [],\n rowWidth: [],\n rowHeight: [],\n width: 0,\n height: minWidth, // assume minHeight equals to minWidth\n verticalPadding: verticalPadding,\n horizontalPadding: horizontalPadding,\n centerX: 0,\n centerY: 0\n };\n\n if (tilingCompareBy) {\n organization.idealRowWidth = this.calcIdealRowWidth(nodes, favorHorizontalDim);\n }\n\n var getNodeArea = function getNodeArea(n) {\n return n.rect.width * n.rect.height;\n };\n\n var areaCompareFcn = function areaCompareFcn(n1, n2) {\n return getNodeArea(n2) - getNodeArea(n1);\n };\n\n // Sort the nodes in descending order of their areas\n nodes.sort(function (n1, n2) {\n var cmpBy = areaCompareFcn;\n if (organization.idealRowWidth) {\n cmpBy = tilingCompareBy;\n return cmpBy(n1.id, n2.id);\n }\n return cmpBy(n1, n2);\n });\n\n // Create the organization -> calculate compound center\n var sumCenterX = 0;\n var sumCenterY = 0;\n for (var i = 0; i < nodes.length; i++) {\n var lNode = nodes[i];\n\n sumCenterX += lNode.getCenterX();\n sumCenterY += lNode.getCenterY();\n }\n\n organization.centerX = sumCenterX / nodes.length;\n organization.centerY = sumCenterY / nodes.length;\n\n // Create the organization -> tile members\n for (var i = 0; i < nodes.length; i++) {\n var lNode = nodes[i];\n\n if (organization.rows.length == 0) {\n this.insertNodeToRow(organization, lNode, 0, minWidth);\n } else if (this.canAddHorizontal(organization, lNode.rect.width, lNode.rect.height)) {\n var rowIndex = organization.rows.length - 1;\n if (!organization.idealRowWidth) {\n rowIndex = this.getShortestRowIndex(organization);\n }\n this.insertNodeToRow(organization, lNode, rowIndex, minWidth);\n } else {\n this.insertNodeToRow(organization, lNode, organization.rows.length, minWidth);\n }\n\n this.shiftToLastRow(organization);\n }\n\n return organization;\n};\n\nCoSELayout.prototype.insertNodeToRow = function (organization, node, rowIndex, minWidth) {\n var minCompoundSize = minWidth;\n\n // Add new row if needed\n if (rowIndex == organization.rows.length) {\n var secondDimension = [];\n\n organization.rows.push(secondDimension);\n organization.rowWidth.push(minCompoundSize);\n organization.rowHeight.push(0);\n }\n\n // Update row width\n var w = organization.rowWidth[rowIndex] + node.rect.width;\n\n if (organization.rows[rowIndex].length > 0) {\n w += organization.horizontalPadding;\n }\n\n organization.rowWidth[rowIndex] = w;\n // Update compound width\n if (organization.width < w) {\n organization.width = w;\n }\n\n // Update height\n var h = node.rect.height;\n if (rowIndex > 0) h += organization.verticalPadding;\n\n var extraHeight = 0;\n if (h > organization.rowHeight[rowIndex]) {\n extraHeight = organization.rowHeight[rowIndex];\n organization.rowHeight[rowIndex] = h;\n extraHeight = organization.rowHeight[rowIndex] - extraHeight;\n }\n\n organization.height += extraHeight;\n\n // Insert node\n organization.rows[rowIndex].push(node);\n};\n\n//Scans the rows of an organization and returns the one with the min width\nCoSELayout.prototype.getShortestRowIndex = function (organization) {\n var r = -1;\n var min = Number.MAX_VALUE;\n\n for (var i = 0; i < organization.rows.length; i++) {\n if (organization.rowWidth[i] < min) {\n r = i;\n min = organization.rowWidth[i];\n }\n }\n return r;\n};\n\n//Scans the rows of an organization and returns the one with the max width\nCoSELayout.prototype.getLongestRowIndex = function (organization) {\n var r = -1;\n var max = Number.MIN_VALUE;\n\n for (var i = 0; i < organization.rows.length; i++) {\n\n if (organization.rowWidth[i] > max) {\n r = i;\n max = organization.rowWidth[i];\n }\n }\n\n return r;\n};\n\n/**\n* This method checks whether adding extra width to the organization violates\n* the aspect ratio(1) or not.\n*/\nCoSELayout.prototype.canAddHorizontal = function (organization, extraWidth, extraHeight) {\n\n // if there is an ideal row width specified use it instead of checking the aspect ratio\n if (organization.idealRowWidth) {\n var lastRowIndex = organization.rows.length - 1;\n var lastRowWidth = organization.rowWidth[lastRowIndex];\n\n // check and return if ideal row width will be exceed if the node is added to the row\n return lastRowWidth + extraWidth + organization.horizontalPadding <= organization.idealRowWidth;\n }\n\n var sri = this.getShortestRowIndex(organization);\n\n if (sri < 0) {\n return true;\n }\n\n var min = organization.rowWidth[sri];\n\n if (min + organization.horizontalPadding + extraWidth <= organization.width) return true;\n\n var hDiff = 0;\n\n // Adding to an existing row\n if (organization.rowHeight[sri] < extraHeight) {\n if (sri > 0) hDiff = extraHeight + organization.verticalPadding - organization.rowHeight[sri];\n }\n\n var add_to_row_ratio;\n if (organization.width - min >= extraWidth + organization.horizontalPadding) {\n add_to_row_ratio = (organization.height + hDiff) / (min + extraWidth + organization.horizontalPadding);\n } else {\n add_to_row_ratio = (organization.height + hDiff) / organization.width;\n }\n\n // Adding a new row for this node\n hDiff = extraHeight + organization.verticalPadding;\n var add_new_row_ratio;\n if (organization.width < extraWidth) {\n add_new_row_ratio = (organization.height + hDiff) / extraWidth;\n } else {\n add_new_row_ratio = (organization.height + hDiff) / organization.width;\n }\n\n if (add_new_row_ratio < 1) add_new_row_ratio = 1 / add_new_row_ratio;\n\n if (add_to_row_ratio < 1) add_to_row_ratio = 1 / add_to_row_ratio;\n\n return add_to_row_ratio < add_new_row_ratio;\n};\n\n//If moving the last node from the longest row and adding it to the last\n//row makes the bounding box smaller, do it.\nCoSELayout.prototype.shiftToLastRow = function (organization) {\n var longest = this.getLongestRowIndex(organization);\n var last = organization.rowWidth.length - 1;\n var row = organization.rows[longest];\n var node = row[row.length - 1];\n\n var diff = node.width + organization.horizontalPadding;\n\n // Check if there is enough space on the last row\n if (organization.width - organization.rowWidth[last] > diff && longest != last) {\n // Remove the last element of the longest row\n row.splice(-1, 1);\n\n // Push it to the last row\n organization.rows[last].push(node);\n\n organization.rowWidth[longest] = organization.rowWidth[longest] - diff;\n organization.rowWidth[last] = organization.rowWidth[last] + diff;\n organization.width = organization.rowWidth[instance.getLongestRowIndex(organization)];\n\n // Update heights of the organization\n var maxHeight = Number.MIN_VALUE;\n for (var i = 0; i < row.length; i++) {\n if (row[i].height > maxHeight) maxHeight = row[i].height;\n }\n if (longest > 0) maxHeight += organization.verticalPadding;\n\n var prevTotal = organization.rowHeight[longest] + organization.rowHeight[last];\n\n organization.rowHeight[longest] = maxHeight;\n if (organization.rowHeight[last] < node.height + organization.verticalPadding) organization.rowHeight[last] = node.height + organization.verticalPadding;\n\n var finalTotal = organization.rowHeight[longest] + organization.rowHeight[last];\n organization.height += finalTotal - prevTotal;\n\n this.shiftToLastRow(organization);\n }\n};\n\nCoSELayout.prototype.tilingPreLayout = function () {\n if (CoSEConstants.TILE) {\n // Find zero degree nodes and create a compound for each level\n this.groupZeroDegreeMembers();\n // Tile and clear children of each compound\n this.clearCompounds();\n // Separately tile and clear zero degree nodes for each level\n this.clearZeroDegreeMembers();\n }\n};\n\nCoSELayout.prototype.tilingPostLayout = function () {\n if (CoSEConstants.TILE) {\n this.repopulateZeroDegreeMembers();\n this.repopulateCompounds();\n }\n};\n\n// -----------------------------------------------------------------------------\n// Section: Tree Reduction methods\n// -----------------------------------------------------------------------------\n// Reduce trees \nCoSELayout.prototype.reduceTrees = function () {\n var prunedNodesAll = [];\n var containsLeaf = true;\n var node;\n\n while (containsLeaf) {\n var allNodes = this.graphManager.getAllNodes();\n var prunedNodesInStepTemp = [];\n containsLeaf = false;\n\n for (var i = 0; i < allNodes.length; i++) {\n node = allNodes[i];\n if (node.getEdges().length == 1 && !node.getEdges()[0].isInterGraph && node.getChild() == null) {\n if (CoSEConstants.PURE_INCREMENTAL) {\n var otherEnd = node.getEdges()[0].getOtherEnd(node);\n var relativePosition = new DimensionD(node.getCenterX() - otherEnd.getCenterX(), node.getCenterY() - otherEnd.getCenterY());\n prunedNodesInStepTemp.push([node, node.getEdges()[0], node.getOwner(), relativePosition]);\n } else {\n prunedNodesInStepTemp.push([node, node.getEdges()[0], node.getOwner()]);\n }\n containsLeaf = true;\n }\n }\n if (containsLeaf == true) {\n var prunedNodesInStep = [];\n for (var j = 0; j < prunedNodesInStepTemp.length; j++) {\n if (prunedNodesInStepTemp[j][0].getEdges().length == 1) {\n prunedNodesInStep.push(prunedNodesInStepTemp[j]);\n prunedNodesInStepTemp[j][0].getOwner().remove(prunedNodesInStepTemp[j][0]);\n }\n }\n prunedNodesAll.push(prunedNodesInStep);\n this.graphManager.resetAllNodes();\n this.graphManager.resetAllEdges();\n }\n }\n this.prunedNodesAll = prunedNodesAll;\n};\n\n// Grow tree one step \nCoSELayout.prototype.growTree = function (prunedNodesAll) {\n var lengthOfPrunedNodesInStep = prunedNodesAll.length;\n var prunedNodesInStep = prunedNodesAll[lengthOfPrunedNodesInStep - 1];\n\n var nodeData;\n for (var i = 0; i < prunedNodesInStep.length; i++) {\n nodeData = prunedNodesInStep[i];\n\n this.findPlaceforPrunedNode(nodeData);\n\n nodeData[2].add(nodeData[0]);\n nodeData[2].add(nodeData[1], nodeData[1].source, nodeData[1].target);\n }\n\n prunedNodesAll.splice(prunedNodesAll.length - 1, 1);\n this.graphManager.resetAllNodes();\n this.graphManager.resetAllEdges();\n};\n\n// Find an appropriate position to replace pruned node, this method can be improved\nCoSELayout.prototype.findPlaceforPrunedNode = function (nodeData) {\n\n var gridForPrunedNode;\n var nodeToConnect;\n var prunedNode = nodeData[0];\n if (prunedNode == nodeData[1].source) {\n nodeToConnect = nodeData[1].target;\n } else {\n nodeToConnect = nodeData[1].source;\n }\n\n if (CoSEConstants.PURE_INCREMENTAL) {\n prunedNode.setCenter(nodeToConnect.getCenterX() + nodeData[3].getWidth(), nodeToConnect.getCenterY() + nodeData[3].getHeight());\n } else {\n var startGridX = nodeToConnect.startX;\n var finishGridX = nodeToConnect.finishX;\n var startGridY = nodeToConnect.startY;\n var finishGridY = nodeToConnect.finishY;\n\n var upNodeCount = 0;\n var downNodeCount = 0;\n var rightNodeCount = 0;\n var leftNodeCount = 0;\n var controlRegions = [upNodeCount, rightNodeCount, downNodeCount, leftNodeCount];\n\n if (startGridY > 0) {\n for (var i = startGridX; i <= finishGridX; i++) {\n controlRegions[0] += this.grid[i][startGridY - 1].length + this.grid[i][startGridY].length - 1;\n }\n }\n if (finishGridX < this.grid.length - 1) {\n for (var i = startGridY; i <= finishGridY; i++) {\n controlRegions[1] += this.grid[finishGridX + 1][i].length + this.grid[finishGridX][i].length - 1;\n }\n }\n if (finishGridY < this.grid[0].length - 1) {\n for (var i = startGridX; i <= finishGridX; i++) {\n controlRegions[2] += this.grid[i][finishGridY + 1].length + this.grid[i][finishGridY].length - 1;\n }\n }\n if (startGridX > 0) {\n for (var i = startGridY; i <= finishGridY; i++) {\n controlRegions[3] += this.grid[startGridX - 1][i].length + this.grid[startGridX][i].length - 1;\n }\n }\n var min = Integer.MAX_VALUE;\n var minCount;\n var minIndex;\n for (var j = 0; j < controlRegions.length; j++) {\n if (controlRegions[j] < min) {\n min = controlRegions[j];\n minCount = 1;\n minIndex = j;\n } else if (controlRegions[j] == min) {\n minCount++;\n }\n }\n\n if (minCount == 3 && min == 0) {\n if (controlRegions[0] == 0 && controlRegions[1] == 0 && controlRegions[2] == 0) {\n gridForPrunedNode = 1;\n } else if (controlRegions[0] == 0 && controlRegions[1] == 0 && controlRegions[3] == 0) {\n gridForPrunedNode = 0;\n } else if (controlRegions[0] == 0 && controlRegions[2] == 0 && controlRegions[3] == 0) {\n gridForPrunedNode = 3;\n } else if (controlRegions[1] == 0 && controlRegions[2] == 0 && controlRegions[3] == 0) {\n gridForPrunedNode = 2;\n }\n } else if (minCount == 2 && min == 0) {\n var random = Math.floor(Math.random() * 2);\n if (controlRegions[0] == 0 && controlRegions[1] == 0) {\n ;\n if (random == 0) {\n gridForPrunedNode = 0;\n } else {\n gridForPrunedNode = 1;\n }\n } else if (controlRegions[0] == 0 && controlRegions[2] == 0) {\n if (random == 0) {\n gridForPrunedNode = 0;\n } else {\n gridForPrunedNode = 2;\n }\n } else if (controlRegions[0] == 0 && controlRegions[3] == 0) {\n if (random == 0) {\n gridForPrunedNode = 0;\n } else {\n gridForPrunedNode = 3;\n }\n } else if (controlRegions[1] == 0 && controlRegions[2] == 0) {\n if (random == 0) {\n gridForPrunedNode = 1;\n } else {\n gridForPrunedNode = 2;\n }\n } else if (controlRegions[1] == 0 && controlRegions[3] == 0) {\n if (random == 0) {\n gridForPrunedNode = 1;\n } else {\n gridForPrunedNode = 3;\n }\n } else {\n if (random == 0) {\n gridForPrunedNode = 2;\n } else {\n gridForPrunedNode = 3;\n }\n }\n } else if (minCount == 4 && min == 0) {\n var random = Math.floor(Math.random() * 4);\n gridForPrunedNode = random;\n } else {\n gridForPrunedNode = minIndex;\n }\n\n if (gridForPrunedNode == 0) {\n prunedNode.setCenter(nodeToConnect.getCenterX(), nodeToConnect.getCenterY() - nodeToConnect.getHeight() / 2 - FDLayoutConstants.DEFAULT_EDGE_LENGTH - prunedNode.getHeight() / 2);\n } else if (gridForPrunedNode == 1) {\n prunedNode.setCenter(nodeToConnect.getCenterX() + nodeToConnect.getWidth() / 2 + FDLayoutConstants.DEFAULT_EDGE_LENGTH + prunedNode.getWidth() / 2, nodeToConnect.getCenterY());\n } else if (gridForPrunedNode == 2) {\n prunedNode.setCenter(nodeToConnect.getCenterX(), nodeToConnect.getCenterY() + nodeToConnect.getHeight() / 2 + FDLayoutConstants.DEFAULT_EDGE_LENGTH + prunedNode.getHeight() / 2);\n } else {\n prunedNode.setCenter(nodeToConnect.getCenterX() - nodeToConnect.getWidth() / 2 - FDLayoutConstants.DEFAULT_EDGE_LENGTH - prunedNode.getWidth() / 2, nodeToConnect.getCenterY());\n }\n }\n};\n\nmodule.exports = CoSELayout;\n\n/***/ }),\n\n/***/ 991:\n/***/ ((module, __unused_webpack_exports, __webpack_require__) => {\n\n\n\nvar FDLayoutNode = __webpack_require__(551).FDLayoutNode;\nvar IMath = __webpack_require__(551).IMath;\n\nfunction CoSENode(gm, loc, size, vNode) {\n FDLayoutNode.call(this, gm, loc, size, vNode);\n}\n\nCoSENode.prototype = Object.create(FDLayoutNode.prototype);\nfor (var prop in FDLayoutNode) {\n CoSENode[prop] = FDLayoutNode[prop];\n}\n\nCoSENode.prototype.calculateDisplacement = function () {\n var layout = this.graphManager.getLayout();\n // this check is for compound nodes that contain fixed nodes\n if (this.getChild() != null && this.fixedNodeWeight) {\n this.displacementX += layout.coolingFactor * (this.springForceX + this.repulsionForceX + this.gravitationForceX) / this.fixedNodeWeight;\n this.displacementY += layout.coolingFactor * (this.springForceY + this.repulsionForceY + this.gravitationForceY) / this.fixedNodeWeight;\n } else {\n this.displacementX += layout.coolingFactor * (this.springForceX + this.repulsionForceX + this.gravitationForceX) / this.noOfChildren;\n this.displacementY += layout.coolingFactor * (this.springForceY + this.repulsionForceY + this.gravitationForceY) / this.noOfChildren;\n }\n\n if (Math.abs(this.displacementX) > layout.coolingFactor * layout.maxNodeDisplacement) {\n this.displacementX = layout.coolingFactor * layout.maxNodeDisplacement * IMath.sign(this.displacementX);\n }\n\n if (Math.abs(this.displacementY) > layout.coolingFactor * layout.maxNodeDisplacement) {\n this.displacementY = layout.coolingFactor * layout.maxNodeDisplacement * IMath.sign(this.displacementY);\n }\n\n // non-empty compound node, propogate movement to children as well\n if (this.child && this.child.getNodes().length > 0) {\n this.propogateDisplacementToChildren(this.displacementX, this.displacementY);\n }\n};\n\nCoSENode.prototype.propogateDisplacementToChildren = function (dX, dY) {\n var nodes = this.getChild().getNodes();\n var node;\n for (var i = 0; i < nodes.length; i++) {\n node = nodes[i];\n if (node.getChild() == null) {\n node.displacementX += dX;\n node.displacementY += dY;\n } else {\n node.propogateDisplacementToChildren(dX, dY);\n }\n }\n};\n\nCoSENode.prototype.move = function () {\n var layout = this.graphManager.getLayout();\n\n // a simple node or an empty compound node, move it\n if (this.child == null || this.child.getNodes().length == 0) {\n this.moveBy(this.displacementX, this.displacementY);\n\n layout.totalDisplacement += Math.abs(this.displacementX) + Math.abs(this.displacementY);\n }\n\n this.springForceX = 0;\n this.springForceY = 0;\n this.repulsionForceX = 0;\n this.repulsionForceY = 0;\n this.gravitationForceX = 0;\n this.gravitationForceY = 0;\n this.displacementX = 0;\n this.displacementY = 0;\n};\n\nCoSENode.prototype.setPred1 = function (pred1) {\n this.pred1 = pred1;\n};\n\nCoSENode.prototype.getPred1 = function () {\n return pred1;\n};\n\nCoSENode.prototype.getPred2 = function () {\n return pred2;\n};\n\nCoSENode.prototype.setNext = function (next) {\n this.next = next;\n};\n\nCoSENode.prototype.getNext = function () {\n return next;\n};\n\nCoSENode.prototype.setProcessed = function (processed) {\n this.processed = processed;\n};\n\nCoSENode.prototype.isProcessed = function () {\n return processed;\n};\n\nmodule.exports = CoSENode;\n\n/***/ }),\n\n/***/ 902:\n/***/ ((module, __unused_webpack_exports, __webpack_require__) => {\n\n\n\nfunction _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }\n\nvar CoSEConstants = __webpack_require__(806);\nvar LinkedList = __webpack_require__(551).LinkedList;\nvar Matrix = __webpack_require__(551).Matrix;\nvar SVD = __webpack_require__(551).SVD;\n\nfunction ConstraintHandler() {}\n\nConstraintHandler.handleConstraints = function (layout) {\n // let layout = this.graphManager.getLayout();\n\n // get constraints from layout\n var constraints = {};\n constraints.fixedNodeConstraint = layout.constraints.fixedNodeConstraint;\n constraints.alignmentConstraint = layout.constraints.alignmentConstraint;\n constraints.relativePlacementConstraint = layout.constraints.relativePlacementConstraint;\n\n var idToNodeMap = new Map();\n var nodeIndexes = new Map();\n var xCoords = [];\n var yCoords = [];\n\n var allNodes = layout.getAllNodes();\n var index = 0;\n // fill index map and coordinates\n for (var i = 0; i < allNodes.length; i++) {\n var node = allNodes[i];\n if (node.getChild() == null) {\n nodeIndexes.set(node.id, index++);\n xCoords.push(node.getCenterX());\n yCoords.push(node.getCenterY());\n idToNodeMap.set(node.id, node);\n }\n }\n\n // if there exists relative placement constraint without gap value, set it to default \n if (constraints.relativePlacementConstraint) {\n constraints.relativePlacementConstraint.forEach(function (constraint) {\n if (!constraint.gap && constraint.gap != 0) {\n if (constraint.left) {\n constraint.gap = CoSEConstants.DEFAULT_EDGE_LENGTH + idToNodeMap.get(constraint.left).getWidth() / 2 + idToNodeMap.get(constraint.right).getWidth() / 2;\n } else {\n constraint.gap = CoSEConstants.DEFAULT_EDGE_LENGTH + idToNodeMap.get(constraint.top).getHeight() / 2 + idToNodeMap.get(constraint.bottom).getHeight() / 2;\n }\n }\n });\n }\n\n /* auxiliary functions */\n\n // calculate difference between two position objects\n var calculatePositionDiff = function calculatePositionDiff(pos1, pos2) {\n return { x: pos1.x - pos2.x, y: pos1.y - pos2.y };\n };\n\n // calculate average position of the nodes\n var calculateAvgPosition = function calculateAvgPosition(nodeIdSet) {\n var xPosSum = 0;\n var yPosSum = 0;\n nodeIdSet.forEach(function (nodeId) {\n xPosSum += xCoords[nodeIndexes.get(nodeId)];\n yPosSum += yCoords[nodeIndexes.get(nodeId)];\n });\n\n return { x: xPosSum / nodeIdSet.size, y: yPosSum / nodeIdSet.size };\n };\n\n // find an appropriate positioning for the nodes in a given graph according to relative placement constraints\n // this function also takes the fixed nodes and alignment constraints into account\n // graph: dag to be evaluated, direction: \"horizontal\" or \"vertical\", \n // fixedNodes: set of fixed nodes to consider during evaluation, dummyPositions: appropriate coordinates of the dummy nodes \n var findAppropriatePositionForRelativePlacement = function findAppropriatePositionForRelativePlacement(graph, direction, fixedNodes, dummyPositions, componentSources) {\n\n // find union of two sets\n function setUnion(setA, setB) {\n var union = new Set(setA);\n var _iteratorNormalCompletion = true;\n var _didIteratorError = false;\n var _iteratorError = undefined;\n\n try {\n for (var _iterator = setB[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n var elem = _step.value;\n\n union.add(elem);\n }\n } catch (err) {\n _didIteratorError = true;\n _iteratorError = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion && _iterator.return) {\n _iterator.return();\n }\n } finally {\n if (_didIteratorError) {\n throw _iteratorError;\n }\n }\n }\n\n return union;\n }\n\n // find indegree count for each node\n var inDegrees = new Map();\n\n graph.forEach(function (value, key) {\n inDegrees.set(key, 0);\n });\n graph.forEach(function (value, key) {\n value.forEach(function (adjacent) {\n inDegrees.set(adjacent.id, inDegrees.get(adjacent.id) + 1);\n });\n });\n\n var positionMap = new Map(); // keeps the position for each node\n var pastMap = new Map(); // keeps the predecessors(past) of a node\n var queue = new LinkedList();\n inDegrees.forEach(function (value, key) {\n if (value == 0) {\n queue.push(key);\n if (!fixedNodes) {\n if (direction == \"horizontal\") {\n positionMap.set(key, nodeIndexes.has(key) ? xCoords[nodeIndexes.get(key)] : dummyPositions.get(key));\n } else {\n positionMap.set(key, nodeIndexes.has(key) ? yCoords[nodeIndexes.get(key)] : dummyPositions.get(key));\n }\n }\n } else {\n positionMap.set(key, Number.NEGATIVE_INFINITY);\n }\n if (fixedNodes) {\n pastMap.set(key, new Set([key]));\n }\n });\n\n // align sources of each component in enforcement phase\n if (fixedNodes) {\n componentSources.forEach(function (component) {\n var fixedIds = [];\n component.forEach(function (nodeId) {\n if (fixedNodes.has(nodeId)) {\n fixedIds.push(nodeId);\n }\n });\n if (fixedIds.length > 0) {\n var position = 0;\n fixedIds.forEach(function (fixedId) {\n if (direction == \"horizontal\") {\n positionMap.set(fixedId, nodeIndexes.has(fixedId) ? xCoords[nodeIndexes.get(fixedId)] : dummyPositions.get(fixedId));\n position += positionMap.get(fixedId);\n } else {\n positionMap.set(fixedId, nodeIndexes.has(fixedId) ? yCoords[nodeIndexes.get(fixedId)] : dummyPositions.get(fixedId));\n position += positionMap.get(fixedId);\n }\n });\n position = position / fixedIds.length;\n component.forEach(function (nodeId) {\n if (!fixedNodes.has(nodeId)) {\n positionMap.set(nodeId, position);\n }\n });\n } else {\n var _position = 0;\n component.forEach(function (nodeId) {\n if (direction == \"horizontal\") {\n _position += nodeIndexes.has(nodeId) ? xCoords[nodeIndexes.get(nodeId)] : dummyPositions.get(nodeId);\n } else {\n _position += nodeIndexes.has(nodeId) ? yCoords[nodeIndexes.get(nodeId)] : dummyPositions.get(nodeId);\n }\n });\n _position = _position / component.length;\n component.forEach(function (nodeId) {\n positionMap.set(nodeId, _position);\n });\n }\n });\n }\n\n // calculate positions of the nodes\n\n var _loop = function _loop() {\n var currentNode = queue.shift();\n var neighbors = graph.get(currentNode);\n neighbors.forEach(function (neighbor) {\n if (positionMap.get(neighbor.id) < positionMap.get(currentNode) + neighbor.gap) {\n if (fixedNodes && fixedNodes.has(neighbor.id)) {\n var fixedPosition = void 0;\n if (direction == \"horizontal\") {\n fixedPosition = nodeIndexes.has(neighbor.id) ? xCoords[nodeIndexes.get(neighbor.id)] : dummyPositions.get(neighbor.id);\n } else {\n fixedPosition = nodeIndexes.has(neighbor.id) ? yCoords[nodeIndexes.get(neighbor.id)] : dummyPositions.get(neighbor.id);\n }\n positionMap.set(neighbor.id, fixedPosition); // TODO: may do unnecessary work\n if (fixedPosition < positionMap.get(currentNode) + neighbor.gap) {\n var diff = positionMap.get(currentNode) + neighbor.gap - fixedPosition;\n pastMap.get(currentNode).forEach(function (nodeId) {\n positionMap.set(nodeId, positionMap.get(nodeId) - diff);\n });\n }\n } else {\n positionMap.set(neighbor.id, positionMap.get(currentNode) + neighbor.gap);\n }\n }\n inDegrees.set(neighbor.id, inDegrees.get(neighbor.id) - 1);\n if (inDegrees.get(neighbor.id) == 0) {\n queue.push(neighbor.id);\n }\n if (fixedNodes) {\n pastMap.set(neighbor.id, setUnion(pastMap.get(currentNode), pastMap.get(neighbor.id)));\n }\n });\n };\n\n while (queue.length != 0) {\n _loop();\n }\n\n // readjust position of the nodes after enforcement\n if (fixedNodes) {\n // find indegree count for each node\n var sinkNodes = new Set();\n\n graph.forEach(function (value, key) {\n if (value.length == 0) {\n sinkNodes.add(key);\n }\n });\n\n var _components = [];\n pastMap.forEach(function (value, key) {\n if (sinkNodes.has(key)) {\n var isFixedComponent = false;\n var _iteratorNormalCompletion2 = true;\n var _didIteratorError2 = false;\n var _iteratorError2 = undefined;\n\n try {\n for (var _iterator2 = value[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {\n var nodeId = _step2.value;\n\n if (fixedNodes.has(nodeId)) {\n isFixedComponent = true;\n }\n }\n } catch (err) {\n _didIteratorError2 = true;\n _iteratorError2 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion2 && _iterator2.return) {\n _iterator2.return();\n }\n } finally {\n if (_didIteratorError2) {\n throw _iteratorError2;\n }\n }\n }\n\n if (!isFixedComponent) {\n var isExist = false;\n var existAt = void 0;\n _components.forEach(function (component, index) {\n if (component.has([].concat(_toConsumableArray(value))[0])) {\n isExist = true;\n existAt = index;\n }\n });\n if (!isExist) {\n _components.push(new Set(value));\n } else {\n value.forEach(function (ele) {\n _components[existAt].add(ele);\n });\n }\n }\n }\n });\n\n _components.forEach(function (component, index) {\n var minBefore = Number.POSITIVE_INFINITY;\n var minAfter = Number.POSITIVE_INFINITY;\n var maxBefore = Number.NEGATIVE_INFINITY;\n var maxAfter = Number.NEGATIVE_INFINITY;\n\n var _iteratorNormalCompletion3 = true;\n var _didIteratorError3 = false;\n var _iteratorError3 = undefined;\n\n try {\n for (var _iterator3 = component[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {\n var nodeId = _step3.value;\n\n var posBefore = void 0;\n if (direction == \"horizontal\") {\n posBefore = nodeIndexes.has(nodeId) ? xCoords[nodeIndexes.get(nodeId)] : dummyPositions.get(nodeId);\n } else {\n posBefore = nodeIndexes.has(nodeId) ? yCoords[nodeIndexes.get(nodeId)] : dummyPositions.get(nodeId);\n }\n var posAfter = positionMap.get(nodeId);\n if (posBefore < minBefore) {\n minBefore = posBefore;\n }\n if (posBefore > maxBefore) {\n maxBefore = posBefore;\n }\n if (posAfter < minAfter) {\n minAfter = posAfter;\n }\n if (posAfter > maxAfter) {\n maxAfter = posAfter;\n }\n }\n } catch (err) {\n _didIteratorError3 = true;\n _iteratorError3 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion3 && _iterator3.return) {\n _iterator3.return();\n }\n } finally {\n if (_didIteratorError3) {\n throw _iteratorError3;\n }\n }\n }\n\n var diff = (minBefore + maxBefore) / 2 - (minAfter + maxAfter) / 2;\n\n var _iteratorNormalCompletion4 = true;\n var _didIteratorError4 = false;\n var _iteratorError4 = undefined;\n\n try {\n for (var _iterator4 = component[Symbol.iterator](), _step4; !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = true) {\n var _nodeId = _step4.value;\n\n positionMap.set(_nodeId, positionMap.get(_nodeId) + diff);\n }\n } catch (err) {\n _didIteratorError4 = true;\n _iteratorError4 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion4 && _iterator4.return) {\n _iterator4.return();\n }\n } finally {\n if (_didIteratorError4) {\n throw _iteratorError4;\n }\n }\n }\n });\n }\n\n return positionMap;\n };\n\n // find transformation based on rel. placement constraints if there are both alignment and rel. placement constraints\n // or if there are only rel. placement contraints where the largest component isn't sufficiently large\n var applyReflectionForRelativePlacement = function applyReflectionForRelativePlacement(relativePlacementConstraints) {\n // variables to count votes\n var reflectOnY = 0,\n notReflectOnY = 0;\n var reflectOnX = 0,\n notReflectOnX = 0;\n\n relativePlacementConstraints.forEach(function (constraint) {\n if (constraint.left) {\n xCoords[nodeIndexes.get(constraint.left)] - xCoords[nodeIndexes.get(constraint.right)] >= 0 ? reflectOnY++ : notReflectOnY++;\n } else {\n yCoords[nodeIndexes.get(constraint.top)] - yCoords[nodeIndexes.get(constraint.bottom)] >= 0 ? reflectOnX++ : notReflectOnX++;\n }\n });\n\n if (reflectOnY > notReflectOnY && reflectOnX > notReflectOnX) {\n for (var _i = 0; _i < nodeIndexes.size; _i++) {\n xCoords[_i] = -1 * xCoords[_i];\n yCoords[_i] = -1 * yCoords[_i];\n }\n } else if (reflectOnY > notReflectOnY) {\n for (var _i2 = 0; _i2 < nodeIndexes.size; _i2++) {\n xCoords[_i2] = -1 * xCoords[_i2];\n }\n } else if (reflectOnX > notReflectOnX) {\n for (var _i3 = 0; _i3 < nodeIndexes.size; _i3++) {\n yCoords[_i3] = -1 * yCoords[_i3];\n }\n }\n };\n\n // find weakly connected components in undirected graph\n var findComponents = function findComponents(graph) {\n // find weakly connected components in dag\n var components = [];\n var queue = new LinkedList();\n var visited = new Set();\n var count = 0;\n\n graph.forEach(function (value, key) {\n if (!visited.has(key)) {\n components[count] = [];\n var _currentNode = key;\n queue.push(_currentNode);\n visited.add(_currentNode);\n components[count].push(_currentNode);\n\n while (queue.length != 0) {\n _currentNode = queue.shift();\n var neighbors = graph.get(_currentNode);\n neighbors.forEach(function (neighbor) {\n if (!visited.has(neighbor.id)) {\n queue.push(neighbor.id);\n visited.add(neighbor.id);\n components[count].push(neighbor.id);\n }\n });\n }\n count++;\n }\n });\n return components;\n };\n\n // return undirected version of given dag\n var dagToUndirected = function dagToUndirected(dag) {\n var undirected = new Map();\n\n dag.forEach(function (value, key) {\n undirected.set(key, []);\n });\n\n dag.forEach(function (value, key) {\n value.forEach(function (adjacent) {\n undirected.get(key).push(adjacent);\n undirected.get(adjacent.id).push({ id: key, gap: adjacent.gap, direction: adjacent.direction });\n });\n });\n\n return undirected;\n };\n\n // return reversed (directions inverted) version of given dag\n var dagToReversed = function dagToReversed(dag) {\n var reversed = new Map();\n\n dag.forEach(function (value, key) {\n reversed.set(key, []);\n });\n\n dag.forEach(function (value, key) {\n value.forEach(function (adjacent) {\n reversed.get(adjacent.id).push({ id: key, gap: adjacent.gap, direction: adjacent.direction });\n });\n });\n\n return reversed;\n };\n\n /**** apply transformation to the initial draft layout to better align with constrained nodes ****/\n // solve the Orthogonal Procrustean Problem to rotate and/or reflect initial draft layout\n // here we follow the solution in Chapter 20.2 of Borg, I. & Groenen, P. (2005) Modern Multidimensional Scaling: Theory and Applications \n\n /* construct source and target configurations */\n\n var targetMatrix = []; // A - target configuration\n var sourceMatrix = []; // B - source configuration \n var standardTransformation = false; // false for no transformation, true for standart (Procrustes) transformation (rotation and/or reflection)\n var reflectionType = false; // false/true for reflection check, 'reflectOnX', 'reflectOnY' or 'reflectOnBoth' for reflection type if necessary\n var fixedNodes = new Set();\n var dag = new Map(); // adjacency list to keep directed acyclic graph (dag) that consists of relative placement constraints\n var dagUndirected = new Map(); // undirected version of the dag\n var components = []; // weakly connected components\n\n // fill fixedNodes collection to use later\n if (constraints.fixedNodeConstraint) {\n constraints.fixedNodeConstraint.forEach(function (nodeData) {\n fixedNodes.add(nodeData.nodeId);\n });\n }\n\n // construct dag from relative placement constraints \n if (constraints.relativePlacementConstraint) {\n // construct both directed and undirected version of the dag\n constraints.relativePlacementConstraint.forEach(function (constraint) {\n if (constraint.left) {\n if (dag.has(constraint.left)) {\n dag.get(constraint.left).push({ id: constraint.right, gap: constraint.gap, direction: \"horizontal\" });\n } else {\n dag.set(constraint.left, [{ id: constraint.right, gap: constraint.gap, direction: \"horizontal\" }]);\n }\n if (!dag.has(constraint.right)) {\n dag.set(constraint.right, []);\n }\n } else {\n if (dag.has(constraint.top)) {\n dag.get(constraint.top).push({ id: constraint.bottom, gap: constraint.gap, direction: \"vertical\" });\n } else {\n dag.set(constraint.top, [{ id: constraint.bottom, gap: constraint.gap, direction: \"vertical\" }]);\n }\n if (!dag.has(constraint.bottom)) {\n dag.set(constraint.bottom, []);\n }\n }\n });\n\n dagUndirected = dagToUndirected(dag);\n components = findComponents(dagUndirected);\n }\n\n if (CoSEConstants.TRANSFORM_ON_CONSTRAINT_HANDLING) {\n // first check fixed node constraint\n if (constraints.fixedNodeConstraint && constraints.fixedNodeConstraint.length > 1) {\n constraints.fixedNodeConstraint.forEach(function (nodeData, i) {\n targetMatrix[i] = [nodeData.position.x, nodeData.position.y];\n sourceMatrix[i] = [xCoords[nodeIndexes.get(nodeData.nodeId)], yCoords[nodeIndexes.get(nodeData.nodeId)]];\n });\n standardTransformation = true;\n } else if (constraints.alignmentConstraint) {\n (function () {\n // then check alignment constraint\n var count = 0;\n if (constraints.alignmentConstraint.vertical) {\n var verticalAlign = constraints.alignmentConstraint.vertical;\n\n var _loop2 = function _loop2(_i4) {\n var alignmentSet = new Set();\n verticalAlign[_i4].forEach(function (nodeId) {\n alignmentSet.add(nodeId);\n });\n var intersection = new Set([].concat(_toConsumableArray(alignmentSet)).filter(function (x) {\n return fixedNodes.has(x);\n }));\n var xPos = void 0;\n if (intersection.size > 0) xPos = xCoords[nodeIndexes.get(intersection.values().next().value)];else xPos = calculateAvgPosition(alignmentSet).x;\n\n verticalAlign[_i4].forEach(function (nodeId) {\n targetMatrix[count] = [xPos, yCoords[nodeIndexes.get(nodeId)]];\n sourceMatrix[count] = [xCoords[nodeIndexes.get(nodeId)], yCoords[nodeIndexes.get(nodeId)]];\n count++;\n });\n };\n\n for (var _i4 = 0; _i4 < verticalAlign.length; _i4++) {\n _loop2(_i4);\n }\n standardTransformation = true;\n }\n if (constraints.alignmentConstraint.horizontal) {\n var horizontalAlign = constraints.alignmentConstraint.horizontal;\n\n var _loop3 = function _loop3(_i5) {\n var alignmentSet = new Set();\n horizontalAlign[_i5].forEach(function (nodeId) {\n alignmentSet.add(nodeId);\n });\n var intersection = new Set([].concat(_toConsumableArray(alignmentSet)).filter(function (x) {\n return fixedNodes.has(x);\n }));\n var yPos = void 0;\n if (intersection.size > 0) yPos = xCoords[nodeIndexes.get(intersection.values().next().value)];else yPos = calculateAvgPosition(alignmentSet).y;\n\n horizontalAlign[_i5].forEach(function (nodeId) {\n targetMatrix[count] = [xCoords[nodeIndexes.get(nodeId)], yPos];\n sourceMatrix[count] = [xCoords[nodeIndexes.get(nodeId)], yCoords[nodeIndexes.get(nodeId)]];\n count++;\n });\n };\n\n for (var _i5 = 0; _i5 < horizontalAlign.length; _i5++) {\n _loop3(_i5);\n }\n standardTransformation = true;\n }\n if (constraints.relativePlacementConstraint) {\n reflectionType = true;\n }\n })();\n } else if (constraints.relativePlacementConstraint) {\n // finally check relative placement constraint\n // find largest component in dag\n var largestComponentSize = 0;\n var largestComponentIndex = 0;\n for (var _i6 = 0; _i6 < components.length; _i6++) {\n if (components[_i6].length > largestComponentSize) {\n largestComponentSize = components[_i6].length;\n largestComponentIndex = _i6;\n }\n }\n // if largest component isn't dominant, then take the votes for reflection\n if (largestComponentSize < dagUndirected.size / 2) {\n applyReflectionForRelativePlacement(constraints.relativePlacementConstraint);\n standardTransformation = false;\n reflectionType = false;\n } else {\n // use largest component for transformation\n // construct horizontal and vertical subgraphs in the largest component\n var subGraphOnHorizontal = new Map();\n var subGraphOnVertical = new Map();\n var constraintsInlargestComponent = [];\n\n components[largestComponentIndex].forEach(function (nodeId) {\n dag.get(nodeId).forEach(function (adjacent) {\n if (adjacent.direction == \"horizontal\") {\n if (subGraphOnHorizontal.has(nodeId)) {\n subGraphOnHorizontal.get(nodeId).push(adjacent);\n } else {\n subGraphOnHorizontal.set(nodeId, [adjacent]);\n }\n if (!subGraphOnHorizontal.has(adjacent.id)) {\n subGraphOnHorizontal.set(adjacent.id, []);\n }\n constraintsInlargestComponent.push({ left: nodeId, right: adjacent.id });\n } else {\n if (subGraphOnVertical.has(nodeId)) {\n subGraphOnVertical.get(nodeId).push(adjacent);\n } else {\n subGraphOnVertical.set(nodeId, [adjacent]);\n }\n if (!subGraphOnVertical.has(adjacent.id)) {\n subGraphOnVertical.set(adjacent.id, []);\n }\n constraintsInlargestComponent.push({ top: nodeId, bottom: adjacent.id });\n }\n });\n });\n\n applyReflectionForRelativePlacement(constraintsInlargestComponent);\n reflectionType = false;\n\n // calculate appropriate positioning for subgraphs\n var positionMapHorizontal = findAppropriatePositionForRelativePlacement(subGraphOnHorizontal, \"horizontal\");\n var positionMapVertical = findAppropriatePositionForRelativePlacement(subGraphOnVertical, \"vertical\");\n\n // construct source and target configuration\n components[largestComponentIndex].forEach(function (nodeId, i) {\n sourceMatrix[i] = [xCoords[nodeIndexes.get(nodeId)], yCoords[nodeIndexes.get(nodeId)]];\n targetMatrix[i] = [];\n if (positionMapHorizontal.has(nodeId)) {\n targetMatrix[i][0] = positionMapHorizontal.get(nodeId);\n } else {\n targetMatrix[i][0] = xCoords[nodeIndexes.get(nodeId)];\n }\n if (positionMapVertical.has(nodeId)) {\n targetMatrix[i][1] = positionMapVertical.get(nodeId);\n } else {\n targetMatrix[i][1] = yCoords[nodeIndexes.get(nodeId)];\n }\n });\n\n standardTransformation = true;\n }\n }\n\n // if transformation is required, then calculate and apply transformation matrix\n if (standardTransformation) {\n /* calculate transformation matrix */\n var transformationMatrix = void 0;\n var targetMatrixTranspose = Matrix.transpose(targetMatrix); // A'\n var sourceMatrixTranspose = Matrix.transpose(sourceMatrix); // B'\n\n // centralize transpose matrices\n for (var _i7 = 0; _i7 < targetMatrixTranspose.length; _i7++) {\n targetMatrixTranspose[_i7] = Matrix.multGamma(targetMatrixTranspose[_i7]);\n sourceMatrixTranspose[_i7] = Matrix.multGamma(sourceMatrixTranspose[_i7]);\n }\n\n // do actual calculation for transformation matrix\n var tempMatrix = Matrix.multMat(targetMatrixTranspose, Matrix.transpose(sourceMatrixTranspose)); // tempMatrix = A'B\n var SVDResult = SVD.svd(tempMatrix); // SVD(A'B) = USV', svd function returns U, S and V \n transformationMatrix = Matrix.multMat(SVDResult.V, Matrix.transpose(SVDResult.U)); // transformationMatrix = T = VU'\n\n /* apply found transformation matrix to obtain final draft layout */\n for (var _i8 = 0; _i8 < nodeIndexes.size; _i8++) {\n var temp1 = [xCoords[_i8], yCoords[_i8]];\n var temp2 = [transformationMatrix[0][0], transformationMatrix[1][0]];\n var temp3 = [transformationMatrix[0][1], transformationMatrix[1][1]];\n xCoords[_i8] = Matrix.dotProduct(temp1, temp2);\n yCoords[_i8] = Matrix.dotProduct(temp1, temp3);\n }\n\n // applied only both alignment and rel. placement constraints exist\n if (reflectionType) {\n applyReflectionForRelativePlacement(constraints.relativePlacementConstraint);\n }\n }\n }\n\n if (CoSEConstants.ENFORCE_CONSTRAINTS) {\n /**** enforce constraints on the transformed draft layout ****/\n\n /* first enforce fixed node constraint */\n\n if (constraints.fixedNodeConstraint && constraints.fixedNodeConstraint.length > 0) {\n var translationAmount = { x: 0, y: 0 };\n constraints.fixedNodeConstraint.forEach(function (nodeData, i) {\n var posInTheory = { x: xCoords[nodeIndexes.get(nodeData.nodeId)], y: yCoords[nodeIndexes.get(nodeData.nodeId)] };\n var posDesired = nodeData.position;\n var posDiff = calculatePositionDiff(posDesired, posInTheory);\n translationAmount.x += posDiff.x;\n translationAmount.y += posDiff.y;\n });\n translationAmount.x /= constraints.fixedNodeConstraint.length;\n translationAmount.y /= constraints.fixedNodeConstraint.length;\n\n xCoords.forEach(function (value, i) {\n xCoords[i] += translationAmount.x;\n });\n\n yCoords.forEach(function (value, i) {\n yCoords[i] += translationAmount.y;\n });\n\n constraints.fixedNodeConstraint.forEach(function (nodeData) {\n xCoords[nodeIndexes.get(nodeData.nodeId)] = nodeData.position.x;\n yCoords[nodeIndexes.get(nodeData.nodeId)] = nodeData.position.y;\n });\n }\n\n /* then enforce alignment constraint */\n\n if (constraints.alignmentConstraint) {\n if (constraints.alignmentConstraint.vertical) {\n var xAlign = constraints.alignmentConstraint.vertical;\n\n var _loop4 = function _loop4(_i9) {\n var alignmentSet = new Set();\n xAlign[_i9].forEach(function (nodeId) {\n alignmentSet.add(nodeId);\n });\n var intersection = new Set([].concat(_toConsumableArray(alignmentSet)).filter(function (x) {\n return fixedNodes.has(x);\n }));\n var xPos = void 0;\n if (intersection.size > 0) xPos = xCoords[nodeIndexes.get(intersection.values().next().value)];else xPos = calculateAvgPosition(alignmentSet).x;\n\n alignmentSet.forEach(function (nodeId) {\n if (!fixedNodes.has(nodeId)) xCoords[nodeIndexes.get(nodeId)] = xPos;\n });\n };\n\n for (var _i9 = 0; _i9 < xAlign.length; _i9++) {\n _loop4(_i9);\n }\n }\n if (constraints.alignmentConstraint.horizontal) {\n var yAlign = constraints.alignmentConstraint.horizontal;\n\n var _loop5 = function _loop5(_i10) {\n var alignmentSet = new Set();\n yAlign[_i10].forEach(function (nodeId) {\n alignmentSet.add(nodeId);\n });\n var intersection = new Set([].concat(_toConsumableArray(alignmentSet)).filter(function (x) {\n return fixedNodes.has(x);\n }));\n var yPos = void 0;\n if (intersection.size > 0) yPos = yCoords[nodeIndexes.get(intersection.values().next().value)];else yPos = calculateAvgPosition(alignmentSet).y;\n\n alignmentSet.forEach(function (nodeId) {\n if (!fixedNodes.has(nodeId)) yCoords[nodeIndexes.get(nodeId)] = yPos;\n });\n };\n\n for (var _i10 = 0; _i10 < yAlign.length; _i10++) {\n _loop5(_i10);\n }\n }\n }\n\n /* finally enforce relative placement constraint */\n\n if (constraints.relativePlacementConstraint) {\n (function () {\n var nodeToDummyForVerticalAlignment = new Map();\n var nodeToDummyForHorizontalAlignment = new Map();\n var dummyToNodeForVerticalAlignment = new Map();\n var dummyToNodeForHorizontalAlignment = new Map();\n var dummyPositionsForVerticalAlignment = new Map();\n var dummyPositionsForHorizontalAlignment = new Map();\n var fixedNodesOnHorizontal = new Set();\n var fixedNodesOnVertical = new Set();\n\n // fill maps and sets \n fixedNodes.forEach(function (nodeId) {\n fixedNodesOnHorizontal.add(nodeId);\n fixedNodesOnVertical.add(nodeId);\n });\n\n if (constraints.alignmentConstraint) {\n if (constraints.alignmentConstraint.vertical) {\n var verticalAlignment = constraints.alignmentConstraint.vertical;\n\n var _loop6 = function _loop6(_i11) {\n dummyToNodeForVerticalAlignment.set(\"dummy\" + _i11, []);\n verticalAlignment[_i11].forEach(function (nodeId) {\n nodeToDummyForVerticalAlignment.set(nodeId, \"dummy\" + _i11);\n dummyToNodeForVerticalAlignment.get(\"dummy\" + _i11).push(nodeId);\n if (fixedNodes.has(nodeId)) {\n fixedNodesOnHorizontal.add(\"dummy\" + _i11);\n }\n });\n dummyPositionsForVerticalAlignment.set(\"dummy\" + _i11, xCoords[nodeIndexes.get(verticalAlignment[_i11][0])]);\n };\n\n for (var _i11 = 0; _i11 < verticalAlignment.length; _i11++) {\n _loop6(_i11);\n }\n }\n if (constraints.alignmentConstraint.horizontal) {\n var horizontalAlignment = constraints.alignmentConstraint.horizontal;\n\n var _loop7 = function _loop7(_i12) {\n dummyToNodeForHorizontalAlignment.set(\"dummy\" + _i12, []);\n horizontalAlignment[_i12].forEach(function (nodeId) {\n nodeToDummyForHorizontalAlignment.set(nodeId, \"dummy\" + _i12);\n dummyToNodeForHorizontalAlignment.get(\"dummy\" + _i12).push(nodeId);\n if (fixedNodes.has(nodeId)) {\n fixedNodesOnVertical.add(\"dummy\" + _i12);\n }\n });\n dummyPositionsForHorizontalAlignment.set(\"dummy\" + _i12, yCoords[nodeIndexes.get(horizontalAlignment[_i12][0])]);\n };\n\n for (var _i12 = 0; _i12 < horizontalAlignment.length; _i12++) {\n _loop7(_i12);\n }\n }\n }\n\n // construct horizontal and vertical dags (subgraphs) from overall dag\n var dagOnHorizontal = new Map();\n var dagOnVertical = new Map();\n\n var _loop8 = function _loop8(nodeId) {\n dag.get(nodeId).forEach(function (adjacent) {\n var sourceId = void 0;\n var targetNode = void 0;\n if (adjacent[\"direction\"] == \"horizontal\") {\n sourceId = nodeToDummyForVerticalAlignment.get(nodeId) ? nodeToDummyForVerticalAlignment.get(nodeId) : nodeId;\n if (nodeToDummyForVerticalAlignment.get(adjacent.id)) {\n targetNode = { id: nodeToDummyForVerticalAlignment.get(adjacent.id), gap: adjacent.gap, direction: adjacent.direction };\n } else {\n targetNode = adjacent;\n }\n if (dagOnHorizontal.has(sourceId)) {\n dagOnHorizontal.get(sourceId).push(targetNode);\n } else {\n dagOnHorizontal.set(sourceId, [targetNode]);\n }\n if (!dagOnHorizontal.has(targetNode.id)) {\n dagOnHorizontal.set(targetNode.id, []);\n }\n } else {\n sourceId = nodeToDummyForHorizontalAlignment.get(nodeId) ? nodeToDummyForHorizontalAlignment.get(nodeId) : nodeId;\n if (nodeToDummyForHorizontalAlignment.get(adjacent.id)) {\n targetNode = { id: nodeToDummyForHorizontalAlignment.get(adjacent.id), gap: adjacent.gap, direction: adjacent.direction };\n } else {\n targetNode = adjacent;\n }\n if (dagOnVertical.has(sourceId)) {\n dagOnVertical.get(sourceId).push(targetNode);\n } else {\n dagOnVertical.set(sourceId, [targetNode]);\n }\n if (!dagOnVertical.has(targetNode.id)) {\n dagOnVertical.set(targetNode.id, []);\n }\n }\n });\n };\n\n var _iteratorNormalCompletion5 = true;\n var _didIteratorError5 = false;\n var _iteratorError5 = undefined;\n\n try {\n for (var _iterator5 = dag.keys()[Symbol.iterator](), _step5; !(_iteratorNormalCompletion5 = (_step5 = _iterator5.next()).done); _iteratorNormalCompletion5 = true) {\n var nodeId = _step5.value;\n\n _loop8(nodeId);\n }\n\n // find source nodes of each component in horizontal and vertical dags\n } catch (err) {\n _didIteratorError5 = true;\n _iteratorError5 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion5 && _iterator5.return) {\n _iterator5.return();\n }\n } finally {\n if (_didIteratorError5) {\n throw _iteratorError5;\n }\n }\n }\n\n var undirectedOnHorizontal = dagToUndirected(dagOnHorizontal);\n var undirectedOnVertical = dagToUndirected(dagOnVertical);\n var componentsOnHorizontal = findComponents(undirectedOnHorizontal);\n var componentsOnVertical = findComponents(undirectedOnVertical);\n var reversedDagOnHorizontal = dagToReversed(dagOnHorizontal);\n var reversedDagOnVertical = dagToReversed(dagOnVertical);\n var componentSourcesOnHorizontal = [];\n var componentSourcesOnVertical = [];\n\n componentsOnHorizontal.forEach(function (component, index) {\n componentSourcesOnHorizontal[index] = [];\n component.forEach(function (nodeId) {\n if (reversedDagOnHorizontal.get(nodeId).length == 0) {\n componentSourcesOnHorizontal[index].push(nodeId);\n }\n });\n });\n\n componentsOnVertical.forEach(function (component, index) {\n componentSourcesOnVertical[index] = [];\n component.forEach(function (nodeId) {\n if (reversedDagOnVertical.get(nodeId).length == 0) {\n componentSourcesOnVertical[index].push(nodeId);\n }\n });\n });\n\n // calculate appropriate positioning for subgraphs\n var positionMapHorizontal = findAppropriatePositionForRelativePlacement(dagOnHorizontal, \"horizontal\", fixedNodesOnHorizontal, dummyPositionsForVerticalAlignment, componentSourcesOnHorizontal);\n var positionMapVertical = findAppropriatePositionForRelativePlacement(dagOnVertical, \"vertical\", fixedNodesOnVertical, dummyPositionsForHorizontalAlignment, componentSourcesOnVertical);\n\n // update positions of the nodes based on relative placement constraints\n\n var _loop9 = function _loop9(key) {\n if (dummyToNodeForVerticalAlignment.get(key)) {\n dummyToNodeForVerticalAlignment.get(key).forEach(function (nodeId) {\n xCoords[nodeIndexes.get(nodeId)] = positionMapHorizontal.get(key);\n });\n } else {\n xCoords[nodeIndexes.get(key)] = positionMapHorizontal.get(key);\n }\n };\n\n var _iteratorNormalCompletion6 = true;\n var _didIteratorError6 = false;\n var _iteratorError6 = undefined;\n\n try {\n for (var _iterator6 = positionMapHorizontal.keys()[Symbol.iterator](), _step6; !(_iteratorNormalCompletion6 = (_step6 = _iterator6.next()).done); _iteratorNormalCompletion6 = true) {\n var key = _step6.value;\n\n _loop9(key);\n }\n } catch (err) {\n _didIteratorError6 = true;\n _iteratorError6 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion6 && _iterator6.return) {\n _iterator6.return();\n }\n } finally {\n if (_didIteratorError6) {\n throw _iteratorError6;\n }\n }\n }\n\n var _loop10 = function _loop10(key) {\n if (dummyToNodeForHorizontalAlignment.get(key)) {\n dummyToNodeForHorizontalAlignment.get(key).forEach(function (nodeId) {\n yCoords[nodeIndexes.get(nodeId)] = positionMapVertical.get(key);\n });\n } else {\n yCoords[nodeIndexes.get(key)] = positionMapVertical.get(key);\n }\n };\n\n var _iteratorNormalCompletion7 = true;\n var _didIteratorError7 = false;\n var _iteratorError7 = undefined;\n\n try {\n for (var _iterator7 = positionMapVertical.keys()[Symbol.iterator](), _step7; !(_iteratorNormalCompletion7 = (_step7 = _iterator7.next()).done); _iteratorNormalCompletion7 = true) {\n var key = _step7.value;\n\n _loop10(key);\n }\n } catch (err) {\n _didIteratorError7 = true;\n _iteratorError7 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion7 && _iterator7.return) {\n _iterator7.return();\n }\n } finally {\n if (_didIteratorError7) {\n throw _iteratorError7;\n }\n }\n }\n })();\n }\n }\n\n // assign new coordinates to nodes after constraint handling\n for (var _i13 = 0; _i13 < allNodes.length; _i13++) {\n var _node = allNodes[_i13];\n if (_node.getChild() == null) {\n _node.setCenter(xCoords[nodeIndexes.get(_node.id)], yCoords[nodeIndexes.get(_node.id)]);\n }\n }\n};\n\nmodule.exports = ConstraintHandler;\n\n/***/ }),\n\n/***/ 551:\n/***/ ((module) => {\n\nmodule.exports = __WEBPACK_EXTERNAL_MODULE__551__;\n\n/***/ })\n\n/******/ \t});\n/************************************************************************/\n/******/ \t// The module cache\n/******/ \tvar __webpack_module_cache__ = {};\n/******/ \t\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/ \t\t// Check if module is in cache\n/******/ \t\tvar cachedModule = __webpack_module_cache__[moduleId];\n/******/ \t\tif (cachedModule !== undefined) {\n/******/ \t\t\treturn cachedModule.exports;\n/******/ \t\t}\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = __webpack_module_cache__[moduleId] = {\n/******/ \t\t\t// no module.id needed\n/******/ \t\t\t// no module.loaded needed\n/******/ \t\t\texports: {}\n/******/ \t\t};\n/******/ \t\n/******/ \t\t// Execute the module function\n/******/ \t\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n/******/ \t\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/ \t\n/************************************************************************/\n/******/ \t\n/******/ \t// startup\n/******/ \t// Load entry module and return exports\n/******/ \t// This entry module is referenced by other modules so it can't be inlined\n/******/ \tvar __webpack_exports__ = __webpack_require__(45);\n/******/ \t\n/******/ \treturn __webpack_exports__;\n/******/ })()\n;\n});"],"names":["root","factory","module","require$$0","this","__WEBPACK_EXTERNAL_MODULE__551__","__webpack_modules__","__unused_webpack_exports","__webpack_require__","coseBase","FDLayoutConstants","CoSEConstants","prop","FDLayoutEdge","CoSEEdge","source","target","vEdge","LGraph","CoSEGraph","parent","graphMgr","vGraph","LGraphManager","CoSEGraphManager","layout","FDLayout","CoSENode","ConstraintHandler","LayoutConstants","Point","PointD","DimensionD","Layout","Integer","IGeometry","Transform","LinkedList","CoSELayout","gm","vNode","createBendsAsNeeded","allNodes","intersection","x","forest","gridUpdateAllowed","forceToNodeSurroundingUpdate","pData","i","rect","id","layoutEnded","lNodes","node","self","calculateCompoundWeight","compoundNode","nodes","fixedNodeWeight","nodeData","nodeToDummyForVerticalAlignment","nodeToDummyForHorizontalAlignment","nodeId","verticalAlignment","horizontalAlignment","array","j","constraint","nodeIdLeft","nodeIdRight","nodeIdTop","nodeIdBottom","subGraphOnHorizontal","subGraphOnVertical","left","right","top","bottom","constructComponents","graph","fixedNodes","components","isFixed","queue","visited","count","value","key","currentNode","neighbors","neighbor","resultOnHorizontal","resultOnVertical","fixedNode","allVerticalAlignments","totalDisplacementX","averageDisplacementX","allHorizontalAlignments","totalDisplacementY","averageDisplacementY","displacement","diff","component","sum","actualNodes","averageDisplacement","nodeList","graphs","size","edges","edge","edgeList","k","multiEdge","currentStartingPoint","numberOfColumns","height","currentY","currentX","point","tree","centerNode","startingPoint","radialSep","bounds","transform","bottomRight","parentOfNode","startAngle","endAngle","distance","radialSeparation","halfInterval","nodeAngle","teta","x_","y_","neighborEdges","childCount","branchCount","incEdgesCount","startIndex","temp","index","stepAngle","currentNeighbor","childStartAngle","childEndAngle","maxDiagonal","diagonal","tempMemberGroups","zeroDegree","p_id","dummyCompoundId","dummyCompound","dummyParentGraph","parentGraph","childGraphMap","idToNode","tiledZeroDegreePack","width","lCompoundNode","horizontalMargin","verticalMargin","labelMarginLeft","labelMarginTop","tiledPack","childGraph","children","theChild","degree","child","organization","y","compoundHorizontalMargin","compoundVerticalMargin","compoundLabelMarginLeft","compoundLabelMarginTop","row","maxHeight","lnode","minWidth","horizontalOrg","verticalOrg","horizontalRatio","verticalRatio","bestOrg","ratio","members","favorHorizontalDim","verticalPadding","horizontalPadding","membersSize","totalWidth","totalHeight","maxWidth","averageWidth","averageHeight","delta","horizontalCountDouble","horizontalCount","idealWidth","tilingCompareBy","getNodeArea","n","areaCompareFcn","n1","n2","cmpBy","sumCenterX","sumCenterY","lNode","rowIndex","minCompoundSize","secondDimension","w","extraHeight","r","min","max","extraWidth","lastRowIndex","lastRowWidth","sri","hDiff","add_to_row_ratio","add_new_row_ratio","longest","last","prevTotal","finalTotal","prunedNodesAll","containsLeaf","prunedNodesInStepTemp","otherEnd","relativePosition","prunedNodesInStep","lengthOfPrunedNodesInStep","gridForPrunedNode","nodeToConnect","prunedNode","startGridX","finishGridX","startGridY","finishGridY","upNodeCount","downNodeCount","rightNodeCount","leftNodeCount","controlRegions","minCount","minIndex","random","FDLayoutNode","IMath","loc","dX","dY","pred1","next","processed","_toConsumableArray","arr","arr2","Matrix","SVD","constraints","idToNodeMap","nodeIndexes","xCoords","yCoords","calculatePositionDiff","pos1","pos2","calculateAvgPosition","nodeIdSet","xPosSum","yPosSum","findAppropriatePositionForRelativePlacement","direction","dummyPositions","componentSources","setUnion","setA","setB","union","_iteratorNormalCompletion","_didIteratorError","_iteratorError","_iterator","_step","elem","err","inDegrees","adjacent","positionMap","pastMap","fixedIds","position","fixedId","_position","_loop","fixedPosition","sinkNodes","_components","isFixedComponent","_iteratorNormalCompletion2","_didIteratorError2","_iteratorError2","_iterator2","_step2","isExist","existAt","ele","minBefore","minAfter","maxBefore","maxAfter","_iteratorNormalCompletion3","_didIteratorError3","_iteratorError3","_iterator3","_step3","posBefore","posAfter","_iteratorNormalCompletion4","_didIteratorError4","_iteratorError4","_iterator4","_step4","_nodeId","applyReflectionForRelativePlacement","relativePlacementConstraints","reflectOnY","notReflectOnY","reflectOnX","notReflectOnX","_i","_i2","_i3","findComponents","_currentNode","dagToUndirected","dag","undirected","dagToReversed","reversed","targetMatrix","sourceMatrix","standardTransformation","reflectionType","dagUndirected","verticalAlign","_loop2","_i4","alignmentSet","xPos","horizontalAlign","_loop3","_i5","yPos","largestComponentSize","largestComponentIndex","_i6","constraintsInlargestComponent","positionMapHorizontal","positionMapVertical","transformationMatrix","targetMatrixTranspose","sourceMatrixTranspose","_i7","tempMatrix","SVDResult","_i8","temp1","temp2","temp3","translationAmount","posInTheory","posDesired","posDiff","xAlign","_loop4","_i9","yAlign","_loop5","_i10","dummyToNodeForVerticalAlignment","dummyToNodeForHorizontalAlignment","dummyPositionsForVerticalAlignment","dummyPositionsForHorizontalAlignment","fixedNodesOnHorizontal","fixedNodesOnVertical","_loop6","_i11","_loop7","_i12","dagOnHorizontal","dagOnVertical","_loop8","sourceId","targetNode","_iteratorNormalCompletion5","_didIteratorError5","_iteratorError5","_iterator5","_step5","undirectedOnHorizontal","undirectedOnVertical","componentsOnHorizontal","componentsOnVertical","reversedDagOnHorizontal","reversedDagOnVertical","componentSourcesOnHorizontal","componentSourcesOnVertical","_loop9","_iteratorNormalCompletion6","_didIteratorError6","_iteratorError6","_iterator6","_step6","_loop10","_iteratorNormalCompletion7","_didIteratorError7","_iteratorError7","_iterator7","_step7","_i13","_node","__webpack_module_cache__","moduleId","cachedModule","__webpack_exports__"],"mappings":"0QAAC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