@dagrejs/dagre 1.1.2 → 1.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dagre.js +4 -4
- package/dist/dagre.min.js +2 -2
- package/lib/layout.js +3 -3
- package/lib/version.js +1 -1
- package/package.json +1 -1
package/dist/dagre.js
CHANGED
|
@@ -456,12 +456,12 @@ function layout(g, opts) {
|
|
|
456
456
|
time("layout", () => {
|
|
457
457
|
let layoutGraph =
|
|
458
458
|
time(" buildLayoutGraph", () => buildLayoutGraph(g));
|
|
459
|
-
time(" runLayout", () => runLayout(layoutGraph, time));
|
|
459
|
+
time(" runLayout", () => runLayout(layoutGraph, time, opts));
|
|
460
460
|
time(" updateInputGraph", () => updateInputGraph(g, layoutGraph));
|
|
461
461
|
});
|
|
462
462
|
}
|
|
463
463
|
|
|
464
|
-
function runLayout(g, time) {
|
|
464
|
+
function runLayout(g, time, opts) {
|
|
465
465
|
time(" makeSpaceForEdgeLabels", () => makeSpaceForEdgeLabels(g));
|
|
466
466
|
time(" removeSelfEdges", () => removeSelfEdges(g));
|
|
467
467
|
time(" acyclic", () => acyclic.run(g));
|
|
@@ -476,7 +476,7 @@ function runLayout(g, time) {
|
|
|
476
476
|
time(" normalize.run", () => normalize.run(g));
|
|
477
477
|
time(" parentDummyChains", () => parentDummyChains(g));
|
|
478
478
|
time(" addBorderSegments", () => addBorderSegments(g));
|
|
479
|
-
time(" order", () => order(g));
|
|
479
|
+
time(" order", () => order(g, opts));
|
|
480
480
|
time(" insertSelfEdges", () => insertSelfEdges(g));
|
|
481
481
|
time(" adjustCoordinateSystem", () => coordinateSystem.adjust(g));
|
|
482
482
|
time(" position", () => position(g));
|
|
@@ -2959,7 +2959,7 @@ function zipObject(props, values) {
|
|
|
2959
2959
|
}
|
|
2960
2960
|
|
|
2961
2961
|
},{"@dagrejs/graphlib":29}],28:[function(require,module,exports){
|
|
2962
|
-
module.exports = "1.1.
|
|
2962
|
+
module.exports = "1.1.3";
|
|
2963
2963
|
|
|
2964
2964
|
},{}],29:[function(require,module,exports){
|
|
2965
2965
|
/**
|
package/dist/dagre.min.js
CHANGED
|
@@ -38,7 +38,7 @@ class List{constructor(){let sentinel={};sentinel._next=sentinel._prev=sentinel;
|
|
|
38
38
|
return results.flatMap(e=>g.outEdges(e.v,e.w))}function doGreedyFAS(g,buckets,zeroIdx){let results=[];let sources=buckets[buckets.length-1];let sinks=buckets[0];let entry;while(g.nodeCount()){while(entry=sinks.dequeue()){removeNode(g,buckets,zeroIdx,entry)}while(entry=sources.dequeue()){removeNode(g,buckets,zeroIdx,entry)}if(g.nodeCount()){for(let i=buckets.length-2;i>0;--i){entry=buckets[i].dequeue();if(entry){results=results.concat(removeNode(g,buckets,zeroIdx,entry,true));break}}}}return results}function removeNode(g,buckets,zeroIdx,entry,collectPredecessors){let results=collectPredecessors?[]:undefined;g.inEdges(entry.v).forEach(edge=>{let weight=g.edge(edge);let uEntry=g.node(edge.v);if(collectPredecessors){results.push({v:edge.v,w:edge.w})}uEntry.out-=weight;assignBucket(buckets,zeroIdx,uEntry)});g.outEdges(entry.v).forEach(edge=>{let weight=g.edge(edge);let w=edge.w;let wEntry=g.node(w);wEntry["in"]-=weight;assignBucket(buckets,zeroIdx,wEntry)});g.removeNode(entry.v);return results}function buildState(g,weightFn){let fasGraph=new Graph;let maxIn=0;let maxOut=0;g.nodes().forEach(v=>{fasGraph.setNode(v,{v:v,in:0,out:0})});
|
|
39
39
|
// Aggregate weights on nodes, but also sum the weights across multi-edges
|
|
40
40
|
// into a single edge for the fasGraph.
|
|
41
|
-
g.edges().forEach(e=>{let prevWeight=fasGraph.edge(e.v,e.w)||0;let weight=weightFn(e);let edgeWeight=prevWeight+weight;fasGraph.setEdge(e.v,e.w,edgeWeight);maxOut=Math.max(maxOut,fasGraph.node(e.v).out+=weight);maxIn=Math.max(maxIn,fasGraph.node(e.w)["in"]+=weight)});let buckets=range(maxOut+maxIn+3).map(()=>new List);let zeroIdx=maxIn+1;fasGraph.nodes().forEach(v=>{assignBucket(buckets,zeroIdx,fasGraph.node(v))});return{graph:fasGraph,buckets:buckets,zeroIdx:zeroIdx}}function assignBucket(buckets,zeroIdx,entry){if(!entry.out){buckets[0].enqueue(entry)}else if(!entry["in"]){buckets[buckets.length-1].enqueue(entry)}else{buckets[entry.out-entry["in"]+zeroIdx].enqueue(entry)}}function range(limit){const range=[];for(let i=0;i<limit;i++){range.push(i)}return range}},{"./data/list":5,"@dagrejs/graphlib":29}],8:[function(require,module,exports){"use strict";let acyclic=require("./acyclic");let normalize=require("./normalize");let rank=require("./rank");let normalizeRanks=require("./util").normalizeRanks;let parentDummyChains=require("./parent-dummy-chains");let removeEmptyRanks=require("./util").removeEmptyRanks;let nestingGraph=require("./nesting-graph");let addBorderSegments=require("./add-border-segments");let coordinateSystem=require("./coordinate-system");let order=require("./order");let position=require("./position");let util=require("./util");let Graph=require("@dagrejs/graphlib").Graph;module.exports=layout;function layout(g,opts){let time=opts&&opts.debugTiming?util.time:util.notime;time("layout",()=>{let layoutGraph=time(" buildLayoutGraph",()=>buildLayoutGraph(g));time(" runLayout",()=>runLayout(layoutGraph,time));time(" updateInputGraph",()=>updateInputGraph(g,layoutGraph))})}function runLayout(g,time){time(" makeSpaceForEdgeLabels",()=>makeSpaceForEdgeLabels(g));time(" removeSelfEdges",()=>removeSelfEdges(g));time(" acyclic",()=>acyclic.run(g));time(" nestingGraph.run",()=>nestingGraph.run(g));time(" rank",()=>rank(util.asNonCompoundGraph(g)));time(" injectEdgeLabelProxies",()=>injectEdgeLabelProxies(g));time(" removeEmptyRanks",()=>removeEmptyRanks(g));time(" nestingGraph.cleanup",()=>nestingGraph.cleanup(g));time(" normalizeRanks",()=>normalizeRanks(g));time(" assignRankMinMax",()=>assignRankMinMax(g));time(" removeEdgeLabelProxies",()=>removeEdgeLabelProxies(g));time(" normalize.run",()=>normalize.run(g));time(" parentDummyChains",()=>parentDummyChains(g));time(" addBorderSegments",()=>addBorderSegments(g));time(" order",()=>order(g));time(" insertSelfEdges",()=>insertSelfEdges(g));time(" adjustCoordinateSystem",()=>coordinateSystem.adjust(g));time(" position",()=>position(g));time(" positionSelfEdges",()=>positionSelfEdges(g));time(" removeBorderNodes",()=>removeBorderNodes(g));time(" normalize.undo",()=>normalize.undo(g));time(" fixupEdgeLabelCoords",()=>fixupEdgeLabelCoords(g));time(" undoCoordinateSystem",()=>coordinateSystem.undo(g));time(" translateGraph",()=>translateGraph(g));time(" assignNodeIntersects",()=>assignNodeIntersects(g));time(" reversePoints",()=>reversePointsForReversedEdges(g));time(" acyclic.undo",()=>acyclic.undo(g))}
|
|
41
|
+
g.edges().forEach(e=>{let prevWeight=fasGraph.edge(e.v,e.w)||0;let weight=weightFn(e);let edgeWeight=prevWeight+weight;fasGraph.setEdge(e.v,e.w,edgeWeight);maxOut=Math.max(maxOut,fasGraph.node(e.v).out+=weight);maxIn=Math.max(maxIn,fasGraph.node(e.w)["in"]+=weight)});let buckets=range(maxOut+maxIn+3).map(()=>new List);let zeroIdx=maxIn+1;fasGraph.nodes().forEach(v=>{assignBucket(buckets,zeroIdx,fasGraph.node(v))});return{graph:fasGraph,buckets:buckets,zeroIdx:zeroIdx}}function assignBucket(buckets,zeroIdx,entry){if(!entry.out){buckets[0].enqueue(entry)}else if(!entry["in"]){buckets[buckets.length-1].enqueue(entry)}else{buckets[entry.out-entry["in"]+zeroIdx].enqueue(entry)}}function range(limit){const range=[];for(let i=0;i<limit;i++){range.push(i)}return range}},{"./data/list":5,"@dagrejs/graphlib":29}],8:[function(require,module,exports){"use strict";let acyclic=require("./acyclic");let normalize=require("./normalize");let rank=require("./rank");let normalizeRanks=require("./util").normalizeRanks;let parentDummyChains=require("./parent-dummy-chains");let removeEmptyRanks=require("./util").removeEmptyRanks;let nestingGraph=require("./nesting-graph");let addBorderSegments=require("./add-border-segments");let coordinateSystem=require("./coordinate-system");let order=require("./order");let position=require("./position");let util=require("./util");let Graph=require("@dagrejs/graphlib").Graph;module.exports=layout;function layout(g,opts){let time=opts&&opts.debugTiming?util.time:util.notime;time("layout",()=>{let layoutGraph=time(" buildLayoutGraph",()=>buildLayoutGraph(g));time(" runLayout",()=>runLayout(layoutGraph,time,opts));time(" updateInputGraph",()=>updateInputGraph(g,layoutGraph))})}function runLayout(g,time,opts){time(" makeSpaceForEdgeLabels",()=>makeSpaceForEdgeLabels(g));time(" removeSelfEdges",()=>removeSelfEdges(g));time(" acyclic",()=>acyclic.run(g));time(" nestingGraph.run",()=>nestingGraph.run(g));time(" rank",()=>rank(util.asNonCompoundGraph(g)));time(" injectEdgeLabelProxies",()=>injectEdgeLabelProxies(g));time(" removeEmptyRanks",()=>removeEmptyRanks(g));time(" nestingGraph.cleanup",()=>nestingGraph.cleanup(g));time(" normalizeRanks",()=>normalizeRanks(g));time(" assignRankMinMax",()=>assignRankMinMax(g));time(" removeEdgeLabelProxies",()=>removeEdgeLabelProxies(g));time(" normalize.run",()=>normalize.run(g));time(" parentDummyChains",()=>parentDummyChains(g));time(" addBorderSegments",()=>addBorderSegments(g));time(" order",()=>order(g,opts));time(" insertSelfEdges",()=>insertSelfEdges(g));time(" adjustCoordinateSystem",()=>coordinateSystem.adjust(g));time(" position",()=>position(g));time(" positionSelfEdges",()=>positionSelfEdges(g));time(" removeBorderNodes",()=>removeBorderNodes(g));time(" normalize.undo",()=>normalize.undo(g));time(" fixupEdgeLabelCoords",()=>fixupEdgeLabelCoords(g));time(" undoCoordinateSystem",()=>coordinateSystem.undo(g));time(" translateGraph",()=>translateGraph(g));time(" assignNodeIntersects",()=>assignNodeIntersects(g));time(" reversePoints",()=>reversePointsForReversedEdges(g));time(" acyclic.undo",()=>acyclic.undo(g))}
|
|
42
42
|
/*
|
|
43
43
|
* Copies final layout information from the layout graph back to the input
|
|
44
44
|
* graph. This process only copies whitelisted attributes from the layout graph
|
|
@@ -495,7 +495,7 @@ let offset=Math.min(...g.nodes().map(v=>g.node(v).rank));let layers=[];g.nodes()
|
|
|
495
495
|
/*
|
|
496
496
|
* Returns a new function that wraps `fn` with a timer. The wrapper logs the
|
|
497
497
|
* time it takes to execute the function.
|
|
498
|
-
*/function time(name,fn){let start=Date.now();try{return fn()}finally{console.log(name+" time: "+(Date.now()-start)+"ms")}}function notime(name,fn){return fn()}let idCounter=0;function uniqueId(prefix){var id=++idCounter;return toString(prefix)+id}function range(start,limit,step=1){if(limit==null){limit=start;start=0}let endCon=i=>i<limit;if(step<0){endCon=i=>limit<i}const range=[];for(let i=start;endCon(i);i+=step){range.push(i)}return range}function pick(source,keys){const dest={};for(const key of keys){if(source[key]!==undefined){dest[key]=source[key]}}return dest}function mapValues(obj,funcOrProp){let func=funcOrProp;if(typeof funcOrProp==="string"){func=val=>val[funcOrProp]}return Object.entries(obj).reduce((acc,[k,v])=>{acc[k]=func(v,k);return acc},{})}function zipObject(props,values){return props.reduce((acc,key,i)=>{acc[key]=values[i];return acc},{})}},{"@dagrejs/graphlib":29}],28:[function(require,module,exports){module.exports="1.1.
|
|
498
|
+
*/function time(name,fn){let start=Date.now();try{return fn()}finally{console.log(name+" time: "+(Date.now()-start)+"ms")}}function notime(name,fn){return fn()}let idCounter=0;function uniqueId(prefix){var id=++idCounter;return toString(prefix)+id}function range(start,limit,step=1){if(limit==null){limit=start;start=0}let endCon=i=>i<limit;if(step<0){endCon=i=>limit<i}const range=[];for(let i=start;endCon(i);i+=step){range.push(i)}return range}function pick(source,keys){const dest={};for(const key of keys){if(source[key]!==undefined){dest[key]=source[key]}}return dest}function mapValues(obj,funcOrProp){let func=funcOrProp;if(typeof funcOrProp==="string"){func=val=>val[funcOrProp]}return Object.entries(obj).reduce((acc,[k,v])=>{acc[k]=func(v,k);return acc},{})}function zipObject(props,values){return props.reduce((acc,key,i)=>{acc[key]=values[i];return acc},{})}},{"@dagrejs/graphlib":29}],28:[function(require,module,exports){module.exports="1.1.3"},{}],29:[function(require,module,exports){
|
|
499
499
|
/**
|
|
500
500
|
* Copyright (c) 2014, Chris Pettitt
|
|
501
501
|
* All rights reserved.
|
package/lib/layout.js
CHANGED
|
@@ -21,12 +21,12 @@ function layout(g, opts) {
|
|
|
21
21
|
time("layout", () => {
|
|
22
22
|
let layoutGraph =
|
|
23
23
|
time(" buildLayoutGraph", () => buildLayoutGraph(g));
|
|
24
|
-
time(" runLayout", () => runLayout(layoutGraph, time));
|
|
24
|
+
time(" runLayout", () => runLayout(layoutGraph, time, opts));
|
|
25
25
|
time(" updateInputGraph", () => updateInputGraph(g, layoutGraph));
|
|
26
26
|
});
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
function runLayout(g, time) {
|
|
29
|
+
function runLayout(g, time, opts) {
|
|
30
30
|
time(" makeSpaceForEdgeLabels", () => makeSpaceForEdgeLabels(g));
|
|
31
31
|
time(" removeSelfEdges", () => removeSelfEdges(g));
|
|
32
32
|
time(" acyclic", () => acyclic.run(g));
|
|
@@ -41,7 +41,7 @@ function runLayout(g, time) {
|
|
|
41
41
|
time(" normalize.run", () => normalize.run(g));
|
|
42
42
|
time(" parentDummyChains", () => parentDummyChains(g));
|
|
43
43
|
time(" addBorderSegments", () => addBorderSegments(g));
|
|
44
|
-
time(" order", () => order(g));
|
|
44
|
+
time(" order", () => order(g, opts));
|
|
45
45
|
time(" insertSelfEdges", () => insertSelfEdges(g));
|
|
46
46
|
time(" adjustCoordinateSystem", () => coordinateSystem.adjust(g));
|
|
47
47
|
time(" position", () => position(g));
|
package/lib/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
module.exports = "1.1.
|
|
1
|
+
module.exports = "1.1.3";
|