From 00355eb3e045c4f18759ade9b931b4308033760d Mon Sep 17 00:00:00 2001 From: Marcel Stimberg Date: Fri, 14 Mar 2025 11:42:14 +0100 Subject: [PATCH 1/2] feat: Switch to fCose layout --- graph.js | 3 ++- index.html | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/graph.js b/graph.js index a748f70..19fdb03 100644 --- a/graph.js +++ b/graph.js @@ -39,12 +39,13 @@ function selectionChanged() { function layoutNodes() { cy_layout = cy.layout({ - name: "cola", + name: "fcose", animate: "end", padding: 50, avoidOverlap: true, nodeDimensionsIncludeLabels: true, centerGraph: false, + numIter: 10000, }); cy_layout.run(); } diff --git a/index.html b/index.html index 4ab7fd3..040b52a 100644 --- a/index.html +++ b/index.html @@ -6,8 +6,9 @@ - - + + + From c14e37546e006be70216016f8905d6cca55fb0f1 Mon Sep 17 00:00:00 2001 From: Marcel Stimberg Date: Fri, 14 Mar 2025 11:59:21 +0100 Subject: [PATCH 2/2] feat: ship the layout js files instead of relying on a CDN --- LICENSE.MIT | 21 +++++++++++++++++++++ README.md | 4 ++++ assets/js/README.md | 8 ++++++++ assets/js/cose-base.min.js | 1 + assets/js/cytoscape-fcose.min.js | 1 + assets/js/layout-base.min.js | 1 + index.html | 6 +++--- 7 files changed, 39 insertions(+), 3 deletions(-) create mode 100644 LICENSE.MIT create mode 100644 assets/js/README.md create mode 100644 assets/js/cose-base.min.js create mode 100644 assets/js/cytoscape-fcose.min.js create mode 100644 assets/js/layout-base.min.js diff --git a/LICENSE.MIT b/LICENSE.MIT new file mode 100644 index 0000000..5229600 --- /dev/null +++ b/LICENSE.MIT @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2018 - present, iVis@Bilkent. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md index cb38662..150827e 100644 --- a/README.md +++ b/README.md @@ -54,6 +54,10 @@ Now, the pre-commit checks will be run before each commit. ## Deployment The website is hosted on https://ocns.github.io/simselect +## Dependencies +The layout is using the fCoSE algorithm by the [i-Vis Research Lab at Bilkent University](http://www.cs.bilkent.edu.tr/~ivis/). +The files in the `assets/js` directory are minified versions of the original files, licensed under the [MIT license](LICENSE.MIT). + ## Contributors diff --git a/assets/js/README.md b/assets/js/README.md new file mode 100644 index 0000000..dc416f2 --- /dev/null +++ b/assets/js/README.md @@ -0,0 +1,8 @@ +The files in this directory are minified versions of the files developed by the [i-Vis Research Lab at Bilkent University](http://www.cs.bilkent.edu.tr/~ivis/). + +The respective repositories are: +- https://github.com/iVis-at-Bilkent/cytoscape.js-fcose +- https://github.com/iVis-at-Bilkent/cose-base +- https://github.com/iVis-at-Bilkent/layout-base + +These files are licensed under the [MIT license](../../LICENSE.MIT). diff --git a/assets/js/cose-base.min.js b/assets/js/cose-base.min.js new file mode 100644 index 0000000..bfce2c0 --- /dev/null +++ b/assets/js/cose-base.min.js @@ -0,0 +1 @@ +(function webpackUniversalModuleDefinition(root,factory){if(typeof exports==="object"&&typeof module==="object")module.exports=factory(require("layout-base"));else if(typeof define==="function"&&define.amd)define(["layout-base"],factory);else if(typeof exports==="object")exports["coseBase"]=factory(require("layout-base"));else root["coseBase"]=factory(root["layoutBase"])})(this,function(__WEBPACK_EXTERNAL_MODULE__551__){return(()=>{"use strict";var __webpack_modules__={45:(module,__unused_webpack_exports,__webpack_require__)=>{var coseBase={};coseBase.layoutBase=__webpack_require__(551);coseBase.CoSEConstants=__webpack_require__(806);coseBase.CoSEEdge=__webpack_require__(767);coseBase.CoSEGraph=__webpack_require__(880);coseBase.CoSEGraphManager=__webpack_require__(578);coseBase.CoSELayout=__webpack_require__(765);coseBase.CoSENode=__webpack_require__(991);coseBase.ConstraintHandler=__webpack_require__(902);module.exports=coseBase},806:(module,__unused_webpack_exports,__webpack_require__)=>{var FDLayoutConstants=__webpack_require__(551).FDLayoutConstants;function CoSEConstants(){}for(var prop in FDLayoutConstants){CoSEConstants[prop]=FDLayoutConstants[prop]}CoSEConstants.DEFAULT_USE_MULTI_LEVEL_SCALING=false;CoSEConstants.DEFAULT_RADIAL_SEPARATION=FDLayoutConstants.DEFAULT_EDGE_LENGTH;CoSEConstants.DEFAULT_COMPONENT_SEPERATION=60;CoSEConstants.TILE=true;CoSEConstants.TILING_PADDING_VERTICAL=10;CoSEConstants.TILING_PADDING_HORIZONTAL=10;CoSEConstants.TRANSFORM_ON_CONSTRAINT_HANDLING=true;CoSEConstants.ENFORCE_CONSTRAINTS=true;CoSEConstants.APPLY_LAYOUT=true;CoSEConstants.RELAX_MOVEMENT_ON_CONSTRAINTS=true;CoSEConstants.TREE_REDUCTION_ON_INCREMENTAL=true;CoSEConstants.PURE_INCREMENTAL=CoSEConstants.DEFAULT_INCREMENTAL;module.exports=CoSEConstants},767:(module,__unused_webpack_exports,__webpack_require__)=>{var FDLayoutEdge=__webpack_require__(551).FDLayoutEdge;function CoSEEdge(source,target,vEdge){FDLayoutEdge.call(this,source,target,vEdge)}CoSEEdge.prototype=Object.create(FDLayoutEdge.prototype);for(var prop in FDLayoutEdge){CoSEEdge[prop]=FDLayoutEdge[prop]}module.exports=CoSEEdge},880:(module,__unused_webpack_exports,__webpack_require__)=>{var LGraph=__webpack_require__(551).LGraph;function CoSEGraph(parent,graphMgr,vGraph){LGraph.call(this,parent,graphMgr,vGraph)}CoSEGraph.prototype=Object.create(LGraph.prototype);for(var prop in LGraph){CoSEGraph[prop]=LGraph[prop]}module.exports=CoSEGraph},578:(module,__unused_webpack_exports,__webpack_require__)=>{var LGraphManager=__webpack_require__(551).LGraphManager;function CoSEGraphManager(layout){LGraphManager.call(this,layout)}CoSEGraphManager.prototype=Object.create(LGraphManager.prototype);for(var prop in LGraphManager){CoSEGraphManager[prop]=LGraphManager[prop]}module.exports=CoSEGraphManager},765:(module,__unused_webpack_exports,__webpack_require__)=>{var FDLayout=__webpack_require__(551).FDLayout;var CoSEGraphManager=__webpack_require__(578);var CoSEGraph=__webpack_require__(880);var CoSENode=__webpack_require__(991);var CoSEEdge=__webpack_require__(767);var CoSEConstants=__webpack_require__(806);var ConstraintHandler=__webpack_require__(902);var FDLayoutConstants=__webpack_require__(551).FDLayoutConstants;var LayoutConstants=__webpack_require__(551).LayoutConstants;var Point=__webpack_require__(551).Point;var PointD=__webpack_require__(551).PointD;var DimensionD=__webpack_require__(551).DimensionD;var Layout=__webpack_require__(551).Layout;var Integer=__webpack_require__(551).Integer;var IGeometry=__webpack_require__(551).IGeometry;var LGraph=__webpack_require__(551).LGraph;var Transform=__webpack_require__(551).Transform;var LinkedList=__webpack_require__(551).LinkedList;function CoSELayout(){FDLayout.call(this);this.toBeTiled={};this.constraints={}}CoSELayout.prototype=Object.create(FDLayout.prototype);for(var prop in FDLayout){CoSELayout[prop]=FDLayout[prop]}CoSELayout.prototype.newGraphManager=function(){var gm=new CoSEGraphManager(this);this.graphManager=gm;return gm};CoSELayout.prototype.newGraph=function(vGraph){return new CoSEGraph(null,this.graphManager,vGraph)};CoSELayout.prototype.newNode=function(vNode){return new CoSENode(this.graphManager,vNode)};CoSELayout.prototype.newEdge=function(vEdge){return new CoSEEdge(null,null,vEdge)};CoSELayout.prototype.initParameters=function(){FDLayout.prototype.initParameters.call(this,arguments);if(!this.isSubLayout){if(CoSEConstants.DEFAULT_EDGE_LENGTH<10){this.idealEdgeLength=10}else{this.idealEdgeLength=CoSEConstants.DEFAULT_EDGE_LENGTH}this.useSmartIdealEdgeLengthCalculation=CoSEConstants.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION;this.gravityConstant=FDLayoutConstants.DEFAULT_GRAVITY_STRENGTH;this.compoundGravityConstant=FDLayoutConstants.DEFAULT_COMPOUND_GRAVITY_STRENGTH;this.gravityRangeFactor=FDLayoutConstants.DEFAULT_GRAVITY_RANGE_FACTOR;this.compoundGravityRangeFactor=FDLayoutConstants.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR;this.prunedNodesAll=[];this.growTreeIterations=0;this.afterGrowthIterations=0;this.isTreeGrowing=false;this.isGrowthFinished=false}};CoSELayout.prototype.initSpringEmbedder=function(){FDLayout.prototype.initSpringEmbedder.call(this);this.coolingCycle=0;this.maxCoolingCycle=this.maxIterations/FDLayoutConstants.CONVERGENCE_CHECK_PERIOD;this.finalTemperature=.04;this.coolingAdjuster=1};CoSELayout.prototype.layout=function(){var createBendsAsNeeded=LayoutConstants.DEFAULT_CREATE_BENDS_AS_NEEDED;if(createBendsAsNeeded){this.createBendpoints();this.graphManager.resetAllEdges()}this.level=0;return this.classicLayout()};CoSELayout.prototype.classicLayout=function(){this.nodesWithGravity=this.calculateNodesToApplyGravitationTo();this.graphManager.setAllNodesToApplyGravitation(this.nodesWithGravity);this.calcNoOfChildrenForAllNodes();this.graphManager.calcLowestCommonAncestors();this.graphManager.calcInclusionTreeDepths();this.graphManager.getRoot().calcEstimatedSize();this.calcIdealEdgeLengths();if(!this.incremental){var forest=this.getFlatForest();if(forest.length>0){this.positionNodesRadially(forest)}else{this.reduceTrees();this.graphManager.resetAllNodesToApplyGravitation();var allNodes=new Set(this.getAllNodes());var intersection=this.nodesWithGravity.filter(function(x){return allNodes.has(x)});this.graphManager.setAllNodesToApplyGravitation(intersection);this.positionNodesRandomly()}}else{if(CoSEConstants.TREE_REDUCTION_ON_INCREMENTAL){this.reduceTrees();this.graphManager.resetAllNodesToApplyGravitation();var allNodes=new Set(this.getAllNodes());var intersection=this.nodesWithGravity.filter(function(x){return allNodes.has(x)});this.graphManager.setAllNodesToApplyGravitation(intersection)}}if(Object.keys(this.constraints).length>0){ConstraintHandler.handleConstraints(this);this.initConstraintVariables()}this.initSpringEmbedder();if(CoSEConstants.APPLY_LAYOUT){this.runSpringEmbedder()}return true};CoSELayout.prototype.tick=function(){this.totalIterations++;if(this.totalIterations===this.maxIterations&&!this.isTreeGrowing&&!this.isGrowthFinished){if(this.prunedNodesAll.length>0){this.isTreeGrowing=true}else{return true}}if(this.totalIterations%FDLayoutConstants.CONVERGENCE_CHECK_PERIOD==0&&!this.isTreeGrowing&&!this.isGrowthFinished){if(this.isConverged()){if(this.prunedNodesAll.length>0){this.isTreeGrowing=true}else{return true}}this.coolingCycle++;if(this.layoutQuality==0){this.coolingAdjuster=this.coolingCycle}else if(this.layoutQuality==1){this.coolingAdjuster=this.coolingCycle/3}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);this.animationPeriod=Math.ceil(this.initialAnimationPeriod*Math.sqrt(this.coolingFactor))}if(this.isTreeGrowing){if(this.growTreeIterations%10==0){if(this.prunedNodesAll.length>0){this.graphManager.updateBounds();this.updateGrid();this.growTree(this.prunedNodesAll);this.graphManager.resetAllNodesToApplyGravitation();var allNodes=new Set(this.getAllNodes());var intersection=this.nodesWithGravity.filter(function(x){return allNodes.has(x)});this.graphManager.setAllNodesToApplyGravitation(intersection);this.graphManager.updateBounds();this.updateGrid();if(CoSEConstants.PURE_INCREMENTAL)this.coolingFactor=FDLayoutConstants.DEFAULT_COOLING_FACTOR_INCREMENTAL/2;else this.coolingFactor=FDLayoutConstants.DEFAULT_COOLING_FACTOR_INCREMENTAL}else{this.isTreeGrowing=false;this.isGrowthFinished=true}}this.growTreeIterations++}if(this.isGrowthFinished){if(this.isConverged()){return true}if(this.afterGrowthIterations%10==0){this.graphManager.updateBounds();this.updateGrid()}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);this.afterGrowthIterations++}var gridUpdateAllowed=!this.isTreeGrowing&&!this.isGrowthFinished;var forceToNodeSurroundingUpdate=this.growTreeIterations%10==1&&this.isTreeGrowing||this.afterGrowthIterations%10==1&&this.isGrowthFinished;this.totalDisplacement=0;this.graphManager.updateBounds();this.calcSpringForces();this.calcRepulsionForces(gridUpdateAllowed,forceToNodeSurroundingUpdate);this.calcGravitationalForces();this.moveNodes();this.animate();return false};CoSELayout.prototype.getPositionsData=function(){var allNodes=this.graphManager.getAllNodes();var pData={};for(var i=0;i0){this.updateDisplacements()}for(var i=0;i0){node.fixedNodeWeight=fixedNodeWeight}}}}if(this.constraints.relativePlacementConstraint){var nodeToDummyForVerticalAlignment=new Map;var nodeToDummyForHorizontalAlignment=new Map;this.dummyToNodeForVerticalAlignment=new Map;this.dummyToNodeForHorizontalAlignment=new Map;this.fixedNodesOnHorizontal=new Set;this.fixedNodesOnVertical=new Set;this.fixedNodeSet.forEach(function(nodeId){self.fixedNodesOnHorizontal.add(nodeId);self.fixedNodesOnVertical.add(nodeId)});if(this.constraints.alignmentConstraint){if(this.constraints.alignmentConstraint.vertical){var verticalAlignment=this.constraints.alignmentConstraint.vertical;for(var i=0;i=2*array.length/3;i--){j=Math.floor(Math.random()*(i+1));x=array[i];array[i]=array[j];array[j]=x}return array};this.nodesInRelativeHorizontal=[];this.nodesInRelativeVertical=[];this.nodeToRelativeConstraintMapHorizontal=new Map;this.nodeToRelativeConstraintMapVertical=new Map;this.nodeToTempPositionMapHorizontal=new Map;this.nodeToTempPositionMapVertical=new Map;this.constraints.relativePlacementConstraint.forEach(function(constraint){if(constraint.left){var nodeIdLeft=nodeToDummyForVerticalAlignment.has(constraint.left)?nodeToDummyForVerticalAlignment.get(constraint.left):constraint.left;var nodeIdRight=nodeToDummyForVerticalAlignment.has(constraint.right)?nodeToDummyForVerticalAlignment.get(constraint.right):constraint.right;if(!self.nodesInRelativeHorizontal.includes(nodeIdLeft)){self.nodesInRelativeHorizontal.push(nodeIdLeft);self.nodeToRelativeConstraintMapHorizontal.set(nodeIdLeft,[]);if(self.dummyToNodeForVerticalAlignment.has(nodeIdLeft)){self.nodeToTempPositionMapHorizontal.set(nodeIdLeft,self.idToNodeMap.get(self.dummyToNodeForVerticalAlignment.get(nodeIdLeft)[0]).getCenterX())}else{self.nodeToTempPositionMapHorizontal.set(nodeIdLeft,self.idToNodeMap.get(nodeIdLeft).getCenterX())}}if(!self.nodesInRelativeHorizontal.includes(nodeIdRight)){self.nodesInRelativeHorizontal.push(nodeIdRight);self.nodeToRelativeConstraintMapHorizontal.set(nodeIdRight,[]);if(self.dummyToNodeForVerticalAlignment.has(nodeIdRight)){self.nodeToTempPositionMapHorizontal.set(nodeIdRight,self.idToNodeMap.get(self.dummyToNodeForVerticalAlignment.get(nodeIdRight)[0]).getCenterX())}else{self.nodeToTempPositionMapHorizontal.set(nodeIdRight,self.idToNodeMap.get(nodeIdRight).getCenterX())}}self.nodeToRelativeConstraintMapHorizontal.get(nodeIdLeft).push({right:nodeIdRight,gap:constraint.gap});self.nodeToRelativeConstraintMapHorizontal.get(nodeIdRight).push({left:nodeIdLeft,gap:constraint.gap})}else{var nodeIdTop=nodeToDummyForHorizontalAlignment.has(constraint.top)?nodeToDummyForHorizontalAlignment.get(constraint.top):constraint.top;var nodeIdBottom=nodeToDummyForHorizontalAlignment.has(constraint.bottom)?nodeToDummyForHorizontalAlignment.get(constraint.bottom):constraint.bottom;if(!self.nodesInRelativeVertical.includes(nodeIdTop)){self.nodesInRelativeVertical.push(nodeIdTop);self.nodeToRelativeConstraintMapVertical.set(nodeIdTop,[]);if(self.dummyToNodeForHorizontalAlignment.has(nodeIdTop)){self.nodeToTempPositionMapVertical.set(nodeIdTop,self.idToNodeMap.get(self.dummyToNodeForHorizontalAlignment.get(nodeIdTop)[0]).getCenterY())}else{self.nodeToTempPositionMapVertical.set(nodeIdTop,self.idToNodeMap.get(nodeIdTop).getCenterY())}}if(!self.nodesInRelativeVertical.includes(nodeIdBottom)){self.nodesInRelativeVertical.push(nodeIdBottom);self.nodeToRelativeConstraintMapVertical.set(nodeIdBottom,[]);if(self.dummyToNodeForHorizontalAlignment.has(nodeIdBottom)){self.nodeToTempPositionMapVertical.set(nodeIdBottom,self.idToNodeMap.get(self.dummyToNodeForHorizontalAlignment.get(nodeIdBottom)[0]).getCenterY())}else{self.nodeToTempPositionMapVertical.set(nodeIdBottom,self.idToNodeMap.get(nodeIdBottom).getCenterY())}}self.nodeToRelativeConstraintMapVertical.get(nodeIdTop).push({bottom:nodeIdBottom,gap:constraint.gap});self.nodeToRelativeConstraintMapVertical.get(nodeIdBottom).push({top:nodeIdTop,gap:constraint.gap})}})}else{var subGraphOnHorizontal=new Map;var subGraphOnVertical=new Map;this.constraints.relativePlacementConstraint.forEach(function(constraint){if(constraint.left){var left=nodeToDummyForVerticalAlignment.has(constraint.left)?nodeToDummyForVerticalAlignment.get(constraint.left):constraint.left;var right=nodeToDummyForVerticalAlignment.has(constraint.right)?nodeToDummyForVerticalAlignment.get(constraint.right):constraint.right;if(subGraphOnHorizontal.has(left)){subGraphOnHorizontal.get(left).push(right)}else{subGraphOnHorizontal.set(left,[right])}if(subGraphOnHorizontal.has(right)){subGraphOnHorizontal.get(right).push(left)}else{subGraphOnHorizontal.set(right,[left])}}else{var top=nodeToDummyForHorizontalAlignment.has(constraint.top)?nodeToDummyForHorizontalAlignment.get(constraint.top):constraint.top;var bottom=nodeToDummyForHorizontalAlignment.has(constraint.bottom)?nodeToDummyForHorizontalAlignment.get(constraint.bottom):constraint.bottom;if(subGraphOnVertical.has(top)){subGraphOnVertical.get(top).push(bottom)}else{subGraphOnVertical.set(top,[bottom])}if(subGraphOnVertical.has(bottom)){subGraphOnVertical.get(bottom).push(top)}else{subGraphOnVertical.set(bottom,[top])}}});var constructComponents=function constructComponents(graph,fixedNodes){var components=[];var isFixed=[];var queue=new LinkedList;var visited=new Set;var count=0;graph.forEach(function(value,key){if(!visited.has(key)){components[count]=[];isFixed[count]=false;var currentNode=key;queue.push(currentNode);visited.add(currentNode);components[count].push(currentNode);while(queue.length!=0){currentNode=queue.shift();if(fixedNodes.has(currentNode)){isFixed[count]=true}var neighbors=graph.get(currentNode);neighbors.forEach(function(neighbor){if(!visited.has(neighbor)){queue.push(neighbor);visited.add(neighbor);components[count].push(neighbor)}})}count++}});return{components:components,isFixed:isFixed}};var resultOnHorizontal=constructComponents(subGraphOnHorizontal,self.fixedNodesOnHorizontal);this.componentsOnHorizontal=resultOnHorizontal.components;this.fixedComponentsOnHorizontal=resultOnHorizontal.isFixed;var resultOnVertical=constructComponents(subGraphOnVertical,self.fixedNodesOnVertical);this.componentsOnVertical=resultOnVertical.components;this.fixedComponentsOnVertical=resultOnVertical.isFixed}}};CoSELayout.prototype.updateDisplacements=function(){var self=this;if(this.constraints.fixedNodeConstraint){this.constraints.fixedNodeConstraint.forEach(function(nodeData){var fixedNode=self.idToNodeMap.get(nodeData.nodeId);fixedNode.displacementX=0;fixedNode.displacementY=0})}if(this.constraints.alignmentConstraint){if(this.constraints.alignmentConstraint.vertical){var allVerticalAlignments=this.constraints.alignmentConstraint.vertical;for(var i=0;i1){var k;for(k=0;kheight){height=Math.floor(point.y)}currentX=Math.floor(point.x+CoSEConstants.DEFAULT_COMPONENT_SEPERATION)}this.transform(new PointD(LayoutConstants.WORLD_CENTER_X-point.x/2,LayoutConstants.WORLD_CENTER_Y-point.y/2))};CoSELayout.radialLayout=function(tree,centerNode,startingPoint){var radialSep=Math.max(this.maxDiagonalInTree(tree),CoSEConstants.DEFAULT_RADIAL_SEPARATION);CoSELayout.branchRadialLayout(centerNode,null,0,359,0,radialSep);var bounds=LGraph.calculateBounds(tree);var transform=new Transform;transform.setDeviceOrgX(bounds.getMinX());transform.setDeviceOrgY(bounds.getMinY());transform.setWorldOrgX(startingPoint.x);transform.setWorldOrgY(startingPoint.y);for(var i=0;i1){var temp=edges[0];edges.splice(0,1);var index=neighborEdges.indexOf(temp);if(index>=0){neighborEdges.splice(index,1)}incEdgesCount--;childCount--}if(parentOfNode!=null){startIndex=(neighborEdges.indexOf(edges[0])+1)%incEdgesCount}else{startIndex=0}var stepAngle=Math.abs(endAngle-startAngle)/childCount;for(var i=startIndex;branchCount!=childCount;i=++i%incEdgesCount){var currentNeighbor=neighborEdges[i].getOtherEnd(node);if(currentNeighbor==parentOfNode){continue}var childStartAngle=(startAngle+branchCount*stepAngle)%360;var childEndAngle=(childStartAngle+stepAngle)%360;CoSELayout.branchRadialLayout(currentNeighbor,node,childStartAngle,childEndAngle,distance+radialSeparation,radialSeparation);branchCount++}};CoSELayout.maxDiagonalInTree=function(tree){var maxDiagonal=Integer.MIN_VALUE;for(var i=0;imaxDiagonal){maxDiagonal=diagonal}}return maxDiagonal};CoSELayout.prototype.calcRepulsionRange=function(){return 2*(this.level+1)*this.idealEdgeLength};CoSELayout.prototype.groupZeroDegreeMembers=function(){var self=this;var tempMemberGroups={};this.memberGroups={};this.idToDummyNode={};var zeroDegree=[];var allNodes=this.graphManager.getAllNodes();for(var i=0;i1){var dummyCompoundId="DummyCompound_"+p_id;self.memberGroups[dummyCompoundId]=tempMemberGroups[p_id];var parent=tempMemberGroups[p_id][0].getParent();var dummyCompound=new CoSENode(self.graphManager);dummyCompound.id=dummyCompoundId;dummyCompound.paddingLeft=parent.paddingLeft||0;dummyCompound.paddingRight=parent.paddingRight||0;dummyCompound.paddingBottom=parent.paddingBottom||0;dummyCompound.paddingTop=parent.paddingTop||0;self.idToDummyNode[dummyCompoundId]=dummyCompound;var dummyParentGraph=self.getGraphManager().add(self.newGraph(),dummyCompound);var parentGraph=parent.getChild();parentGraph.add(dummyCompound);for(var i=0;iwidth){compoundNode.rect.x-=(compoundNode.labelWidth-width)/2;compoundNode.setWidth(compoundNode.labelWidth);compoundNode.labelMarginLeft=(compoundNode.labelWidth-width)/2}else if(compoundNode.labelPosHorizontal=="right"){compoundNode.setWidth(width+compoundNode.labelWidth)}}if(compoundNode.labelHeight){if(compoundNode.labelPosVertical=="top"){compoundNode.rect.y-=compoundNode.labelHeight;compoundNode.setHeight(height+compoundNode.labelHeight);compoundNode.labelMarginTop=compoundNode.labelHeight}else if(compoundNode.labelPosVertical=="center"&&compoundNode.labelHeight>height){compoundNode.rect.y-=(compoundNode.labelHeight-height)/2;compoundNode.setHeight(compoundNode.labelHeight);compoundNode.labelMarginTop=(compoundNode.labelHeight-height)/2}else if(compoundNode.labelPosVertical=="bottom"){compoundNode.setHeight(height+compoundNode.labelHeight)}}}})};CoSELayout.prototype.repopulateCompounds=function(){for(var i=this.compoundOrder.length-1;i>=0;i--){var lCompoundNode=this.compoundOrder[i];var id=lCompoundNode.id;var horizontalMargin=lCompoundNode.paddingLeft;var verticalMargin=lCompoundNode.paddingTop;var labelMarginLeft=lCompoundNode.labelMarginLeft;var labelMarginTop=lCompoundNode.labelMarginTop;this.adjustLocations(this.tiledMemberPack[id],lCompoundNode.rect.x,lCompoundNode.rect.y,horizontalMargin,verticalMargin,labelMarginLeft,labelMarginTop)}};CoSELayout.prototype.repopulateZeroDegreeMembers=function(){var self=this;var tiledPack=this.tiledZeroDegreePack;Object.keys(tiledPack).forEach(function(id){var compoundNode=self.idToDummyNode[id];var horizontalMargin=compoundNode.paddingLeft;var verticalMargin=compoundNode.paddingTop;var labelMarginLeft=compoundNode.labelMarginLeft;var labelMarginTop=compoundNode.labelMarginTop;self.adjustLocations(tiledPack[id],compoundNode.rect.x,compoundNode.rect.y,horizontalMargin,verticalMargin,labelMarginLeft,labelMarginTop)})};CoSELayout.prototype.getToBeTiled=function(node){var id=node.id;if(this.toBeTiled[id]!=null){return this.toBeTiled[id]}var childGraph=node.getChild();if(childGraph==null){this.toBeTiled[id]=false;return false}var children=childGraph.getNodes();for(var i=0;i0){this.toBeTiled[id]=false;return false}if(theChild.getChild()==null){this.toBeTiled[theChild.id]=false;continue}if(!this.getToBeTiled(theChild)){this.toBeTiled[id]=false;return false}}this.toBeTiled[id]=true;return true};CoSELayout.prototype.getNodeDegree=function(node){var id=node.id;var edges=node.getEdges();var degree=0;for(var i=0;imaxHeight)maxHeight=lnode.rect.height}y+=maxHeight+organization.verticalPadding}};CoSELayout.prototype.tileCompoundMembers=function(childGraphMap,idToNode){var self=this;this.tiledMemberPack=[];Object.keys(childGraphMap).forEach(function(id){var compoundNode=idToNode[id];self.tiledMemberPack[id]=self.tileNodes(childGraphMap[id],compoundNode.paddingLeft+compoundNode.paddingRight);compoundNode.rect.width=self.tiledMemberPack[id].width;compoundNode.rect.height=self.tiledMemberPack[id].height;compoundNode.setCenter(self.tiledMemberPack[id].centerX,self.tiledMemberPack[id].centerY);compoundNode.labelMarginLeft=0;compoundNode.labelMarginTop=0;if(CoSEConstants.NODE_DIMENSIONS_INCLUDE_LABELS){var width=compoundNode.rect.width;var height=compoundNode.rect.height;if(compoundNode.labelWidth){if(compoundNode.labelPosHorizontal=="left"){compoundNode.rect.x-=compoundNode.labelWidth;compoundNode.setWidth(width+compoundNode.labelWidth);compoundNode.labelMarginLeft=compoundNode.labelWidth}else if(compoundNode.labelPosHorizontal=="center"&&compoundNode.labelWidth>width){compoundNode.rect.x-=(compoundNode.labelWidth-width)/2;compoundNode.setWidth(compoundNode.labelWidth);compoundNode.labelMarginLeft=(compoundNode.labelWidth-width)/2}else if(compoundNode.labelPosHorizontal=="right"){compoundNode.setWidth(width+compoundNode.labelWidth)}}if(compoundNode.labelHeight){if(compoundNode.labelPosVertical=="top"){compoundNode.rect.y-=compoundNode.labelHeight;compoundNode.setHeight(height+compoundNode.labelHeight);compoundNode.labelMarginTop=compoundNode.labelHeight}else if(compoundNode.labelPosVertical=="center"&&compoundNode.labelHeight>height){compoundNode.rect.y-=(compoundNode.labelHeight-height)/2;compoundNode.setHeight(compoundNode.labelHeight);compoundNode.labelMarginTop=(compoundNode.labelHeight-height)/2}else if(compoundNode.labelPosVertical=="bottom"){compoundNode.setHeight(height+compoundNode.labelHeight)}}}})};CoSELayout.prototype.tileNodes=function(nodes,minWidth){var horizontalOrg=this.tileNodesByFavoringDim(nodes,minWidth,true);var verticalOrg=this.tileNodesByFavoringDim(nodes,minWidth,false);var horizontalRatio=this.getOrgRatio(horizontalOrg);var verticalRatio=this.getOrgRatio(verticalOrg);var bestOrg;if(verticalRatiomaxWidth){maxWidth=node.getWidth()}});var averageWidth=totalWidth/membersSize;var averageHeight=totalHeight/membersSize;var delta=Math.pow(verticalPadding-horizontalPadding,2)+4*(averageWidth+horizontalPadding)*(averageHeight+verticalPadding)*membersSize;var horizontalCountDouble=(horizontalPadding-verticalPadding+Math.sqrt(delta))/(2*(averageWidth+horizontalPadding));var horizontalCount;if(favorHorizontalDim){horizontalCount=Math.ceil(horizontalCountDouble);if(horizontalCount==horizontalCountDouble){horizontalCount++}}else{horizontalCount=Math.floor(horizontalCountDouble)}var idealWidth=horizontalCount*(averageWidth+horizontalPadding)-horizontalPadding;if(maxWidth>idealWidth){idealWidth=maxWidth}idealWidth+=horizontalPadding*2;return idealWidth};CoSELayout.prototype.tileNodesByFavoringDim=function(nodes,minWidth,favorHorizontalDim){var verticalPadding=CoSEConstants.TILING_PADDING_VERTICAL;var horizontalPadding=CoSEConstants.TILING_PADDING_HORIZONTAL;var tilingCompareBy=CoSEConstants.TILING_COMPARE_BY;var organization={rows:[],rowWidth:[],rowHeight:[],width:0,height:minWidth,verticalPadding:verticalPadding,horizontalPadding:horizontalPadding,centerX:0,centerY:0};if(tilingCompareBy){organization.idealRowWidth=this.calcIdealRowWidth(nodes,favorHorizontalDim)}var getNodeArea=function getNodeArea(n){return n.rect.width*n.rect.height};var areaCompareFcn=function areaCompareFcn(n1,n2){return getNodeArea(n2)-getNodeArea(n1)};nodes.sort(function(n1,n2){var cmpBy=areaCompareFcn;if(organization.idealRowWidth){cmpBy=tilingCompareBy;return cmpBy(n1.id,n2.id)}return cmpBy(n1,n2)});var sumCenterX=0;var sumCenterY=0;for(var i=0;i0){w+=organization.horizontalPadding}organization.rowWidth[rowIndex]=w;if(organization.width0)h+=organization.verticalPadding;var extraHeight=0;if(h>organization.rowHeight[rowIndex]){extraHeight=organization.rowHeight[rowIndex];organization.rowHeight[rowIndex]=h;extraHeight=organization.rowHeight[rowIndex]-extraHeight}organization.height+=extraHeight;organization.rows[rowIndex].push(node)};CoSELayout.prototype.getShortestRowIndex=function(organization){var r=-1;var min=Number.MAX_VALUE;for(var i=0;imax){r=i;max=organization.rowWidth[i]}}return r};CoSELayout.prototype.canAddHorizontal=function(organization,extraWidth,extraHeight){if(organization.idealRowWidth){var lastRowIndex=organization.rows.length-1;var lastRowWidth=organization.rowWidth[lastRowIndex];return lastRowWidth+extraWidth+organization.horizontalPadding<=organization.idealRowWidth}var sri=this.getShortestRowIndex(organization);if(sri<0){return true}var min=organization.rowWidth[sri];if(min+organization.horizontalPadding+extraWidth<=organization.width)return true;var hDiff=0;if(organization.rowHeight[sri]0)hDiff=extraHeight+organization.verticalPadding-organization.rowHeight[sri]}var add_to_row_ratio;if(organization.width-min>=extraWidth+organization.horizontalPadding){add_to_row_ratio=(organization.height+hDiff)/(min+extraWidth+organization.horizontalPadding)}else{add_to_row_ratio=(organization.height+hDiff)/organization.width}hDiff=extraHeight+organization.verticalPadding;var add_new_row_ratio;if(organization.widthdiff&&longest!=last){row.splice(-1,1);organization.rows[last].push(node);organization.rowWidth[longest]=organization.rowWidth[longest]-diff;organization.rowWidth[last]=organization.rowWidth[last]+diff;organization.width=organization.rowWidth[instance.getLongestRowIndex(organization)];var maxHeight=Number.MIN_VALUE;for(var i=0;imaxHeight)maxHeight=row[i].height}if(longest>0)maxHeight+=organization.verticalPadding;var prevTotal=organization.rowHeight[longest]+organization.rowHeight[last];organization.rowHeight[longest]=maxHeight;if(organization.rowHeight[last]0){for(var i=startGridX;i<=finishGridX;i++){controlRegions[0]+=this.grid[i][startGridY-1].length+this.grid[i][startGridY].length-1}}if(finishGridX0){for(var i=startGridY;i<=finishGridY;i++){controlRegions[3]+=this.grid[startGridX-1][i].length+this.grid[startGridX][i].length-1}}var min=Integer.MAX_VALUE;var minCount;var minIndex;for(var j=0;j{var FDLayoutNode=__webpack_require__(551).FDLayoutNode;var IMath=__webpack_require__(551).IMath;function CoSENode(gm,loc,size,vNode){FDLayoutNode.call(this,gm,loc,size,vNode)}CoSENode.prototype=Object.create(FDLayoutNode.prototype);for(var prop in FDLayoutNode){CoSENode[prop]=FDLayoutNode[prop]}CoSENode.prototype.calculateDisplacement=function(){var layout=this.graphManager.getLayout();if(this.getChild()!=null&&this.fixedNodeWeight){this.displacementX+=layout.coolingFactor*(this.springForceX+this.repulsionForceX+this.gravitationForceX)/this.fixedNodeWeight;this.displacementY+=layout.coolingFactor*(this.springForceY+this.repulsionForceY+this.gravitationForceY)/this.fixedNodeWeight}else{this.displacementX+=layout.coolingFactor*(this.springForceX+this.repulsionForceX+this.gravitationForceX)/this.noOfChildren;this.displacementY+=layout.coolingFactor*(this.springForceY+this.repulsionForceY+this.gravitationForceY)/this.noOfChildren}if(Math.abs(this.displacementX)>layout.coolingFactor*layout.maxNodeDisplacement){this.displacementX=layout.coolingFactor*layout.maxNodeDisplacement*IMath.sign(this.displacementX)}if(Math.abs(this.displacementY)>layout.coolingFactor*layout.maxNodeDisplacement){this.displacementY=layout.coolingFactor*layout.maxNodeDisplacement*IMath.sign(this.displacementY)}if(this.child&&this.child.getNodes().length>0){this.propogateDisplacementToChildren(this.displacementX,this.displacementY)}};CoSENode.prototype.propogateDisplacementToChildren=function(dX,dY){var nodes=this.getChild().getNodes();var node;for(var i=0;i{function _toConsumableArray(arr){if(Array.isArray(arr)){for(var i=0,arr2=Array(arr.length);i0){var position=0;fixedIds.forEach(function(fixedId){if(direction=="horizontal"){positionMap.set(fixedId,nodeIndexes.has(fixedId)?xCoords[nodeIndexes.get(fixedId)]:dummyPositions.get(fixedId));position+=positionMap.get(fixedId)}else{positionMap.set(fixedId,nodeIndexes.has(fixedId)?yCoords[nodeIndexes.get(fixedId)]:dummyPositions.get(fixedId));position+=positionMap.get(fixedId)}});position=position/fixedIds.length;component.forEach(function(nodeId){if(!fixedNodes.has(nodeId)){positionMap.set(nodeId,position)}})}else{var _position=0;component.forEach(function(nodeId){if(direction=="horizontal"){_position+=nodeIndexes.has(nodeId)?xCoords[nodeIndexes.get(nodeId)]:dummyPositions.get(nodeId)}else{_position+=nodeIndexes.has(nodeId)?yCoords[nodeIndexes.get(nodeId)]:dummyPositions.get(nodeId)}});_position=_position/component.length;component.forEach(function(nodeId){positionMap.set(nodeId,_position)})}})}var _loop=function _loop(){var currentNode=queue.shift();var neighbors=graph.get(currentNode);neighbors.forEach(function(neighbor){if(positionMap.get(neighbor.id)maxBefore){maxBefore=posBefore}if(posAftermaxAfter){maxAfter=posAfter}}}catch(err){_didIteratorError3=true;_iteratorError3=err}finally{try{if(!_iteratorNormalCompletion3&&_iterator3.return){_iterator3.return()}}finally{if(_didIteratorError3){throw _iteratorError3}}}var diff=(minBefore+maxBefore)/2-(minAfter+maxAfter)/2;var _iteratorNormalCompletion4=true;var _didIteratorError4=false;var _iteratorError4=undefined;try{for(var _iterator4=component[Symbol.iterator](),_step4;!(_iteratorNormalCompletion4=(_step4=_iterator4.next()).done);_iteratorNormalCompletion4=true){var _nodeId=_step4.value;positionMap.set(_nodeId,positionMap.get(_nodeId)+diff)}}catch(err){_didIteratorError4=true;_iteratorError4=err}finally{try{if(!_iteratorNormalCompletion4&&_iterator4.return){_iterator4.return()}}finally{if(_didIteratorError4){throw _iteratorError4}}}})}return positionMap};var applyReflectionForRelativePlacement=function applyReflectionForRelativePlacement(relativePlacementConstraints){var reflectOnY=0,notReflectOnY=0;var reflectOnX=0,notReflectOnX=0;relativePlacementConstraints.forEach(function(constraint){if(constraint.left){xCoords[nodeIndexes.get(constraint.left)]-xCoords[nodeIndexes.get(constraint.right)]>=0?reflectOnY++:notReflectOnY++}else{yCoords[nodeIndexes.get(constraint.top)]-yCoords[nodeIndexes.get(constraint.bottom)]>=0?reflectOnX++:notReflectOnX++}});if(reflectOnY>notReflectOnY&&reflectOnX>notReflectOnX){for(var _i=0;_inotReflectOnY){for(var _i2=0;_i2notReflectOnX){for(var _i3=0;_i31){constraints.fixedNodeConstraint.forEach(function(nodeData,i){targetMatrix[i]=[nodeData.position.x,nodeData.position.y];sourceMatrix[i]=[xCoords[nodeIndexes.get(nodeData.nodeId)],yCoords[nodeIndexes.get(nodeData.nodeId)]]});standardTransformation=true}else if(constraints.alignmentConstraint){(function(){var count=0;if(constraints.alignmentConstraint.vertical){var verticalAlign=constraints.alignmentConstraint.vertical;var _loop2=function _loop2(_i4){var alignmentSet=new Set;verticalAlign[_i4].forEach(function(nodeId){alignmentSet.add(nodeId)});var intersection=new Set([].concat(_toConsumableArray(alignmentSet)).filter(function(x){return fixedNodes.has(x)}));var xPos=void 0;if(intersection.size>0)xPos=xCoords[nodeIndexes.get(intersection.values().next().value)];else xPos=calculateAvgPosition(alignmentSet).x;verticalAlign[_i4].forEach(function(nodeId){targetMatrix[count]=[xPos,yCoords[nodeIndexes.get(nodeId)]];sourceMatrix[count]=[xCoords[nodeIndexes.get(nodeId)],yCoords[nodeIndexes.get(nodeId)]];count++})};for(var _i4=0;_i40)yPos=xCoords[nodeIndexes.get(intersection.values().next().value)];else yPos=calculateAvgPosition(alignmentSet).y;horizontalAlign[_i5].forEach(function(nodeId){targetMatrix[count]=[xCoords[nodeIndexes.get(nodeId)],yPos];sourceMatrix[count]=[xCoords[nodeIndexes.get(nodeId)],yCoords[nodeIndexes.get(nodeId)]];count++})};for(var _i5=0;_i5largestComponentSize){largestComponentSize=components[_i6].length;largestComponentIndex=_i6}}if(largestComponentSize0){var translationAmount={x:0,y:0};constraints.fixedNodeConstraint.forEach(function(nodeData,i){var posInTheory={x:xCoords[nodeIndexes.get(nodeData.nodeId)],y:yCoords[nodeIndexes.get(nodeData.nodeId)]};var posDesired=nodeData.position;var posDiff=calculatePositionDiff(posDesired,posInTheory);translationAmount.x+=posDiff.x;translationAmount.y+=posDiff.y});translationAmount.x/=constraints.fixedNodeConstraint.length;translationAmount.y/=constraints.fixedNodeConstraint.length;xCoords.forEach(function(value,i){xCoords[i]+=translationAmount.x});yCoords.forEach(function(value,i){yCoords[i]+=translationAmount.y});constraints.fixedNodeConstraint.forEach(function(nodeData){xCoords[nodeIndexes.get(nodeData.nodeId)]=nodeData.position.x;yCoords[nodeIndexes.get(nodeData.nodeId)]=nodeData.position.y})}if(constraints.alignmentConstraint){if(constraints.alignmentConstraint.vertical){var xAlign=constraints.alignmentConstraint.vertical;var _loop4=function _loop4(_i9){var alignmentSet=new Set;xAlign[_i9].forEach(function(nodeId){alignmentSet.add(nodeId)});var intersection=new Set([].concat(_toConsumableArray(alignmentSet)).filter(function(x){return fixedNodes.has(x)}));var xPos=void 0;if(intersection.size>0)xPos=xCoords[nodeIndexes.get(intersection.values().next().value)];else xPos=calculateAvgPosition(alignmentSet).x;alignmentSet.forEach(function(nodeId){if(!fixedNodes.has(nodeId))xCoords[nodeIndexes.get(nodeId)]=xPos})};for(var _i9=0;_i90)yPos=yCoords[nodeIndexes.get(intersection.values().next().value)];else yPos=calculateAvgPosition(alignmentSet).y;alignmentSet.forEach(function(nodeId){if(!fixedNodes.has(nodeId))yCoords[nodeIndexes.get(nodeId)]=yPos})};for(var _i10=0;_i10{module.exports=__WEBPACK_EXTERNAL_MODULE__551__}};var __webpack_module_cache__={};function __webpack_require__(moduleId){var cachedModule=__webpack_module_cache__[moduleId];if(cachedModule!==undefined){return cachedModule.exports}var module=__webpack_module_cache__[moduleId]={exports:{}};__webpack_modules__[moduleId](module,module.exports,__webpack_require__);return module.exports}var __webpack_exports__=__webpack_require__(45);return __webpack_exports__})()}); diff --git a/assets/js/cytoscape-fcose.min.js b/assets/js/cytoscape-fcose.min.js new file mode 100644 index 0000000..b3356a5 --- /dev/null +++ b/assets/js/cytoscape-fcose.min.js @@ -0,0 +1 @@ +(function webpackUniversalModuleDefinition(root,factory){if(typeof exports==="object"&&typeof module==="object")module.exports=factory(require("cose-base"));else if(typeof define==="function"&&define.amd)define(["cose-base"],factory);else if(typeof exports==="object")exports["cytoscapeFcose"]=factory(require("cose-base"));else root["cytoscapeFcose"]=factory(root["coseBase"])})(this,function(__WEBPACK_EXTERNAL_MODULE__140__){return(()=>{"use strict";var __webpack_modules__={658:module=>{module.exports=Object.assign!=null?Object.assign.bind(Object):function(tgt){for(var _len=arguments.length,srcs=Array(_len>1?_len-1:0),_key=1;_key<_len;_key++){srcs[_key-1]=arguments[_key]}srcs.forEach(function(src){Object.keys(src).forEach(function(k){return tgt[k]=src[k]})});return tgt}},548:(module,__unused_webpack_exports,__webpack_require__)=>{var _slicedToArray=function(){function sliceIterator(arr,i){var _arr=[];var _n=true;var _d=false;var _e=undefined;try{for(var _i=arr[Symbol.iterator](),_s;!(_n=(_s=_i.next()).done);_n=true){_arr.push(_s.value);if(i&&_arr.length===i)break}}catch(err){_d=true;_e=err}finally{try{if(!_n&&_i["return"])_i["return"]()}finally{if(_d)throw _e}}return _arr}return function(arr,i){if(Array.isArray(arr)){return arr}else if(Symbol.iterator in Object(arr)){return sliceIterator(arr,i)}else{throw new TypeError("Invalid attempt to destructure non-iterable instance")}}}();var LinkedList=__webpack_require__(140).layoutBase.LinkedList;var auxiliary={};auxiliary.getTopMostNodes=function(nodes){var nodesMap={};for(var i=0;i0){neighborNodes.merge(node)}});for(var i=0;i1){minDegreeNode=visitedTopMostNodes[0];minDegree=minDegreeNode.connectedEdges().length;visitedTopMostNodes.forEach(function(node){if(node.connectedEdges().length0){dummyNodes.set("dummy"+(dummyNodes.size+1),nodesConnectedToDummy)}}return components};auxiliary.relocateComponent=function(originalCenter,componentResult,options){if(!options.fixedNodeConstraint){var minXCoord=Number.POSITIVE_INFINITY;var maxXCoord=Number.NEGATIVE_INFINITY;var minYCoord=Number.POSITIVE_INFINITY;var maxYCoord=Number.NEGATIVE_INFINITY;if(options.quality=="draft"){var _iteratorNormalCompletion=true;var _didIteratorError=false;var _iteratorError=undefined;try{for(var _iterator=componentResult.nodeIndexes[Symbol.iterator](),_step;!(_iteratorNormalCompletion=(_step=_iterator.next()).done);_iteratorNormalCompletion=true){var _ref=_step.value;var _ref2=_slicedToArray(_ref,2);var key=_ref2[0];var value=_ref2[1];var cyNode=options.cy.getElementById(key);if(cyNode){var nodeBB=cyNode.boundingBox();var leftX=componentResult.xCoords[value]-nodeBB.w/2;var rightX=componentResult.xCoords[value]+nodeBB.w/2;var topY=componentResult.yCoords[value]-nodeBB.h/2;var bottomY=componentResult.yCoords[value]+nodeBB.h/2;if(leftXmaxXCoord)maxXCoord=rightX;if(topYmaxYCoord)maxYCoord=bottomY}}}catch(err){_didIteratorError=true;_iteratorError=err}finally{try{if(!_iteratorNormalCompletion&&_iterator.return){_iterator.return()}}finally{if(_didIteratorError){throw _iteratorError}}}var diffOnX=originalCenter.x-(maxXCoord+minXCoord)/2;var diffOnY=originalCenter.y-(maxYCoord+minYCoord)/2;componentResult.xCoords=componentResult.xCoords.map(function(x){return x+diffOnX});componentResult.yCoords=componentResult.yCoords.map(function(y){return y+diffOnY})}else{Object.keys(componentResult).forEach(function(item){var node=componentResult[item];var leftX=node.getRect().x;var rightX=node.getRect().x+node.getRect().width;var topY=node.getRect().y;var bottomY=node.getRect().y+node.getRect().height;if(leftXmaxXCoord)maxXCoord=rightX;if(topYmaxYCoord)maxYCoord=bottomY});var _diffOnX=originalCenter.x-(maxXCoord+minXCoord)/2;var _diffOnY=originalCenter.y-(maxYCoord+minYCoord)/2;Object.keys(componentResult).forEach(function(item){var node=componentResult[item];node.setCenter(node.getCenterX()+_diffOnX,node.getCenterY()+_diffOnY)})}}};auxiliary.calcBoundingBox=function(parentNode,xCoords,yCoords,nodeIndexes){var left=Number.MAX_SAFE_INTEGER;var right=Number.MIN_SAFE_INTEGER;var top=Number.MAX_SAFE_INTEGER;var bottom=Number.MIN_SAFE_INTEGER;var nodeLeft=void 0;var nodeRight=void 0;var nodeTop=void 0;var nodeBottom=void 0;var nodes=parentNode.descendants().not(":parent");var s=nodes.length;for(var i=0;inodeLeft){left=nodeLeft}if(rightnodeTop){top=nodeTop}if(bottom{var aux=__webpack_require__(548);var CoSELayout=__webpack_require__(140).CoSELayout;var CoSENode=__webpack_require__(140).CoSENode;var PointD=__webpack_require__(140).layoutBase.PointD;var DimensionD=__webpack_require__(140).layoutBase.DimensionD;var LayoutConstants=__webpack_require__(140).layoutBase.LayoutConstants;var FDLayoutConstants=__webpack_require__(140).layoutBase.FDLayoutConstants;var CoSEConstants=__webpack_require__(140).CoSEConstants;var coseLayout=function coseLayout(options,spectralResult){var cy=options.cy;var eles=options.eles;var nodes=eles.nodes();var edges=eles.edges();var nodeIndexes=void 0;var xCoords=void 0;var yCoords=void 0;var idToLNode={};if(options.randomize){nodeIndexes=spectralResult["nodeIndexes"];xCoords=spectralResult["xCoords"];yCoords=spectralResult["yCoords"]}var isFn=function isFn(fn){return typeof fn==="function"};var optFn=function optFn(opt,ele){if(isFn(opt)){return opt(ele)}else{return opt}};var parentsWithoutChildren=aux.calcParentsWithoutChildren(cy,eles);var processChildrenList=function processChildrenList(parent,children,layout,options){var size=children.length;for(var i=0;i0){var theNewGraph=void 0;theNewGraph=layout.getGraphManager().add(layout.newGraph(),theNode);processChildrenList(theNewGraph,children_of_children,layout,options)}}};var processEdges=function processEdges(layout,gm,edges){var idealLengthTotal=0;var edgeCount=0;for(var i=0;i0)CoSEConstants.DEFAULT_EDGE_LENGTH=FDLayoutConstants.DEFAULT_EDGE_LENGTH=idealLengthTotal/edgeCount;else if(!isFn(options.idealEdgeLength))CoSEConstants.DEFAULT_EDGE_LENGTH=FDLayoutConstants.DEFAULT_EDGE_LENGTH=options.idealEdgeLength;else CoSEConstants.DEFAULT_EDGE_LENGTH=FDLayoutConstants.DEFAULT_EDGE_LENGTH=50;CoSEConstants.MIN_REPULSION_DIST=FDLayoutConstants.MIN_REPULSION_DIST=FDLayoutConstants.DEFAULT_EDGE_LENGTH/10;CoSEConstants.DEFAULT_RADIAL_SEPARATION=FDLayoutConstants.DEFAULT_EDGE_LENGTH}};var processConstraints=function processConstraints(layout,options){if(options.fixedNodeConstraint){layout.constraints["fixedNodeConstraint"]=options.fixedNodeConstraint}if(options.alignmentConstraint){layout.constraints["alignmentConstraint"]=options.alignmentConstraint}if(options.relativePlacementConstraint){layout.constraints["relativePlacementConstraint"]=options.relativePlacementConstraint}};if(options.nestingFactor!=null)CoSEConstants.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=FDLayoutConstants.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=options.nestingFactor;if(options.gravity!=null)CoSEConstants.DEFAULT_GRAVITY_STRENGTH=FDLayoutConstants.DEFAULT_GRAVITY_STRENGTH=options.gravity;if(options.numIter!=null)CoSEConstants.MAX_ITERATIONS=FDLayoutConstants.MAX_ITERATIONS=options.numIter;if(options.gravityRange!=null)CoSEConstants.DEFAULT_GRAVITY_RANGE_FACTOR=FDLayoutConstants.DEFAULT_GRAVITY_RANGE_FACTOR=options.gravityRange;if(options.gravityCompound!=null)CoSEConstants.DEFAULT_COMPOUND_GRAVITY_STRENGTH=FDLayoutConstants.DEFAULT_COMPOUND_GRAVITY_STRENGTH=options.gravityCompound;if(options.gravityRangeCompound!=null)CoSEConstants.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=FDLayoutConstants.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=options.gravityRangeCompound;if(options.initialEnergyOnIncremental!=null)CoSEConstants.DEFAULT_COOLING_FACTOR_INCREMENTAL=FDLayoutConstants.DEFAULT_COOLING_FACTOR_INCREMENTAL=options.initialEnergyOnIncremental;if(options.tilingCompareBy!=null)CoSEConstants.TILING_COMPARE_BY=options.tilingCompareBy;if(options.quality=="proof")LayoutConstants.QUALITY=2;else LayoutConstants.QUALITY=0;CoSEConstants.NODE_DIMENSIONS_INCLUDE_LABELS=FDLayoutConstants.NODE_DIMENSIONS_INCLUDE_LABELS=LayoutConstants.NODE_DIMENSIONS_INCLUDE_LABELS=options.nodeDimensionsIncludeLabels;CoSEConstants.DEFAULT_INCREMENTAL=FDLayoutConstants.DEFAULT_INCREMENTAL=LayoutConstants.DEFAULT_INCREMENTAL=!options.randomize;CoSEConstants.ANIMATE=FDLayoutConstants.ANIMATE=LayoutConstants.ANIMATE=options.animate;CoSEConstants.TILE=options.tile;CoSEConstants.TILING_PADDING_VERTICAL=typeof options.tilingPaddingVertical==="function"?options.tilingPaddingVertical.call():options.tilingPaddingVertical;CoSEConstants.TILING_PADDING_HORIZONTAL=typeof options.tilingPaddingHorizontal==="function"?options.tilingPaddingHorizontal.call():options.tilingPaddingHorizontal;CoSEConstants.DEFAULT_INCREMENTAL=FDLayoutConstants.DEFAULT_INCREMENTAL=LayoutConstants.DEFAULT_INCREMENTAL=true;CoSEConstants.PURE_INCREMENTAL=!options.randomize;LayoutConstants.DEFAULT_UNIFORM_LEAF_NODE_SIZES=options.uniformNodeDimensions;if(options.step=="transformed"){CoSEConstants.TRANSFORM_ON_CONSTRAINT_HANDLING=true;CoSEConstants.ENFORCE_CONSTRAINTS=false;CoSEConstants.APPLY_LAYOUT=false}if(options.step=="enforced"){CoSEConstants.TRANSFORM_ON_CONSTRAINT_HANDLING=false;CoSEConstants.ENFORCE_CONSTRAINTS=true;CoSEConstants.APPLY_LAYOUT=false}if(options.step=="cose"){CoSEConstants.TRANSFORM_ON_CONSTRAINT_HANDLING=false;CoSEConstants.ENFORCE_CONSTRAINTS=false;CoSEConstants.APPLY_LAYOUT=true}if(options.step=="all"){if(options.randomize)CoSEConstants.TRANSFORM_ON_CONSTRAINT_HANDLING=true;else CoSEConstants.TRANSFORM_ON_CONSTRAINT_HANDLING=false;CoSEConstants.ENFORCE_CONSTRAINTS=true;CoSEConstants.APPLY_LAYOUT=true}if(options.fixedNodeConstraint||options.alignmentConstraint||options.relativePlacementConstraint){CoSEConstants.TREE_REDUCTION_ON_INCREMENTAL=false}else{CoSEConstants.TREE_REDUCTION_ON_INCREMENTAL=true}var coseLayout=new CoSELayout;var gm=coseLayout.newGraphManager();processChildrenList(gm.addRoot(),aux.getTopMostNodes(nodes),coseLayout,options);processEdges(coseLayout,gm,edges);processConstraints(coseLayout,options);coseLayout.runLayout();return idToLNode};module.exports={coseLayout:coseLayout}},212:(module,__unused_webpack_exports,__webpack_require__)=>{var _createClass=function(){function defineProperties(target,props){for(var i=0;i0){if(!packingEnabled){var boundingBox=options.eles.boundingBox();componentCenters.push({x:boundingBox.x1+boundingBox.w/2,y:boundingBox.y1+boundingBox.h/2});if(options.randomize){var result=spectralLayout(options);spectralResult.push(result)}if(options.quality=="default"||options.quality=="proof"){coseResult.push(coseLayout(options,spectralResult[0]));aux.relocateComponent(componentCenters[0],coseResult[0],options)}else{aux.relocateComponent(componentCenters[0],spectralResult[0],options)}}else{var topMostNodes=aux.getTopMostNodes(options.eles.nodes());components=aux.connectComponents(cy,options.eles,topMostNodes);components.forEach(function(component){var boundingBox=component.boundingBox();componentCenters.push({x:boundingBox.x1+boundingBox.w/2,y:boundingBox.y1+boundingBox.h/2})});if(options.randomize){components.forEach(function(component){options.eles=component;spectralResult.push(spectralLayout(options))})}if(options.quality=="default"||options.quality=="proof"){var toBeTiledNodes=cy.collection();if(options.tile){var nodeIndexes=new Map;var _xCoords=[];var _yCoords=[];var count=0;var tempSpectralResult={nodeIndexes:nodeIndexes,xCoords:_xCoords,yCoords:_yCoords};var indexesToBeDeleted=[];components.forEach(function(component,index){if(component.edges().length==0){component.nodes().forEach(function(node,i){toBeTiledNodes.merge(component.nodes()[i]);if(!node.isParent()){tempSpectralResult.nodeIndexes.set(component.nodes()[i].id(),count++);tempSpectralResult.xCoords.push(component.nodes()[0].position().x);tempSpectralResult.yCoords.push(component.nodes()[0].position().y)}});indexesToBeDeleted.push(index)}});if(toBeTiledNodes.length>1){var _boundingBox=toBeTiledNodes.boundingBox();componentCenters.push({x:_boundingBox.x1+_boundingBox.w/2,y:_boundingBox.y1+_boundingBox.h/2});components.push(toBeTiledNodes);spectralResult.push(tempSpectralResult);for(var i=indexesToBeDeleted.length-1;i>=0;i--){components.splice(indexesToBeDeleted[i],1);spectralResult.splice(indexesToBeDeleted[i],1);componentCenters.splice(indexesToBeDeleted[i],1)}}}components.forEach(function(component,index){options.eles=component;coseResult.push(coseLayout(options,spectralResult[index]));aux.relocateComponent(componentCenters[index],coseResult[index],options)})}else{components.forEach(function(component,index){aux.relocateComponent(componentCenters[index],spectralResult[index],options)})}var componentsEvaluated=new Set;if(components.length>1){var subgraphs=[];var hiddenEles=eles.filter(function(ele){return ele.css("display")=="none"});components.forEach(function(component,index){var nodeIndexes=void 0;if(options.quality=="draft"){nodeIndexes=spectralResult[index].nodeIndexes}if(component.nodes().not(hiddenEles).length>0){var subgraph={};subgraph.edges=[];subgraph.nodes=[];var nodeIndex=void 0;component.nodes().not(hiddenEles).forEach(function(node){if(options.quality=="draft"){if(!node.isParent()){nodeIndex=nodeIndexes.get(node.id());subgraph.nodes.push({x:spectralResult[index].xCoords[nodeIndex]-node.boundingbox().w/2,y:spectralResult[index].yCoords[nodeIndex]-node.boundingbox().h/2,width:node.boundingbox().w,height:node.boundingbox().h})}else{var parentInfo=aux.calcBoundingBox(node,spectralResult[index].xCoords,spectralResult[index].yCoords,nodeIndexes);subgraph.nodes.push({x:parentInfo.topLeftX,y:parentInfo.topLeftY,width:parentInfo.width,height:parentInfo.height})}}else{if(coseResult[index][node.id()]){subgraph.nodes.push({x:coseResult[index][node.id()].getLeft(),y:coseResult[index][node.id()].getTop(),width:coseResult[index][node.id()].getWidth(),height:coseResult[index][node.id()].getHeight()})}}});component.edges().forEach(function(edge){var source=edge.source();var target=edge.target();if(source.css("display")!="none"&&target.css("display")!="none"){if(options.quality=="draft"){var sourceNodeIndex=nodeIndexes.get(source.id());var targetNodeIndex=nodeIndexes.get(target.id());var sourceCenter=[];var targetCenter=[];if(source.isParent()){var parentInfo=aux.calcBoundingBox(source,spectralResult[index].xCoords,spectralResult[index].yCoords,nodeIndexes);sourceCenter.push(parentInfo.topLeftX+parentInfo.width/2);sourceCenter.push(parentInfo.topLeftY+parentInfo.height/2)}else{sourceCenter.push(spectralResult[index].xCoords[sourceNodeIndex]);sourceCenter.push(spectralResult[index].yCoords[sourceNodeIndex])}if(target.isParent()){var _parentInfo=aux.calcBoundingBox(target,spectralResult[index].xCoords,spectralResult[index].yCoords,nodeIndexes);targetCenter.push(_parentInfo.topLeftX+_parentInfo.width/2);targetCenter.push(_parentInfo.topLeftY+_parentInfo.height/2)}else{targetCenter.push(spectralResult[index].xCoords[targetNodeIndex]);targetCenter.push(spectralResult[index].yCoords[targetNodeIndex])}subgraph.edges.push({startX:sourceCenter[0],startY:sourceCenter[1],endX:targetCenter[0],endY:targetCenter[1]})}else{if(coseResult[index][source.id()]&&coseResult[index][target.id()]){subgraph.edges.push({startX:coseResult[index][source.id()].getCenterX(),startY:coseResult[index][source.id()].getCenterY(),endX:coseResult[index][target.id()].getCenterX(),endY:coseResult[index][target.id()].getCenterY()})}}}});if(subgraph.nodes.length>0){subgraphs.push(subgraph);componentsEvaluated.add(index)}}});var shiftResult=layUtil.packComponents(subgraphs,options.randomize).shifts;if(options.quality=="draft"){spectralResult.forEach(function(result,index){var newXCoords=result.xCoords.map(function(x){return x+shiftResult[index].dx});var newYCoords=result.yCoords.map(function(y){return y+shiftResult[index].dy});result.xCoords=newXCoords;result.yCoords=newYCoords})}else{var _count=0;componentsEvaluated.forEach(function(index){Object.keys(coseResult[index]).forEach(function(item){var nodeRectangle=coseResult[index][item];nodeRectangle.setCenter(nodeRectangle.getCenterX()+shiftResult[_count].dx,nodeRectangle.getCenterY()+shiftResult[_count].dy)});_count++})}}}}var getPositions=function getPositions(ele,i){if(options.quality=="default"||options.quality=="proof"){if(typeof ele==="number"){ele=i}var pos=void 0;var node=void 0;var theId=ele.data("id");coseResult.forEach(function(result){if(theId in result){pos={x:result[theId].getRect().getCenterX(),y:result[theId].getRect().getCenterY()};node=result[theId]}});if(options.nodeDimensionsIncludeLabels){if(node.labelWidth){if(node.labelPosHorizontal=="left"){pos.x+=node.labelWidth/2}else if(node.labelPosHorizontal=="right"){pos.x-=node.labelWidth/2}}if(node.labelHeight){if(node.labelPosVertical=="top"){pos.y+=node.labelHeight/2}else if(node.labelPosVertical=="bottom"){pos.y-=node.labelHeight/2}}}if(pos==undefined)pos={x:ele.position("x"),y:ele.position("y")};return{x:pos.x,y:pos.y}}else{var _pos=void 0;spectralResult.forEach(function(result){var index=result.nodeIndexes.get(ele.id());if(index!=undefined){_pos={x:result.xCoords[index],y:result.yCoords[index]}}});if(_pos==undefined)_pos={x:ele.position("x"),y:ele.position("y")};return{x:_pos.x,y:_pos.y}}};if(options.quality=="default"||options.quality=="proof"||options.randomize){var parentsWithoutChildren=aux.calcParentsWithoutChildren(cy,eles);var _hiddenEles=eles.filter(function(ele){return ele.css("display")=="none"});options.eles=eles.not(_hiddenEles);eles.nodes().not(":parent").not(_hiddenEles).layoutPositions(layout,options,getPositions);if(parentsWithoutChildren.length>0){parentsWithoutChildren.forEach(function(ele){ele.position(getPositions(ele))})}}else{console.log("If randomize option is set to false, then quality option must be 'default' or 'proof'.")}}}]);return Layout}();module.exports=Layout},657:(module,__unused_webpack_exports,__webpack_require__)=>{var aux=__webpack_require__(548);var Matrix=__webpack_require__(140).layoutBase.Matrix;var SVD=__webpack_require__(140).layoutBase.SVD;var spectralLayout=function spectralLayout(options){var cy=options.cy;var eles=options.eles;var nodes=eles.nodes();var parentNodes=eles.nodes(":parent");var dummyNodes=new Map;var nodeIndexes=new Map;var parentChildMap=new Map;var allNodesNeighborhood=[];var xCoords=[];var yCoords=[];var samplesColumn=[];var minDistancesColumn=[];var C=[];var PHI=[];var INV=[];var firstSample=void 0;var nodeSize=void 0;var infinity=1e8;var small=1e-9;var piTol=options.piTol;var samplingType=options.samplingType;var nodeSeparation=options.nodeSeparation;var sampleSize=void 0;var randomSampleCR=function randomSampleCR(){var sample=0;var count=0;var flag=false;while(count=front){current=path[front++];var neighbors=allNodesNeighborhood[current];for(var _i=0;_imax_dist){max_dist=minDistancesColumn[_i3];max_ind=_i3}}}return max_ind};var allBFS=function allBFS(samplingMethod){var sample=void 0;if(!samplingMethod){randomSampleCR();for(var i=0;i=1){break}previous=current}for(var _i10=0;_i10=1){break}previous=current}for(var _i12=0;_i120){if(node.isParent())allNodesNeighborhood[eleIndex].push(parentChildMap.get(node.id()));else allNodesNeighborhood[eleIndex].push(node.id())}})});var _loop=function _loop(_key){var eleIndex=nodeIndexes.get(_key);var disconnectedId=void 0;dummyNodes.get(_key).forEach(function(id){if(cy.getElementById(id).isParent())disconnectedId=parentChildMap.get(id);else disconnectedId=id;allNodesNeighborhood[eleIndex].push(disconnectedId);allNodesNeighborhood[nodeIndexes.get(disconnectedId)].push(_key)})};var _iteratorNormalCompletion2=true;var _didIteratorError2=false;var _iteratorError2=undefined;try{for(var _iterator2=dummyNodes.keys()[Symbol.iterator](),_step2;!(_iteratorNormalCompletion2=(_step2=_iterator2.next()).done);_iteratorNormalCompletion2=true){var _key=_step2.value;_loop(_key)}}catch(err){_didIteratorError2=true;_iteratorError2=err}finally{try{if(!_iteratorNormalCompletion2&&_iterator2.return){_iterator2.return()}}finally{if(_didIteratorError2){throw _iteratorError2}}}nodeSize=nodeIndexes.size;var spectralResult=void 0;if(nodeSize>2){sampleSize=nodeSize{var impl=__webpack_require__(212);var register=function register(cytoscape){if(!cytoscape){return}cytoscape("layout","fcose",impl)};if(typeof cytoscape!=="undefined"){register(cytoscape)}module.exports=register},140:module=>{module.exports=__WEBPACK_EXTERNAL_MODULE__140__}};var __webpack_module_cache__={};function __webpack_require__(moduleId){var cachedModule=__webpack_module_cache__[moduleId];if(cachedModule!==undefined){return cachedModule.exports}var module=__webpack_module_cache__[moduleId]={exports:{}};__webpack_modules__[moduleId](module,module.exports,__webpack_require__);return module.exports}var __webpack_exports__=__webpack_require__(579);return __webpack_exports__})()}); diff --git a/assets/js/layout-base.min.js b/assets/js/layout-base.min.js new file mode 100644 index 0000000..c7ed479 --- /dev/null +++ b/assets/js/layout-base.min.js @@ -0,0 +1 @@ +(function webpackUniversalModuleDefinition(root,factory){if(typeof exports==="object"&&typeof module==="object")module.exports=factory();else if(typeof define==="function"&&define.amd)define([],factory);else if(typeof exports==="object")exports["layoutBase"]=factory();else root["layoutBase"]=factory()})(this,function(){return function(modules){var installedModules={};function __webpack_require__(moduleId){if(installedModules[moduleId]){return installedModules[moduleId].exports}var module=installedModules[moduleId]={i:moduleId,l:false,exports:{}};modules[moduleId].call(module.exports,module,module.exports,__webpack_require__);module.l=true;return module.exports}__webpack_require__.m=modules;__webpack_require__.c=installedModules;__webpack_require__.i=function(value){return value};__webpack_require__.d=function(exports,name,getter){if(!__webpack_require__.o(exports,name)){Object.defineProperty(exports,name,{configurable:false,enumerable:true,get:getter})}};__webpack_require__.n=function(module){var getter=module&&module.__esModule?function getDefault(){return module["default"]}:function getModuleExports(){return module};__webpack_require__.d(getter,"a",getter);return getter};__webpack_require__.o=function(object,property){return Object.prototype.hasOwnProperty.call(object,property)};__webpack_require__.p="";return __webpack_require__(__webpack_require__.s=28)}([function(module,exports,__webpack_require__){"use strict";function LayoutConstants(){}LayoutConstants.QUALITY=1;LayoutConstants.DEFAULT_CREATE_BENDS_AS_NEEDED=false;LayoutConstants.DEFAULT_INCREMENTAL=false;LayoutConstants.DEFAULT_ANIMATION_ON_LAYOUT=true;LayoutConstants.DEFAULT_ANIMATION_DURING_LAYOUT=false;LayoutConstants.DEFAULT_ANIMATION_PERIOD=50;LayoutConstants.DEFAULT_UNIFORM_LEAF_NODE_SIZES=false;LayoutConstants.DEFAULT_GRAPH_MARGIN=15;LayoutConstants.NODE_DIMENSIONS_INCLUDE_LABELS=false;LayoutConstants.SIMPLE_NODE_SIZE=40;LayoutConstants.SIMPLE_NODE_HALF_SIZE=LayoutConstants.SIMPLE_NODE_SIZE/2;LayoutConstants.EMPTY_COMPOUND_NODE_SIZE=40;LayoutConstants.MIN_EDGE_LENGTH=1;LayoutConstants.WORLD_BOUNDARY=1e6;LayoutConstants.INITIAL_WORLD_BOUNDARY=LayoutConstants.WORLD_BOUNDARY/1e3;LayoutConstants.WORLD_CENTER_X=1200;LayoutConstants.WORLD_CENTER_Y=900;module.exports=LayoutConstants},function(module,exports,__webpack_require__){"use strict";var LGraphObject=__webpack_require__(2);var IGeometry=__webpack_require__(8);var IMath=__webpack_require__(9);function LEdge(source,target,vEdge){LGraphObject.call(this,vEdge);this.isOverlapingSourceAndTarget=false;this.vGraphObject=vEdge;this.bendpoints=[];this.source=source;this.target=target}LEdge.prototype=Object.create(LGraphObject.prototype);for(var prop in LGraphObject){LEdge[prop]=LGraphObject[prop]}LEdge.prototype.getSource=function(){return this.source};LEdge.prototype.getTarget=function(){return this.target};LEdge.prototype.isInterGraph=function(){return this.isInterGraph};LEdge.prototype.getLength=function(){return this.length};LEdge.prototype.isOverlapingSourceAndTarget=function(){return this.isOverlapingSourceAndTarget};LEdge.prototype.getBendpoints=function(){return this.bendpoints};LEdge.prototype.getLca=function(){return this.lca};LEdge.prototype.getSourceInLca=function(){return this.sourceInLca};LEdge.prototype.getTargetInLca=function(){return this.targetInLca};LEdge.prototype.getOtherEnd=function(node){if(this.source===node){return this.target}else if(this.target===node){return this.source}else{throw"Node is not incident with this edge"}};LEdge.prototype.getOtherEndInGraph=function(node,graph){var otherEnd=this.getOtherEnd(node);var root=graph.getGraphManager().getRoot();while(true){if(otherEnd.getOwner()==graph){return otherEnd}if(otherEnd.getOwner()==root){break}otherEnd=otherEnd.getOwner().getParent()}return null};LEdge.prototype.updateLength=function(){var clipPointCoordinates=new Array(4);this.isOverlapingSourceAndTarget=IGeometry.getIntersection(this.target.getRect(),this.source.getRect(),clipPointCoordinates);if(!this.isOverlapingSourceAndTarget){this.lengthX=clipPointCoordinates[0]-clipPointCoordinates[2];this.lengthY=clipPointCoordinates[1]-clipPointCoordinates[3];if(Math.abs(this.lengthX)<1){this.lengthX=IMath.sign(this.lengthX)}if(Math.abs(this.lengthY)<1){this.lengthY=IMath.sign(this.lengthY)}this.length=Math.sqrt(this.lengthX*this.lengthX+this.lengthY*this.lengthY)}};LEdge.prototype.updateLengthSimple=function(){this.lengthX=this.target.getCenterX()-this.source.getCenterX();this.lengthY=this.target.getCenterY()-this.source.getCenterY();if(Math.abs(this.lengthX)<1){this.lengthX=IMath.sign(this.lengthX)}if(Math.abs(this.lengthY)<1){this.lengthY=IMath.sign(this.lengthY)}this.length=Math.sqrt(this.lengthX*this.lengthX+this.lengthY*this.lengthY)};module.exports=LEdge},function(module,exports,__webpack_require__){"use strict";function LGraphObject(vGraphObject){this.vGraphObject=vGraphObject}module.exports=LGraphObject},function(module,exports,__webpack_require__){"use strict";var LGraphObject=__webpack_require__(2);var Integer=__webpack_require__(10);var RectangleD=__webpack_require__(13);var LayoutConstants=__webpack_require__(0);var RandomSeed=__webpack_require__(16);var PointD=__webpack_require__(5);function LNode(gm,loc,size,vNode){if(size==null&&vNode==null){vNode=loc}LGraphObject.call(this,vNode);if(gm.graphManager!=null)gm=gm.graphManager;this.estimatedSize=Integer.MIN_VALUE;this.inclusionTreeDepth=Integer.MAX_VALUE;this.vGraphObject=vNode;this.edges=[];this.graphManager=gm;if(size!=null&&loc!=null)this.rect=new RectangleD(loc.x,loc.y,size.width,size.height);else this.rect=new RectangleD}LNode.prototype=Object.create(LGraphObject.prototype);for(var prop in LGraphObject){LNode[prop]=LGraphObject[prop]}LNode.prototype.getEdges=function(){return this.edges};LNode.prototype.getChild=function(){return this.child};LNode.prototype.getOwner=function(){return this.owner};LNode.prototype.getWidth=function(){return this.rect.width};LNode.prototype.setWidth=function(width){this.rect.width=width};LNode.prototype.getHeight=function(){return this.rect.height};LNode.prototype.setHeight=function(height){this.rect.height=height};LNode.prototype.getCenterX=function(){return this.rect.x+this.rect.width/2};LNode.prototype.getCenterY=function(){return this.rect.y+this.rect.height/2};LNode.prototype.getCenter=function(){return new PointD(this.rect.x+this.rect.width/2,this.rect.y+this.rect.height/2)};LNode.prototype.getLocation=function(){return new PointD(this.rect.x,this.rect.y)};LNode.prototype.getRect=function(){return this.rect};LNode.prototype.getDiagonal=function(){return Math.sqrt(this.rect.width*this.rect.width+this.rect.height*this.rect.height)};LNode.prototype.getHalfTheDiagonal=function(){return Math.sqrt(this.rect.height*this.rect.height+this.rect.width*this.rect.width)/2};LNode.prototype.setRect=function(upperLeft,dimension){this.rect.x=upperLeft.x;this.rect.y=upperLeft.y;this.rect.width=dimension.width;this.rect.height=dimension.height};LNode.prototype.setCenter=function(cx,cy){this.rect.x=cx-this.rect.width/2;this.rect.y=cy-this.rect.height/2};LNode.prototype.setLocation=function(x,y){this.rect.x=x;this.rect.y=y};LNode.prototype.moveBy=function(dx,dy){this.rect.x+=dx;this.rect.y+=dy};LNode.prototype.getEdgeListToNode=function(to){var edgeList=[];var edge;var self=this;self.edges.forEach(function(edge){if(edge.target==to){if(edge.source!=self)throw"Incorrect edge source!";edgeList.push(edge)}});return edgeList};LNode.prototype.getEdgesBetween=function(other){var edgeList=[];var edge;var self=this;self.edges.forEach(function(edge){if(!(edge.source==self||edge.target==self))throw"Incorrect edge source and/or target";if(edge.target==other||edge.source==other){edgeList.push(edge)}});return edgeList};LNode.prototype.getNeighborsList=function(){var neighbors=new Set;var self=this;self.edges.forEach(function(edge){if(edge.source==self){neighbors.add(edge.target)}else{if(edge.target!=self){throw"Incorrect incidency!"}neighbors.add(edge.source)}});return neighbors};LNode.prototype.withChildren=function(){var withNeighborsList=new Set;var childNode;var children;withNeighborsList.add(this);if(this.child!=null){var nodes=this.child.getNodes();for(var i=0;iwidth){this.rect.x-=(this.labelWidth-width)/2;this.setWidth(this.labelWidth)}else if(this.labelPosHorizontal=="right"){this.setWidth(width+this.labelWidth)}}if(this.labelHeight){if(this.labelPosVertical=="top"){this.rect.y-=this.labelHeight;this.setHeight(height+this.labelHeight)}else if(this.labelPosVertical=="center"&&this.labelHeight>height){this.rect.y-=(this.labelHeight-height)/2;this.setHeight(this.labelHeight)}else if(this.labelPosVertical=="bottom"){this.setHeight(height+this.labelHeight)}}}}};LNode.prototype.getInclusionTreeDepth=function(){if(this.inclusionTreeDepth==Integer.MAX_VALUE){throw"assert failed"}return this.inclusionTreeDepth};LNode.prototype.transform=function(trans){var left=this.rect.x;if(left>LayoutConstants.WORLD_BOUNDARY){left=LayoutConstants.WORLD_BOUNDARY}else if(left<-LayoutConstants.WORLD_BOUNDARY){left=-LayoutConstants.WORLD_BOUNDARY}var top=this.rect.y;if(top>LayoutConstants.WORLD_BOUNDARY){top=LayoutConstants.WORLD_BOUNDARY}else if(top<-LayoutConstants.WORLD_BOUNDARY){top=-LayoutConstants.WORLD_BOUNDARY}var leftTop=new PointD(left,top);var vLeftTop=trans.inverseTransformPoint(leftTop);this.setLocation(vLeftTop.x,vLeftTop.y)};LNode.prototype.getLeft=function(){return this.rect.x};LNode.prototype.getRight=function(){return this.rect.x+this.rect.width};LNode.prototype.getTop=function(){return this.rect.y};LNode.prototype.getBottom=function(){return this.rect.y+this.rect.height};LNode.prototype.getParent=function(){if(this.owner==null){return null}return this.owner.getParent()};module.exports=LNode},function(module,exports,__webpack_require__){"use strict";var LayoutConstants=__webpack_require__(0);function FDLayoutConstants(){}for(var prop in LayoutConstants){FDLayoutConstants[prop]=LayoutConstants[prop]}FDLayoutConstants.MAX_ITERATIONS=2500;FDLayoutConstants.DEFAULT_EDGE_LENGTH=50;FDLayoutConstants.DEFAULT_SPRING_STRENGTH=.45;FDLayoutConstants.DEFAULT_REPULSION_STRENGTH=4500;FDLayoutConstants.DEFAULT_GRAVITY_STRENGTH=.4;FDLayoutConstants.DEFAULT_COMPOUND_GRAVITY_STRENGTH=1;FDLayoutConstants.DEFAULT_GRAVITY_RANGE_FACTOR=3.8;FDLayoutConstants.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=1.5;FDLayoutConstants.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION=true;FDLayoutConstants.DEFAULT_USE_SMART_REPULSION_RANGE_CALCULATION=true;FDLayoutConstants.DEFAULT_COOLING_FACTOR_INCREMENTAL=.3;FDLayoutConstants.COOLING_ADAPTATION_FACTOR=.33;FDLayoutConstants.ADAPTATION_LOWER_NODE_LIMIT=1e3;FDLayoutConstants.ADAPTATION_UPPER_NODE_LIMIT=5e3;FDLayoutConstants.MAX_NODE_DISPLACEMENT_INCREMENTAL=100;FDLayoutConstants.MAX_NODE_DISPLACEMENT=FDLayoutConstants.MAX_NODE_DISPLACEMENT_INCREMENTAL*3;FDLayoutConstants.MIN_REPULSION_DIST=FDLayoutConstants.DEFAULT_EDGE_LENGTH/10;FDLayoutConstants.CONVERGENCE_CHECK_PERIOD=100;FDLayoutConstants.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=.1;FDLayoutConstants.MIN_EDGE_LENGTH=1;FDLayoutConstants.GRID_CALCULATION_CHECK_PERIOD=10;module.exports=FDLayoutConstants},function(module,exports,__webpack_require__){"use strict";function PointD(x,y){if(x==null&&y==null){this.x=0;this.y=0}else{this.x=x;this.y=y}}PointD.prototype.getX=function(){return this.x};PointD.prototype.getY=function(){return this.y};PointD.prototype.setX=function(x){this.x=x};PointD.prototype.setY=function(y){this.y=y};PointD.prototype.getDifference=function(pt){return new DimensionD(this.x-pt.x,this.y-pt.y)};PointD.prototype.getCopy=function(){return new PointD(this.x,this.y)};PointD.prototype.translate=function(dim){this.x+=dim.width;this.y+=dim.height;return this};module.exports=PointD},function(module,exports,__webpack_require__){"use strict";var LGraphObject=__webpack_require__(2);var Integer=__webpack_require__(10);var LayoutConstants=__webpack_require__(0);var LGraphManager=__webpack_require__(7);var LNode=__webpack_require__(3);var LEdge=__webpack_require__(1);var RectangleD=__webpack_require__(13);var Point=__webpack_require__(12);var LinkedList=__webpack_require__(11);function LGraph(parent,obj2,vGraph){LGraphObject.call(this,vGraph);this.estimatedSize=Integer.MIN_VALUE;this.margin=LayoutConstants.DEFAULT_GRAPH_MARGIN;this.edges=[];this.nodes=[];this.isConnected=false;this.parent=parent;if(obj2!=null&&obj2 instanceof LGraphManager){this.graphManager=obj2}else if(obj2!=null&&obj2 instanceof Layout){this.graphManager=obj2.graphManager}}LGraph.prototype=Object.create(LGraphObject.prototype);for(var prop in LGraphObject){LGraph[prop]=LGraphObject[prop]}LGraph.prototype.getNodes=function(){return this.nodes};LGraph.prototype.getEdges=function(){return this.edges};LGraph.prototype.getGraphManager=function(){return this.graphManager};LGraph.prototype.getParent=function(){return this.parent};LGraph.prototype.getLeft=function(){return this.left};LGraph.prototype.getRight=function(){return this.right};LGraph.prototype.getTop=function(){return this.top};LGraph.prototype.getBottom=function(){return this.bottom};LGraph.prototype.isConnected=function(){return this.isConnected};LGraph.prototype.add=function(obj1,sourceNode,targetNode){if(sourceNode==null&&targetNode==null){var newNode=obj1;if(this.graphManager==null){throw"Graph has no graph mgr!"}if(this.getNodes().indexOf(newNode)>-1){throw"Node already in graph!"}newNode.owner=this;this.getNodes().push(newNode);return newNode}else{var newEdge=obj1;if(!(this.getNodes().indexOf(sourceNode)>-1&&this.getNodes().indexOf(targetNode)>-1)){throw"Source or target not in graph!"}if(!(sourceNode.owner==targetNode.owner&&sourceNode.owner==this)){throw"Both owners must be this graph!"}if(sourceNode.owner!=targetNode.owner){return null}newEdge.source=sourceNode;newEdge.target=targetNode;newEdge.isInterGraph=false;this.getEdges().push(newEdge);sourceNode.edges.push(newEdge);if(targetNode!=sourceNode){targetNode.edges.push(newEdge)}return newEdge}};LGraph.prototype.remove=function(obj){var node=obj;if(obj instanceof LNode){if(node==null){throw"Node is null!"}if(!(node.owner!=null&&node.owner==this)){throw"Owner graph is invalid!"}if(this.graphManager==null){throw"Owner graph manager is invalid!"}var edgesToBeRemoved=node.edges.slice();var edge;var s=edgesToBeRemoved.length;for(var i=0;i-1&&targetIndex>-1)){throw"Source and/or target doesn't know this edge!"}edge.source.edges.splice(sourceIndex,1);if(edge.target!=edge.source){edge.target.edges.splice(targetIndex,1)}var index=edge.source.owner.getEdges().indexOf(edge);if(index==-1){throw"Not in owner's edge list!"}edge.source.owner.getEdges().splice(index,1)}};LGraph.prototype.updateLeftTop=function(){var top=Integer.MAX_VALUE;var left=Integer.MAX_VALUE;var nodeTop;var nodeLeft;var margin;var nodes=this.getNodes();var s=nodes.length;for(var i=0;inodeTop){top=nodeTop}if(left>nodeLeft){left=nodeLeft}}if(top==Integer.MAX_VALUE){return null}if(nodes[0].getParent().paddingLeft!=undefined){margin=nodes[0].getParent().paddingLeft}else{margin=this.margin}this.left=left-margin;this.top=top-margin;return new Point(this.left,this.top)};LGraph.prototype.updateBounds=function(recursive){var left=Integer.MAX_VALUE;var right=-Integer.MAX_VALUE;var top=Integer.MAX_VALUE;var bottom=-Integer.MAX_VALUE;var nodeLeft;var nodeRight;var nodeTop;var nodeBottom;var margin;var nodes=this.nodes;var s=nodes.length;for(var i=0;inodeLeft){left=nodeLeft}if(rightnodeTop){top=nodeTop}if(bottomnodeLeft){left=nodeLeft}if(rightnodeTop){top=nodeTop}if(bottom=this.nodes.length){var noOfVisitedInThisGraph=0;visited.forEach(function(visitedNode){if(visitedNode.owner==self){noOfVisitedInThisGraph++}});if(noOfVisitedInThisGraph==this.nodes.length){this.isConnected=true}}};module.exports=LGraph},function(module,exports,__webpack_require__){"use strict";var LGraph;var LEdge=__webpack_require__(1);function LGraphManager(layout){LGraph=__webpack_require__(6);this.layout=layout;this.graphs=[];this.edges=[]}LGraphManager.prototype.addRoot=function(){var ngraph=this.layout.newGraph();var nnode=this.layout.newNode(null);var root=this.add(ngraph,nnode);this.setRootGraph(root);return this.rootGraph};LGraphManager.prototype.add=function(newGraph,parentNode,newEdge,sourceNode,targetNode){if(newEdge==null&&sourceNode==null&&targetNode==null){if(newGraph==null){throw"Graph is null!"}if(parentNode==null){throw"Parent node is null!"}if(this.graphs.indexOf(newGraph)>-1){throw"Graph already in this graph mgr!"}this.graphs.push(newGraph);if(newGraph.parent!=null){throw"Already has a parent!"}if(parentNode.child!=null){throw"Already has a child!"}newGraph.parent=parentNode;parentNode.child=newGraph;return newGraph}else{targetNode=newEdge;sourceNode=parentNode;newEdge=newGraph;var sourceGraph=sourceNode.getOwner();var targetGraph=targetNode.getOwner();if(!(sourceGraph!=null&&sourceGraph.getGraphManager()==this)){throw"Source not in this graph mgr!"}if(!(targetGraph!=null&&targetGraph.getGraphManager()==this)){throw"Target not in this graph mgr!"}if(sourceGraph==targetGraph){newEdge.isInterGraph=false;return sourceGraph.add(newEdge,sourceNode,targetNode)}else{newEdge.isInterGraph=true;newEdge.source=sourceNode;newEdge.target=targetNode;if(this.edges.indexOf(newEdge)>-1){throw"Edge already in inter-graph edge list!"}this.edges.push(newEdge);if(!(newEdge.source!=null&&newEdge.target!=null)){throw"Edge source and/or target is null!"}if(!(newEdge.source.edges.indexOf(newEdge)==-1&&newEdge.target.edges.indexOf(newEdge)==-1)){throw"Edge already in source and/or target incidency list!"}newEdge.source.edges.push(newEdge);newEdge.target.edges.push(newEdge);return newEdge}}};LGraphManager.prototype.remove=function(lObj){if(lObj instanceof LGraph){var graph=lObj;if(graph.getGraphManager()!=this){throw"Graph not in this graph mgr"}if(!(graph==this.rootGraph||graph.parent!=null&&graph.parent.graphManager==this)){throw"Invalid parent node!"}var edgesToBeRemoved=[];edgesToBeRemoved=edgesToBeRemoved.concat(graph.getEdges());var edge;var s=edgesToBeRemoved.length;for(var i=0;i=rectB.getRight()){overlapAmount[0]+=Math.min(rectB.getX()-rectA.getX(),rectA.getRight()-rectB.getRight())}else if(rectB.getX()<=rectA.getX()&&rectB.getRight()>=rectA.getRight()){overlapAmount[0]+=Math.min(rectA.getX()-rectB.getX(),rectB.getRight()-rectA.getRight())}if(rectA.getY()<=rectB.getY()&&rectA.getBottom()>=rectB.getBottom()){overlapAmount[1]+=Math.min(rectB.getY()-rectA.getY(),rectA.getBottom()-rectB.getBottom())}else if(rectB.getY()<=rectA.getY()&&rectB.getBottom()>=rectA.getBottom()){overlapAmount[1]+=Math.min(rectA.getY()-rectB.getY(),rectB.getBottom()-rectA.getBottom())}var slope=Math.abs((rectB.getCenterY()-rectA.getCenterY())/(rectB.getCenterX()-rectA.getCenterX()));if(rectB.getCenterY()===rectA.getCenterY()&&rectB.getCenterX()===rectA.getCenterX()){slope=1}var moveByY=slope*overlapAmount[0];var moveByX=overlapAmount[1]/slope;if(overlapAmount[0]p2y){result[0]=p1x;result[1]=topLeftAy;result[2]=p2x;result[3]=bottomLeftBy;return false}else if(p1yp2x){result[0]=topLeftAx;result[1]=p1y;result[2]=topRightBx;result[3]=p2y;return false}else if(p1xp2x){result[0]=bottomLeftAx;result[1]=bottomLeftAy;clipPointAFound=true}else{result[0]=topRightAx;result[1]=topLeftAy;clipPointAFound=true}}else if(slopeA===slopePrime){if(p1x>p2x){result[0]=topLeftAx;result[1]=topLeftAy;clipPointAFound=true}else{result[0]=bottomRightAx;result[1]=bottomLeftAy;clipPointAFound=true}}if(-slopeB===slopePrime){if(p2x>p1x){result[2]=bottomLeftBx;result[3]=bottomLeftBy;clipPointBFound=true}else{result[2]=topRightBx;result[3]=topLeftBy;clipPointBFound=true}}else if(slopeB===slopePrime){if(p2x>p1x){result[2]=topLeftBx;result[3]=topLeftBy;clipPointBFound=true}else{result[2]=bottomRightBx;result[3]=bottomLeftBy;clipPointBFound=true}}if(clipPointAFound&&clipPointBFound){return false}if(p1x>p2x){if(p1y>p2y){cardinalDirectionA=this.getCardinalDirection(slopeA,slopePrime,4);cardinalDirectionB=this.getCardinalDirection(slopeB,slopePrime,2)}else{cardinalDirectionA=this.getCardinalDirection(-slopeA,slopePrime,3);cardinalDirectionB=this.getCardinalDirection(-slopeB,slopePrime,1)}}else{if(p1y>p2y){cardinalDirectionA=this.getCardinalDirection(-slopeA,slopePrime,1);cardinalDirectionB=this.getCardinalDirection(-slopeB,slopePrime,3)}else{cardinalDirectionA=this.getCardinalDirection(slopeA,slopePrime,2);cardinalDirectionB=this.getCardinalDirection(slopeB,slopePrime,4)}}if(!clipPointAFound){switch(cardinalDirectionA){case 1:tempPointAy=topLeftAy;tempPointAx=p1x+-halfHeightA/slopePrime;result[0]=tempPointAx;result[1]=tempPointAy;break;case 2:tempPointAx=bottomRightAx;tempPointAy=p1y+halfWidthA*slopePrime;result[0]=tempPointAx;result[1]=tempPointAy;break;case 3:tempPointAy=bottomLeftAy;tempPointAx=p1x+halfHeightA/slopePrime;result[0]=tempPointAx;result[1]=tempPointAy;break;case 4:tempPointAx=bottomLeftAx;tempPointAy=p1y+-halfWidthA*slopePrime;result[0]=tempPointAx;result[1]=tempPointAy;break}}if(!clipPointBFound){switch(cardinalDirectionB){case 1:tempPointBy=topLeftBy;tempPointBx=p2x+-halfHeightB/slopePrime;result[2]=tempPointBx;result[3]=tempPointBy;break;case 2:tempPointBx=bottomRightBx;tempPointBy=p2y+halfWidthB*slopePrime;result[2]=tempPointBx;result[3]=tempPointBy;break;case 3:tempPointBy=bottomLeftBy;tempPointBx=p2x+halfHeightB/slopePrime;result[2]=tempPointBx;result[3]=tempPointBy;break;case 4:tempPointBx=bottomLeftBx;tempPointBy=p2y+-halfWidthB*slopePrime;result[2]=tempPointBx;result[3]=tempPointBy;break}}}return false};IGeometry.getCardinalDirection=function(slope,slopePrime,line){if(slope>slopePrime){return line}else{return 1+line%4}};IGeometry.getIntersection=function(s1,s2,f1,f2){if(f2==null){return this.getIntersection2(s1,s2,f1)}var x1=s1.x;var y1=s1.y;var x2=s2.x;var y2=s2.y;var x3=f1.x;var y3=f1.y;var x4=f2.x;var y4=f2.y;var x=void 0,y=void 0;var a1=void 0,a2=void 0,b1=void 0,b2=void 0,c1=void 0,c2=void 0;var denom=void 0;a1=y2-y1;b1=x1-x2;c1=x2*y1-x1*y2;a2=y4-y3;b2=x3-x4;c2=x4*y3-x3*y4;denom=a1*b2-a2*b1;if(denom===0){return null}x=(b1*c2-b2*c1)/denom;y=(a2*c1-a1*c2)/denom;return new Point(x,y)};IGeometry.angleOfVector=function(Cx,Cy,Nx,Ny){var C_angle=void 0;if(Cx!==Nx){C_angle=Math.atan((Ny-Cy)/(Nx-Cx));if(Nx=0){var t1=(-b+Math.sqrt(b*b-4*a*c))/(2*a);var t2=(-b-Math.sqrt(b*b-4*a*c))/(2*a);var intersections=null;if(t1>=0&&t1<=1){return[t1]}if(t2>=0&&t2<=1){return[t2]}return intersections}else return null};IGeometry.HALF_PI=.5*Math.PI;IGeometry.ONE_AND_HALF_PI=1.5*Math.PI;IGeometry.TWO_PI=2*Math.PI;IGeometry.THREE_PI=3*Math.PI;module.exports=IGeometry},function(module,exports,__webpack_require__){"use strict";function IMath(){}IMath.sign=function(value){if(value>0){return 1}else if(value<0){return-1}else{return 0}};IMath.floor=function(value){return value<0?Math.ceil(value):Math.floor(value)};IMath.ceil=function(value){return value<0?Math.floor(value):Math.ceil(value)};module.exports=IMath},function(module,exports,__webpack_require__){"use strict";function Integer(){}Integer.MAX_VALUE=2147483647;Integer.MIN_VALUE=-2147483648;module.exports=Integer},function(module,exports,__webpack_require__){"use strict";var _createClass=function(){function defineProperties(target,props){for(var i=0;i0&&isForest){toBeVisited.push(unProcessedNodes[0]);while(toBeVisited.length>0&&isForest){var currentNode=toBeVisited[0];toBeVisited.splice(0,1);visited.add(currentNode);var neighborEdges=currentNode.getEdges();for(var i=0;i-1){unProcessedNodes.splice(index,1)}}visited=new Set;parents=new Map}}return flatForest};Layout.prototype.createDummyNodesForBendpoints=function(edge){var dummyNodes=[];var prev=edge.source;var graph=this.graphManager.calcLowestCommonAncestor(edge.source,edge.target);for(var i=0;i0){var path=this.edgeToDummyNodes.get(lEdge);for(var i=0;i=0){list.splice(index,1)}var neighbours=node.getNeighborsList();neighbours.forEach(function(neighbour){if(removedNodes.indexOf(neighbour)<0){var otherDegree=remainingDegrees.get(neighbour);var newDegree=otherDegree-1;if(newDegree==1){tempList.push(neighbour)}remainingDegrees.set(neighbour,newDegree)}})}removedNodes=removedNodes.concat(tempList);if(list.length==1||list.length==2){foundCenter=true;centerNode=list[0]}}return centerNode};Layout.prototype.setGraphManager=function(gm){this.graphManager=gm};module.exports=Layout},function(module,exports,__webpack_require__){"use strict";function RandomSeed(){}RandomSeed.seed=1;RandomSeed.x=0;RandomSeed.nextDouble=function(){RandomSeed.x=Math.sin(RandomSeed.seed++)*1e4;return RandomSeed.x-Math.floor(RandomSeed.x)};module.exports=RandomSeed},function(module,exports,__webpack_require__){"use strict";var PointD=__webpack_require__(5);function Transform(x,y){this.lworldOrgX=0;this.lworldOrgY=0;this.ldeviceOrgX=0;this.ldeviceOrgY=0;this.lworldExtX=1;this.lworldExtY=1;this.ldeviceExtX=1;this.ldeviceExtY=1}Transform.prototype.getWorldOrgX=function(){return this.lworldOrgX};Transform.prototype.setWorldOrgX=function(wox){this.lworldOrgX=wox};Transform.prototype.getWorldOrgY=function(){return this.lworldOrgY};Transform.prototype.setWorldOrgY=function(woy){this.lworldOrgY=woy};Transform.prototype.getWorldExtX=function(){return this.lworldExtX};Transform.prototype.setWorldExtX=function(wex){this.lworldExtX=wex};Transform.prototype.getWorldExtY=function(){return this.lworldExtY};Transform.prototype.setWorldExtY=function(wey){this.lworldExtY=wey};Transform.prototype.getDeviceOrgX=function(){return this.ldeviceOrgX};Transform.prototype.setDeviceOrgX=function(dox){this.ldeviceOrgX=dox};Transform.prototype.getDeviceOrgY=function(){return this.ldeviceOrgY};Transform.prototype.setDeviceOrgY=function(doy){this.ldeviceOrgY=doy};Transform.prototype.getDeviceExtX=function(){return this.ldeviceExtX};Transform.prototype.setDeviceExtX=function(dex){this.ldeviceExtX=dex};Transform.prototype.getDeviceExtY=function(){return this.ldeviceExtY};Transform.prototype.setDeviceExtY=function(dey){this.ldeviceExtY=dey};Transform.prototype.transformX=function(x){var xDevice=0;var worldExtX=this.lworldExtX;if(worldExtX!=0){xDevice=this.ldeviceOrgX+(x-this.lworldOrgX)*this.ldeviceExtX/worldExtX}return xDevice};Transform.prototype.transformY=function(y){var yDevice=0;var worldExtY=this.lworldExtY;if(worldExtY!=0){yDevice=this.ldeviceOrgY+(y-this.lworldOrgY)*this.ldeviceExtY/worldExtY}return yDevice};Transform.prototype.inverseTransformX=function(x){var xWorld=0;var deviceExtX=this.ldeviceExtX;if(deviceExtX!=0){xWorld=this.lworldOrgX+(x-this.ldeviceOrgX)*this.lworldExtX/deviceExtX}return xWorld};Transform.prototype.inverseTransformY=function(y){var yWorld=0;var deviceExtY=this.ldeviceExtY;if(deviceExtY!=0){yWorld=this.lworldOrgY+(y-this.ldeviceOrgY)*this.lworldExtY/deviceExtY}return yWorld};Transform.prototype.inverseTransformPoint=function(inPoint){var outPoint=new PointD(this.inverseTransformX(inPoint.x),this.inverseTransformY(inPoint.y));return outPoint};module.exports=Transform},function(module,exports,__webpack_require__){"use strict";function _toConsumableArray(arr){if(Array.isArray(arr)){for(var i=0,arr2=Array(arr.length);iFDLayoutConstants.ADAPTATION_LOWER_NODE_LIMIT){this.coolingFactor=Math.max(this.coolingFactor*FDLayoutConstants.COOLING_ADAPTATION_FACTOR,this.coolingFactor-(s-FDLayoutConstants.ADAPTATION_LOWER_NODE_LIMIT)/(FDLayoutConstants.ADAPTATION_UPPER_NODE_LIMIT-FDLayoutConstants.ADAPTATION_LOWER_NODE_LIMIT)*this.coolingFactor*(1-FDLayoutConstants.COOLING_ADAPTATION_FACTOR))}this.maxNodeDisplacement=FDLayoutConstants.MAX_NODE_DISPLACEMENT_INCREMENTAL}else{if(s>FDLayoutConstants.ADAPTATION_LOWER_NODE_LIMIT){this.coolingFactor=Math.max(FDLayoutConstants.COOLING_ADAPTATION_FACTOR,1-(s-FDLayoutConstants.ADAPTATION_LOWER_NODE_LIMIT)/(FDLayoutConstants.ADAPTATION_UPPER_NODE_LIMIT-FDLayoutConstants.ADAPTATION_LOWER_NODE_LIMIT)*(1-FDLayoutConstants.COOLING_ADAPTATION_FACTOR))}else{this.coolingFactor=1}this.initialCoolingFactor=this.coolingFactor;this.maxNodeDisplacement=FDLayoutConstants.MAX_NODE_DISPLACEMENT}this.maxIterations=Math.max(this.getAllNodes().length*5,this.maxIterations);this.displacementThresholdPerNode=3*FDLayoutConstants.DEFAULT_EDGE_LENGTH/100;this.totalDisplacementThreshold=this.displacementThresholdPerNode*this.getAllNodes().length;this.repulsionRange=this.calcRepulsionRange()};FDLayout.prototype.calcSpringForces=function(){var lEdges=this.getAllEdges();var edge;for(var i=0;i0&&arguments[0]!==undefined?arguments[0]:true;var forceToNodeSurroundingUpdate=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;var i,j;var nodeA,nodeB;var lNodes=this.getAllNodes();var processedNodeSet;if(this.useFRGridVariant){if(this.totalIterations%FDLayoutConstants.GRID_CALCULATION_CHECK_PERIOD==1&&gridUpdateAllowed){this.updateGrid()}processedNodeSet=new Set;for(i=0;iestimatedSize||absDistanceY>estimatedSize){node.gravitationForceX=-this.gravityConstant*distanceX;node.gravitationForceY=-this.gravityConstant*distanceY}}else{estimatedSize=ownerGraph.getEstimatedSize()*this.compoundGravityRangeFactor;if(absDistanceX>estimatedSize||absDistanceY>estimatedSize){node.gravitationForceX=-this.gravityConstant*distanceX*this.compoundGravityConstant;node.gravitationForceY=-this.gravityConstant*distanceY*this.compoundGravityConstant}}};FDLayout.prototype.isConverged=function(){var converged;var oscilating=false;if(this.totalIterations>this.maxIterations/3){oscilating=Math.abs(this.totalDisplacement-this.oldTotalDisplacement)<2}converged=this.totalDisplacement=grid.length||j>=grid[0].length)){for(var k=0;ka}}]);return Quicksort}();module.exports=Quicksort},function(module,exports,__webpack_require__){"use strict";function SVD(){}SVD.svd=function(A){this.U=null;this.V=null;this.s=null;this.m=0;this.n=0;this.m=A.length;this.n=A[0].length;var nu=Math.min(this.m,this.n);this.s=function(s){var a=[];while(s-- >0){a.push(0)}return a}(Math.min(this.m+1,this.n));this.U=function(dims){var allocate=function allocate(dims){if(dims.length==0){return 0}else{var array=[];for(var i=0;i0){a.push(0)}return a}(this.n);var work=function(s){var a=[];while(s-- >0){a.push(0)}return a}(this.m);var wantu=true;var wantv=true;var nct=Math.min(this.m-1,this.n);var nrt=Math.max(0,Math.min(this.n-2,this.m));for(var k=0;k=0;_k--){if(this.s[_k]!==0){for(var _j4=_k+1;_j4=0;_k2--){if(function(lhs,rhs){return lhs&&rhs}(_k20){var _k3=void 0;var kase=void 0;for(_k3=p-2;_k3>=-1;_k3--){if(_k3===-1){break}if(Math.abs(e[_k3])<=tiny+eps*(Math.abs(this.s[_k3])+Math.abs(this.s[_k3+1]))){e[_k3]=0;break}}if(_k3===p-2){kase=4}else{var ks=void 0;for(ks=p-1;ks>=_k3;ks--){if(ks===_k3){break}var _t4=(ks!==p?Math.abs(e[ks]):0)+(ks!==_k3+1?Math.abs(e[ks-1]):0);if(Math.abs(this.s[ks])<=tiny+eps*_t4){this.s[ks]=0;break}}if(ks===_k3){kase=3}else if(ks===p-1){kase=1}else{kase=2;_k3=ks}}_k3++;switch(kase){case 1:{var f=e[p-2];e[p-2]=0;for(var _j6=p-2;_j6>=_k3;_j6--){var _t5=SVD.hypot(this.s[_j6],f);var cs=this.s[_j6]/_t5;var sn=f/_t5;this.s[_j6]=_t5;if(_j6!==_k3){f=-sn*e[_j6-1];e[_j6-1]=cs*e[_j6-1]}if(wantv){for(var _i20=0;_i20=this.s[_k3+1]){break}var _t8=this.s[_k3];this.s[_k3]=this.s[_k3+1];this.s[_k3+1]=_t8;if(wantv&&_k3Math.abs(b)){r=b/a;r=Math.abs(a)*Math.sqrt(1+r*r)}else if(b!=0){r=a/b;r=Math.abs(b)*Math.sqrt(1+r*r)}else{r=0}return r};module.exports=SVD},function(module,exports,__webpack_require__){"use strict";var _createClass=function(){function defineProperties(target,props){for(var i=0;i2&&arguments[2]!==undefined?arguments[2]:1;var mismatch_penalty=arguments.length>3&&arguments[3]!==undefined?arguments[3]:-1;var gap_penalty=arguments.length>4&&arguments[4]!==undefined?arguments[4]:-1;_classCallCheck(this,NeedlemanWunsch);this.sequence1=sequence1;this.sequence2=sequence2;this.match_score=match_score;this.mismatch_penalty=mismatch_penalty;this.gap_penalty=gap_penalty;this.iMax=sequence1.length+1;this.jMax=sequence2.length+1;this.grid=new Array(this.iMax);for(var i=0;i=0;i--){var l=this.listeners[i];if(l.event===event&&l.callback===callback){this.listeners.splice(i,1)}}};p.emit=function(event,data){for(var i=0;i - - - + + +