Skip to content

Commit

Permalink
Prep v0.6.4 release
Browse files Browse the repository at this point in the history
  • Loading branch information
cpettitt committed Nov 2, 2014
1 parent ad2cf7a commit cf4d913
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 16 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "dagre",
"version": "0.6.3",
"version": "0.6.4",
"main": [
"dist/dagre.core.js",
"dist/dagre.core.min.js"
Expand Down
16 changes: 12 additions & 4 deletions dist/dagre.core.js
Original file line number Diff line number Diff line change
Expand Up @@ -1997,6 +1997,7 @@ function horizontalCompaction(g, layering, root, align, reverseSep) {
// We use local variables for these parameters instead of manipulating the
// graph because it becomes more verbose to access them in a chained manner.
var shift = {},
shiftNeighbor = {},
sink = {},
xs = {},
pred = {},
Expand All @@ -2013,7 +2014,7 @@ function horizontalCompaction(g, layering, root, align, reverseSep) {

_.each(g.nodes(), function(v) {
if (root[v] === v) {
placeBlock(g, layering, sepFn, root, align, shift, sink, pred, xs, v);
placeBlock(g, layering, sepFn, root, align, shift, shiftNeighbor, sink, pred, xs, v);
}
});

Expand All @@ -2024,14 +2025,20 @@ function horizontalCompaction(g, layering, root, align, reverseSep) {
// http://www.inf.uni-konstanz.de/~brandes/publications/ for details.
if (v === root[v] && shift[sink[root[v]]] < Number.POSITIVE_INFINITY) {
xs[v] += shift[sink[root[v]]];

// Cascade shifts as necessary
var w = shiftNeighbor[sink[root[v]]];
if (w && shift[w] !== Number.POSITIVE_INFINITY) {
xs[v] += shift[w];
}
}
});
});

return xs;
}

function placeBlock(g, layering, sepFn, root, align, shift, sink, pred, xs, v) {
function placeBlock(g, layering, sepFn, root, align, shift, shiftNeighbor, sink, pred, xs, v) {
if (_.has(xs, v)) return;
xs[v] = 0;

Expand All @@ -2040,14 +2047,15 @@ function placeBlock(g, layering, sepFn, root, align, shift, sink, pred, xs, v) {
do {
if (pred[w]) {
u = root[pred[w]];
placeBlock(g, layering, sepFn, root, align, shift, sink, pred, xs, u);
placeBlock(g, layering, sepFn, root, align, shift, shiftNeighbor, sink, pred, xs, u);
if (sink[v] === v) {
sink[v] = sink[u];
}

var delta = sepFn(g, w, pred[w]);
if (sink[v] !== sink[u]) {
shift[sink[u]] = Math.min(shift[sink[u]], xs[v] - xs[u] - delta);
shiftNeighbor[sink[u]] = sink[v];
} else {
xs[v] = Math.max(xs[v], xs[u] + delta);
}
Expand Down Expand Up @@ -2891,7 +2899,7 @@ function notime(name, fn) {
}

},{"./graphlib":7,"./lodash":10}],30:[function(require,module,exports){
module.exports = "0.6.3";
module.exports = "0.6.4";

},{}]},{},[1])(1)
});
2 changes: 1 addition & 1 deletion dist/dagre.core.min.js

Large diffs are not rendered by default.

16 changes: 12 additions & 4 deletions dist/dagre.js
Original file line number Diff line number Diff line change
Expand Up @@ -1997,6 +1997,7 @@ function horizontalCompaction(g, layering, root, align, reverseSep) {
// We use local variables for these parameters instead of manipulating the
// graph because it becomes more verbose to access them in a chained manner.
var shift = {},
shiftNeighbor = {},
sink = {},
xs = {},
pred = {},
Expand All @@ -2013,7 +2014,7 @@ function horizontalCompaction(g, layering, root, align, reverseSep) {

_.each(g.nodes(), function(v) {
if (root[v] === v) {
placeBlock(g, layering, sepFn, root, align, shift, sink, pred, xs, v);
placeBlock(g, layering, sepFn, root, align, shift, shiftNeighbor, sink, pred, xs, v);
}
});

Expand All @@ -2024,14 +2025,20 @@ function horizontalCompaction(g, layering, root, align, reverseSep) {
// http://www.inf.uni-konstanz.de/~brandes/publications/ for details.
if (v === root[v] && shift[sink[root[v]]] < Number.POSITIVE_INFINITY) {
xs[v] += shift[sink[root[v]]];

// Cascade shifts as necessary
var w = shiftNeighbor[sink[root[v]]];
if (w && shift[w] !== Number.POSITIVE_INFINITY) {
xs[v] += shift[w];
}
}
});
});

return xs;
}

function placeBlock(g, layering, sepFn, root, align, shift, sink, pred, xs, v) {
function placeBlock(g, layering, sepFn, root, align, shift, shiftNeighbor, sink, pred, xs, v) {
if (_.has(xs, v)) return;
xs[v] = 0;

Expand All @@ -2040,14 +2047,15 @@ function placeBlock(g, layering, sepFn, root, align, shift, sink, pred, xs, v) {
do {
if (pred[w]) {
u = root[pred[w]];
placeBlock(g, layering, sepFn, root, align, shift, sink, pred, xs, u);
placeBlock(g, layering, sepFn, root, align, shift, shiftNeighbor, sink, pred, xs, u);
if (sink[v] === v) {
sink[v] = sink[u];
}

var delta = sepFn(g, w, pred[w]);
if (sink[v] !== sink[u]) {
shift[sink[u]] = Math.min(shift[sink[u]], xs[v] - xs[u] - delta);
shiftNeighbor[sink[u]] = sink[v];
} else {
xs[v] = Math.max(xs[v], xs[u] + delta);
}
Expand Down Expand Up @@ -2891,7 +2899,7 @@ function notime(name, fn) {
}

},{"./graphlib":7,"./lodash":10}],30:[function(require,module,exports){
module.exports = "0.6.3";
module.exports = "0.6.4";

},{}],31:[function(require,module,exports){
/**
Expand Down
6 changes: 3 additions & 3 deletions dist/dagre.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion lib/version.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
module.exports = "0.6.4-pre";
module.exports = "0.6.4";
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "dagre",
"version": "0.6.4-pre",
"version": "0.6.4",
"description": "Graph layout for JavaScript",
"author": "Chris Pettitt <[email protected]>",
"main": "index.js",
Expand Down Expand Up @@ -36,4 +36,4 @@
"url": "https://github.com/cpettitt/dagre.git"
},
"license": "MIT"
}
}

0 comments on commit cf4d913

Please sign in to comment.