"use strict";Liferay.Loader.define("portal-workflow-kaleo-designer-web$dagre@0.8.2/lib/rank/feasible-tree",["module","exports","require","../lodash","../graphlib","./util"],(function(e,n,o){window;{var r=o("../lodash"),i=o("../graphlib").Graph,t=o("./util").slack;function tightTree(e,n){return r.forEach(e.nodes(),(function dfs(o){r.forEach(n.nodeEdges(o),(function(r){var i=r.v,d=o===i?r.w:i;e.hasNode(d)||t(n,r)||(e.setNode(d,{}),e.setEdge(o,d,{}),dfs(d))}))})),e.nodeCount()}function findMinSlackEdge(e,n){return r.minBy(n.edges(),(function(o){if(e.hasNode(o.v)!==e.hasNode(o.w))return t(n,o)}))}function shiftRanks(e,n,o){r.forEach(e.nodes(),(function(e){n.node(e).rank+=o}))}e.exports=function feasibleTree(e){var n,o,r=new i({directed:!1}),d=e.nodes()[0],a=e.nodeCount();for(r.setNode(d,{});tightTree(r,e)<a;)n=findMinSlackEdge(r,e),o=r.hasNode(n.v)?t(e,n):-t(e,n),shiftRanks(r,e,o);return r}}}));
//# sourceMappingURL=feasible-tree.js.map