Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

dagre

Package Overview
Dependencies
Maintainers
1
Versions
47
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dagre - npm Package Compare versions

Comparing version 0.7.4 to 0.8.1

10

bower.json
{
"name": "dagre",
"version": "0.7.4",
"version": "0.8.1",
"main": [
"dist/dagre.core.js",
"dist/dagre.core.min.js"
"dist/dagre.core.js"
],

@@ -13,2 +12,3 @@ "ignore": [

"Makefile",
"browser.js",
"dist/dagre.js",

@@ -24,5 +24,5 @@ "dist/dagre.min.js",

"dependencies": {
"graphlib": "^1.0.5",
"lodash": "^3.10.0"
"graphlib": "^2.1.5",
"lodash": "^4.11.1"
}
}

@@ -61,3 +61,3 @@ // Karma configuration

// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
browsers: ['Chrome', 'Firefox', 'PhantomJS', 'Safari'],
browsers: ['Chrome', 'Firefox', 'PhantomJS'],

@@ -64,0 +64,0 @@

@@ -18,3 +18,3 @@ // Karma configuration

files: [
'node_modules/lodash/index.js',
'node_modules/lodash/lodash.js',
'node_modules/graphlib/dist/graphlib.core.js',

@@ -64,3 +64,3 @@ 'build/dagre.core.js',

// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
browsers: ['Chrome', 'Firefox', 'PhantomJS', 'Safari'],
browsers: ['Chrome', 'Firefox', 'PhantomJS'],

@@ -67,0 +67,0 @@

@@ -15,3 +15,3 @@ "use strict";

: dfsFAS(g));
_.each(fas, function(e) {
_.forEach(fas, function(e) {
var label = g.edge(e);

@@ -42,3 +42,3 @@ g.removeEdge(e);

stack[v] = true;
_.each(g.outEdges(v), function(e) {
_.forEach(g.outEdges(v), function(e) {
if (_.has(stack, e.w)) {

@@ -53,3 +53,3 @@ fas.push(e);

_.each(g.nodes(), dfs);
_.forEach(g.nodes(), dfs);
return fas;

@@ -59,3 +59,3 @@ }

function undo(g) {
_.each(g.edges(), function(e) {
_.forEach(g.edges(), function(e) {
var label = g.edge(e);

@@ -62,0 +62,0 @@ if (label.reversed) {

@@ -11,3 +11,3 @@ var _ = require("./lodash"),

if (children.length) {
_.each(children, dfs);
_.forEach(children, dfs);
}

@@ -27,3 +27,3 @@

_.each(g.children(), dfs);
_.forEach(g.children(), dfs);
}

@@ -30,0 +30,0 @@

@@ -30,4 +30,4 @@ "use strict";

function swapWidthHeight(g) {
_.each(g.nodes(), function(v) { swapWidthHeightOne(g.node(v)); });
_.each(g.edges(), function(e) { swapWidthHeightOne(g.edge(e)); });
_.forEach(g.nodes(), function(v) { swapWidthHeightOne(g.node(v)); });
_.forEach(g.edges(), function(e) { swapWidthHeightOne(g.edge(e)); });
}

@@ -42,7 +42,7 @@

function reverseY(g) {
_.each(g.nodes(), function(v) { reverseYOne(g.node(v)); });
_.forEach(g.nodes(), function(v) { reverseYOne(g.node(v)); });
_.each(g.edges(), function(e) {
_.forEach(g.edges(), function(e) {
var edge = g.edge(e);
_.each(edge.points, reverseYOne);
_.forEach(edge.points, reverseYOne);
if (_.has(edge, "y")) {

@@ -59,7 +59,7 @@ reverseYOne(edge);

function swapXY(g) {
_.each(g.nodes(), function(v) { swapXYOne(g.node(v)); });
_.forEach(g.nodes(), function(v) { swapXYOne(g.node(v)); });
_.each(g.edges(), function(e) {
_.forEach(g.edges(), function(e) {
var edge = g.edge(e);
_.each(edge.points, swapXYOne);
_.forEach(edge.points, swapXYOne);
if (_.has(edge, "x")) {

@@ -66,0 +66,0 @@ swapXYOne(edge);

@@ -15,3 +15,3 @@ var _ = require("./lodash"),

_.each(g.nodes(), function(v) {
_.forEach(g.nodes(), function(v) {
h.setNode(v, { label: v });

@@ -21,7 +21,7 @@ h.setParent(v, "layer" + g.node(v).rank);

_.each(g.edges(), function(e) {
_.forEach(g.edges(), function(e) {
h.setEdge(e.v, e.w, {}, e.name);
});
_.each(layerMatrix, function(layer, i) {
_.forEach(layerMatrix, function(layer, i) {
var layerV = "layer" + i;

@@ -28,0 +28,0 @@ h.setNode(layerV, { rank: "same" });

@@ -55,3 +55,3 @@ var _ = require("./lodash"),

_.each(g.inEdges(entry.v), function(edge) {
_.forEach(g.inEdges(entry.v), function(edge) {
var weight = g.edge(edge),

@@ -68,3 +68,3 @@ uEntry = g.node(edge.v);

_.each(g.outEdges(entry.v), function(edge) {
_.forEach(g.outEdges(entry.v), function(edge) {
var weight = g.edge(edge),

@@ -87,3 +87,3 @@ w = edge.w,

_.each(g.nodes(), function(v) {
_.forEach(g.nodes(), function(v) {
fasGraph.setNode(v, { v: v, "in": 0, out: 0 });

@@ -94,3 +94,3 @@ });

// into a single edge for the fasGraph.
_.each(g.edges(), function(e) {
_.forEach(g.edges(), function(e) {
var prevWeight = fasGraph.edge(e.v, e.w) || 0,

@@ -107,3 +107,3 @@ weight = weightFn(e),

_.each(fasGraph.nodes(), function(v) {
_.forEach(fasGraph.nodes(), function(v) {
assignBucket(buckets, zeroIdx, fasGraph.node(v));

@@ -110,0 +110,0 @@ });

@@ -67,3 +67,3 @@ "use strict";

function updateInputGraph(inputGraph, layoutGraph) {
_.each(inputGraph.nodes(), function(v) {
_.forEach(inputGraph.nodes(), function(v) {
var inputLabel = inputGraph.node(v),

@@ -83,3 +83,3 @@ layoutLabel = layoutGraph.node(v);

_.each(inputGraph.edges(), function(e) {
_.forEach(inputGraph.edges(), function(e) {
var inputLabel = inputGraph.edge(e),

@@ -126,3 +126,3 @@ layoutLabel = layoutGraph.edge(e);

_.each(inputGraph.nodes(), function(v) {
_.forEach(inputGraph.nodes(), function(v) {
var node = canonicalize(inputGraph.node(v));

@@ -133,3 +133,3 @@ g.setNode(v, _.defaults(selectNumberAttrs(node, nodeNumAttrs), nodeDefaults));

_.each(inputGraph.edges(), function(e) {
_.forEach(inputGraph.edges(), function(e) {
var edge = canonicalize(inputGraph.edge(e));

@@ -156,3 +156,3 @@ g.setEdge(e, _.merge({},

graph.ranksep /= 2;
_.each(g.edges(), function(e) {
_.forEach(g.edges(), function(e) {
var edge = g.edge(e);

@@ -177,3 +177,3 @@ edge.minlen *= 2;

function injectEdgeLabelProxies(g) {
_.each(g.edges(), function(e) {
_.forEach(g.edges(), function(e) {
var edge = g.edge(e);

@@ -191,3 +191,3 @@ if (edge.width && edge.height) {

var maxRank = 0;
_.each(g.nodes(), function(v) {
_.forEach(g.nodes(), function(v) {
var node = g.node(v);

@@ -204,3 +204,3 @@ if (node.borderTop) {

function removeEdgeLabelProxies(g) {
_.each(g.nodes(), function(v) {
_.forEach(g.nodes(), function(v) {
var node = g.node(v);

@@ -234,4 +234,4 @@ if (node.dummy === "edge-proxy") {

_.each(g.nodes(), function(v) { getExtremes(g.node(v)); });
_.each(g.edges(), function(e) {
_.forEach(g.nodes(), function(v) { getExtremes(g.node(v)); });
_.forEach(g.edges(), function(e) {
var edge = g.edge(e);

@@ -246,3 +246,3 @@ if (_.has(edge, "x")) {

_.each(g.nodes(), function(v) {
_.forEach(g.nodes(), function(v) {
var node = g.node(v);

@@ -253,5 +253,5 @@ node.x -= minX;

_.each(g.edges(), function(e) {
_.forEach(g.edges(), function(e) {
var edge = g.edge(e);
_.each(edge.points, function(p) {
_.forEach(edge.points, function(p) {
p.x -= minX;

@@ -269,3 +269,3 @@ p.y -= minY;

function assignNodeIntersects(g) {
_.each(g.edges(), function(e) {
_.forEach(g.edges(), function(e) {
var edge = g.edge(e),

@@ -289,3 +289,3 @@ nodeV = g.node(e.v),

function fixupEdgeLabelCoords(g) {
_.each(g.edges(), function(e) {
_.forEach(g.edges(), function(e) {
var edge = g.edge(e);

@@ -305,3 +305,3 @@ if (_.has(edge, "x")) {

function reversePointsForReversedEdges(g) {
_.each(g.edges(), function(e) {
_.forEach(g.edges(), function(e) {
var edge = g.edge(e);

@@ -315,3 +315,3 @@ if (edge.reversed) {

function removeBorderNodes(g) {
_.each(g.nodes(), function(v) {
_.forEach(g.nodes(), function(v) {
if (g.children(v).length) {

@@ -331,3 +331,3 @@ var node = g.node(v),

_.each(g.nodes(), function(v) {
_.forEach(g.nodes(), function(v) {
if (g.node(v).dummy === "border") {

@@ -340,3 +340,3 @@ g.removeNode(v);

function removeSelfEdges(g) {
_.each(g.edges(), function(e) {
_.forEach(g.edges(), function(e) {
if (e.v === e.w) {

@@ -355,8 +355,8 @@ var node = g.node(e.v);

var layers = util.buildLayerMatrix(g);
_.each(layers, function(layer) {
_.forEach(layers, function(layer) {
var orderShift = 0;
_.each(layer, function(v, i) {
_.forEach(layer, function(v, i) {
var node = g.node(v);
node.order = i + orderShift;
_.each(node.selfEdges, function(selfEdge) {
_.forEach(node.selfEdges, function(selfEdge) {
util.addDummyNode(g, "selfedge", {

@@ -377,3 +377,3 @@ width: selfEdge.label.width,

function positionSelfEdges(g) {
_.each(g.nodes(), function(v) {
_.forEach(g.nodes(), function(v) {
var node = g.node(v);

@@ -393,3 +393,3 @@ if (node.dummy === "selfedge") {

{ x: x + 5 * dx / 6, y: y + dy },
{ x: x + 2 * dx / 3, y: y + dy },
{ x: x + 2 * dx / 3, y: y + dy }
];

@@ -408,3 +408,3 @@ node.label.x = node.x;

var newAttrs = {};
_.each(attrs, function(v, k) {
_.forEach(attrs, function(v, k) {
newAttrs[k.toLowerCase()] = v;

@@ -411,0 +411,0 @@ });

@@ -33,6 +33,6 @@ var _ = require("./lodash"),

function run(g) {
var root = util.addDummyNode(g, "root", {}, "_root"),
depths = treeDepths(g),
height = _.max(depths) - 1,
nodeSep = 2 * height + 1;
var root = util.addDummyNode(g, "root", {}, "_root");
var depths = treeDepths(g);
var height = _.max(_.values(depths)) - 1; // Note: depths is an Object not an array
var nodeSep = 2 * height + 1;

@@ -42,3 +42,3 @@ g.graph().nestingRoot = root;

// Multiply minlen by nodeSep to align nodes on non-border ranks.
_.each(g.edges(), function(e) { g.edge(e).minlen *= nodeSep; });
_.forEach(g.edges(), function(e) { g.edge(e).minlen *= nodeSep; });

@@ -49,3 +49,3 @@ // Calculate a weight that is sufficient to keep subgraphs vertically compact

// Create border nodes and link them up
_.each(g.children(), function(child) {
_.forEach(g.children(), function(child) {
dfs(g, root, nodeSep, weight, height, depths, child);

@@ -77,3 +77,3 @@ });

_.each(children, function(child) {
_.forEach(children, function(child) {
dfs(g, root, nodeSep, weight, height, depths, child);

@@ -110,3 +110,3 @@

if (children && children.length) {
_.each(children, function(child) {
_.forEach(children, function(child) {
dfs(child, depth + 1);

@@ -117,3 +117,3 @@ });

}
_.each(g.children(), function(v) { dfs(v, 1); });
_.forEach(g.children(), function(v) { dfs(v, 1); });
return depths;

@@ -132,3 +132,3 @@ }

delete graphLabel.nestingRoot;
_.each(g.edges(), function(e) {
_.forEach(g.edges(), function(e) {
var edge = g.edge(e);

@@ -135,0 +135,0 @@ if (edge.nestingEdge) {

@@ -29,3 +29,3 @@ "use strict";

g.graph().dummyChains = [];
_.each(g.edges(), function(edge) { normalizeEdge(g, edge); });
_.forEach(g.edges(), function(edge) { normalizeEdge(g, edge); });
}

@@ -72,3 +72,3 @@

function undo(g) {
_.each(g.graph().dummyChains, function(v) {
_.forEach(g.graph().dummyChains, function(v) {
var node = g.node(v),

@@ -75,0 +75,0 @@ origLabel = node.edgeLabel,

@@ -9,3 +9,3 @@ var _ = require("../lodash");

_.each(vs, function(v) {
_.forEach(vs, function(v) {
var child = g.parent(v),

@@ -12,0 +12,0 @@ parent,

@@ -41,3 +41,3 @@ var _ = require("../lodash"),

_.each(g.nodes(), function(v) {
_.forEach(g.nodes(), function(v) {
var node = g.node(v),

@@ -51,3 +51,3 @@ parent = g.parent(v);

// This assumes we have only short edges!
_.each(g[relationship](v), function(e) {
_.forEach(g[relationship](v), function(e) {
var u = e.v === v ? e.w : e.v,

@@ -54,0 +54,0 @@ edge = result.edge(u, v),

@@ -55,3 +55,3 @@ "use strict";

var cc = 0;
_.each(southEntries.forEach(function(entry) {
_.forEach(southEntries.forEach(function(entry) {
var index = entry.pos + firstIndex;

@@ -58,0 +58,0 @@ tree[index] += entry.weight;

@@ -63,6 +63,6 @@ "use strict";

var cg = new Graph();
_.each(layerGraphs, function(lg) {
_.forEach(layerGraphs, function(lg) {
var root = lg.graph().root;
var sorted = sortSubgraph(lg, root, cg, biasRight);
_.each(sorted.vs, function(v, i) {
_.forEach(sorted.vs, function(v, i) {
lg.node(v).order = i;

@@ -75,4 +75,4 @@ });

function assignOrder(g, layering) {
_.each(layering, function(layer) {
_.each(layer, function(v, i) {
_.forEach(layering, function(layer) {
_.forEach(layer, function(v, i) {
g.node(v).order = i;

@@ -79,0 +79,0 @@ });

@@ -31,9 +31,9 @@ "use strict";

layers[node.rank].push(v);
_.each(g.successors(v), dfs);
_.forEach(g.successors(v), dfs);
}
var orderedVs = _.sortBy(simpleNodes, function(v) { return g.node(v).rank; });
_.each(orderedVs, dfs);
_.forEach(orderedVs, dfs);
return layers;
}

@@ -34,3 +34,3 @@ "use strict";

var mappedEntries = {};
_.each(entries, function(entry, i) {
_.forEach(entries, function(entry, i) {
var tmp = mappedEntries[entry.v] = {

@@ -49,3 +49,3 @@ indegree: 0,

_.each(cg.edges(), function(e) {
_.forEach(cg.edges(), function(e) {
var entryV = mappedEntries[e.v],

@@ -94,4 +94,4 @@ entryW = mappedEntries[e.w];

entries.push(entry);
_.each(entry["in"].reverse(), handleIn(entry));
_.each(entry.out, handleOut(entry));
_.forEach(entry["in"].reverse(), handleIn(entry));
_.forEach(entry.out, handleOut(entry));
}

@@ -98,0 +98,0 @@

@@ -22,3 +22,3 @@ var _ = require("../lodash"),

var barycenters = barycenter(g, movable);
_.each(barycenters, function(entry) {
_.forEach(barycenters, function(entry) {
if (g.children(entry.v).length) {

@@ -57,3 +57,3 @@ var subgraphResult = sortSubgraph(g, entry.v, cg, biasRight);

function expandSubgraphs(entries, subgraphs) {
_.each(entries, function(entry) {
_.forEach(entries, function(entry) {
entry.vs = _.flatten(entry.vs.map(function(v) {

@@ -60,0 +60,0 @@ if (subgraphs[v]) {

@@ -21,3 +21,3 @@ var _ = require("../lodash"),

_.each(sortable, function (entry) {
_.forEach(sortable, function (entry) {
vsIndex += entry.vs.length;

@@ -24,0 +24,0 @@ vs.push(entry.vs);

@@ -8,3 +8,3 @@ var _ = require("./lodash");

_.each(g.graph().dummyChains, function(v) {
_.forEach(g.graph().dummyChains, function(v) {
var node = g.node(v),

@@ -81,8 +81,8 @@ edgeObj = node.edgeObj,

var low = lim;
_.each(g.children(v), dfs);
_.forEach(g.children(v), dfs);
result[v] = { low: low, lim: lim++ };
}
_.each(g.children(), dfs);
_.forEach(g.children(), dfs);
return result;
}

@@ -56,3 +56,3 @@ "use strict";

_.each(layer, function(v, i) {
_.forEach(layer, function(v, i) {
var w = findOtherInnerSegmentNode(g, v),

@@ -62,4 +62,4 @@ k1 = w ? g.node(w).order : prevLayerLength;

if (w || v === lastNode) {
_.each(layer.slice(scanPos, i +1), function(scanNode) {
_.each(g.predecessors(scanNode), function(u) {
_.forEach(layer.slice(scanPos, i +1), function(scanNode) {
_.forEach(g.predecessors(scanNode), function(u) {
var uLabel = g.node(u),

@@ -90,6 +90,6 @@ uPos = uLabel.order;

var v;
_.each(_.range(southPos, southEnd), function(i) {
_.forEach(_.range(southPos, southEnd), function(i) {
v = south[i];
if (g.node(v).dummy) {
_.each(g.predecessors(v), function(u) {
_.forEach(g.predecessors(v), function(u) {
var uNode = g.node(u);

@@ -111,3 +111,3 @@ if (uNode.dummy &&

_.each(south, function(v, southLookahead) {
_.forEach(south, function(v, southLookahead) {
if (g.node(v).dummy === "border") {

@@ -179,4 +179,4 @@ var predecessors = g.predecessors(v);

// generate different extreme alignments.
_.each(layering, function(layer) {
_.each(layer, function(v, order) {
_.forEach(layering, function(layer) {
_.forEach(layer, function(v, order) {
root[v] = v;

@@ -188,5 +188,5 @@ align[v] = v;

_.each(layering, function(layer) {
_.forEach(layering, function(layer) {
var prevIdx = -1;
_.each(layer, function(v) {
_.forEach(layer, function(v) {
var ws = neighborFn(v);

@@ -233,3 +233,3 @@ if (ws.length) {

}
_.each(blockG.nodes(), pass1);
_.forEach(blockG.nodes(), pass1);

@@ -250,6 +250,6 @@ var borderType = reverseSep ? "borderLeft" : "borderRight";

}
_.each(blockG.nodes(), pass2);
_.forEach(blockG.nodes(), pass2);
// Assign x coordinates to all nodes
_.each(align, function(v) {
_.forEach(align, function(v) {
xs[v] = xs[root[v]];

@@ -267,5 +267,5 @@ });

_.each(layering, function(layer) {
_.forEach(layering, function(layer) {
var u;
_.each(layer, function(v) {
_.forEach(layer, function(v) {
var vRoot = root[v];

@@ -289,5 +289,13 @@ blockGraph.setNode(vRoot);

function findSmallestWidthAlignment(g, xss) {
return _.min(xss, function(xs) {
var min = _.min(xs, function(x, v) { return x - width(g, v) / 2; }),
max = _.max(xs, function(x, v) { return x + width(g, v) / 2; });
return _.minBy(_.values(xss), function (xs) {
var max = Number.NEGATIVE_INFINITY;
var min = Number.POSITIVE_INFINITY;
_.forIn(xs, function (x, v) {
var halfWidth = width(g, v) / 2;
max = Math.max(x + halfWidth, max);
min = Math.min(x - halfWidth, min);
});
return max - min;

@@ -305,7 +313,8 @@ });

function alignCoordinates(xss, alignTo) {
var alignToMin = _.min(alignTo),
alignToMax = _.max(alignTo);
var alignToVals = _.values(alignTo),
alignToMin = _.min(alignToVals),
alignToMax = _.max(alignToVals);
_.each(["u", "d"], function(vert) {
_.each(["l", "r"], function(horiz) {
_.forEach(["u", "d"], function(vert) {
_.forEach(["l", "r"], function(horiz) {
var alignment = vert + horiz,

@@ -316,3 +325,4 @@ xs = xss[alignment],

delta = horiz === "l" ? alignToMin - _.min(xs) : alignToMax - _.max(xs);
var xsVals = _.values(xs);
delta = horiz === "l" ? alignToMin - _.min(xsVals) : alignToMax - _.max(xsVals);

@@ -331,3 +341,3 @@ if (delta) {

} else {
var xs = _.sortBy(_.pluck(xss, v));
var xs = _.sortBy(_.map(xss, v));
return (xs[1] + xs[2]) / 2;

@@ -345,5 +355,5 @@ }

adjustedLayering;
_.each(["u", "d"], function(vert) {
_.forEach(["u", "d"], function(vert) {
adjustedLayering = vert === "u" ? layering : _.values(layering).reverse();
_.each(["l", "r"], function(horiz) {
_.forEach(["l", "r"], function(horiz) {
if (horiz === "r") {

@@ -350,0 +360,0 @@ adjustedLayering = _.map(adjustedLayering, function(inner) {

@@ -13,3 +13,3 @@ "use strict";

positionY(g);
_.each(positionX(g), function(x, v) {
_.forEach(positionX(g), function(x, v) {
g.node(v).x = x;

@@ -23,5 +23,5 @@ });

prevY = 0;
_.each(layering, function(layer) {
_.forEach(layering, function(layer) {
var maxHeight = _.max(_.map(layer, function(v) { return g.node(v).height; }));
_.each(layer, function(v) {
_.forEach(layer, function(v) {
g.node(v).y = prevY + maxHeight / 2;

@@ -28,0 +28,0 @@ });

@@ -58,3 +58,3 @@ "use strict";

function dfs(v) {
_.each(g.nodeEdges(v), function(e) {
_.forEach(g.nodeEdges(v), function(e) {
var edgeV = e.v,

@@ -70,3 +70,3 @@ w = (v === edgeV) ? e.w : edgeV;

_.each(t.nodes(), dfs);
_.forEach(t.nodes(), dfs);
return t.nodeCount();

@@ -80,3 +80,3 @@ }

function findMinSlackEdge(t, g) {
return _.min(g.edges(), function(e) {
return _.minBy(g.edges(), function(e) {
if (t.hasNode(e.v) !== t.hasNode(e.w)) {

@@ -89,5 +89,5 @@ return slack(g, e);

function shiftRanks(t, g, delta) {
_.each(t.nodes(), function(v) {
_.forEach(t.nodes(), function(v) {
g.node(v).rank += delta;
});
}

@@ -74,3 +74,3 @@ "use strict";

vs = vs.slice(0, vs.length - 1);
_.each(vs, function(v) {
_.forEach(vs, function(v) {
assignCutValue(t, g, v);

@@ -107,3 +107,3 @@ });

_.each(g.nodeEdges(child), function(e) {
_.forEach(g.nodeEdges(child), function(e) {
var isOutEdge = e.v === child,

@@ -139,3 +139,3 @@ other = isOutEdge ? e.w : e.v;

visited[v] = true;
_.each(tree.neighbors(v), function(w) {
_.forEach(tree.neighbors(v), function(w) {
if (!_.has(visited, w)) {

@@ -193,3 +193,3 @@ nextLim = dfsAssignLowLim(tree, visited, nextLim, w, v);

return _.min(candidates, function(edge) { return slack(g, edge); });
return _.minBy(candidates, function(edge) { return slack(g, edge); });
}

@@ -211,3 +211,3 @@

vs = vs.slice(1);
_.each(vs, function(v) {
_.forEach(vs, function(v) {
var parent = t.node(v).parent,

@@ -214,0 +214,0 @@ edge = g.edge(v, parent),

@@ -41,7 +41,9 @@ "use strict";

var rank = _.min(_.map(g.outEdges(v), function(e) {
var rank = _.minBy(_.map(g.outEdges(v), function(e) {
return dfs(e.w) - g.edge(e).minlen;
}));
if (rank === Number.POSITIVE_INFINITY) {
if (rank === Number.POSITIVE_INFINITY || // return value of _.map([]) for Lodash 3
rank === undefined || // return value of _.map([]) for Lodash 4
rank === null) { // return value of _.map([null])
rank = 0;

@@ -53,3 +55,3 @@ }

_.each(g.sources(), dfs);
_.forEach(g.sources(), dfs);
}

@@ -56,0 +58,0 @@

@@ -43,4 +43,4 @@ "use strict";

var simplified = new Graph().setGraph(g.graph());
_.each(g.nodes(), function(v) { simplified.setNode(v, g.node(v)); });
_.each(g.edges(), function(e) {
_.forEach(g.nodes(), function(v) { simplified.setNode(v, g.node(v)); });
_.forEach(g.edges(), function(e) {
var simpleLabel = simplified.edge(e.v, e.w) || { weight: 0, minlen: 1 },

@@ -58,3 +58,3 @@ label = g.edge(e);

var simplified = new Graph({ multigraph: g.isMultigraph() }).setGraph(g.graph());
_.each(g.nodes(), function(v) {
_.forEach(g.nodes(), function(v) {
if (!g.children(v).length) {

@@ -64,3 +64,3 @@ simplified.setNode(v, g.node(v));

});
_.each(g.edges(), function(e) {
_.forEach(g.edges(), function(e) {
simplified.setEdge(e, g.edge(e));

@@ -74,3 +74,3 @@ });

var sucs = {};
_.each(g.outEdges(v), function(e) {
_.forEach(g.outEdges(v), function(e) {
sucs[e.w] = (sucs[e.w] || 0) + g.edge(e).weight;

@@ -86,3 +86,3 @@ });

var preds = {};
_.each(g.inEdges(v), function(e) {
_.forEach(g.inEdges(v), function(e) {
preds[e.v] = (preds[e.v] || 0) + g.edge(e).weight;

@@ -140,3 +140,3 @@ });

var layering = _.map(_.range(maxRank(g) + 1), function() { return []; });
_.each(g.nodes(), function(v) {
_.forEach(g.nodes(), function(v) {
var node = g.node(v),

@@ -156,4 +156,4 @@ rank = node.rank;

function normalizeRanks(g) {
var min = _.min(_.map(g.nodes(), function(v) { return g.node(v).rank; }));
_.each(g.nodes(), function(v) {
var min = _.minBy(_.map(g.nodes(), function(v) { return g.node(v).rank; }));
_.forEach(g.nodes(), function(v) {
var node = g.node(v);

@@ -168,6 +168,6 @@ if (_.has(node, "rank")) {

// Ranks may not start at 0, so we need to offset them
var offset = _.min(_.map(g.nodes(), function(v) { return g.node(v).rank; }));
var offset = _.minBy(_.map(g.nodes(), function(v) { return g.node(v).rank; }));
var layers = [];
_.each(g.nodes(), function(v) {
_.forEach(g.nodes(), function(v) {
var rank = g.node(v).rank - offset;

@@ -182,7 +182,7 @@ if (!layers[rank]) {

nodeRankFactor = g.graph().nodeRankFactor;
_.each(layers, function(vs, i) {
_.forEach(layers, function(vs, i) {
if (_.isUndefined(vs) && i % nodeRankFactor !== 0) {
--delta;
} else if (delta) {
_.each(vs, function(v) { g.node(v).rank += delta; });
_.forEach(vs, function(v) { g.node(v).rank += delta; });
}

@@ -220,3 +220,3 @@ });

var result = { lhs: [], rhs: [] };
_.each(collection, function(value) {
_.forEach(collection, function(value) {
if (fn(value)) {

@@ -223,0 +223,0 @@ result.lhs.push(value);

@@ -1,1 +0,1 @@

module.exports = "0.7.4";
module.exports = "0.8.1";
{
"name": "dagre",
"version": "0.7.4",
"version": "0.8.1",
"description": "Graph layout for JavaScript",
"author": "Chris Pettitt <cpettitt@gmail.com>",
"contributors": [
"Matthew Dahl (https://github.com/sandersky)"
],
"main": "index.js",

@@ -12,4 +15,4 @@ "keywords": [

"dependencies": {
"graphlib": "^1.0.5",
"lodash": "^3.10.0"
"graphlib": "^2.1.5",
"lodash": "^4.11.1"
},

@@ -24,10 +27,12 @@ "devDependencies": {

"jshint-stylish": "^1.0.0",
"karma": "^0.12.37",
"karma": "^0.13.22",
"karma-chrome-launcher": "^0.2.0",
"karma-firefox-launcher": "^0.1.6",
"karma-mocha": "^0.2.0",
"karma-phantomjs-launcher": "^0.2.0",
"karma-phantomjs-launcher": "^1.0.0",
"karma-requirejs": "^0.2.5",
"karma-safari-launcher": "^0.1.1",
"mocha": "^1.21.5",
"phantomjs": "^1.9.17",
"phantomjs-prebuilt": "^2.1.7",
"requirejs": "^2.1.22",
"semver": "^4.1.0",

@@ -39,5 +44,5 @@ "sprintf": "^0.1.4",

"type": "git",
"url": "https://github.com/cpettitt/dagre.git"
"url": "https://github.com/dagrejs/dagre.git"
},
"license": "MIT"
}
# dagre - Graph layout for JavaScript
[![Build Status](https://secure.travis-ci.org/cpettitt/dagre.png?branch=master)](http://travis-ci.org/cpettitt/dagre)
[![Build Status](https://secure.travis-ci.org/dagrejs/dagre.svg?branch=master)](http://travis-ci.org/dagrejs/dagre)

@@ -9,6 +9,4 @@ Dagre is a JavaScript library that makes it easy to lay out directed graphs on

For more details, including examples and configuration options, please see our
[wiki](https://github.com/cpettitt/dagre/wiki).
[wiki](https://github.com/dagrejs/dagre/wiki).
**This project is not being actively developed; however, pull requests are still being accepted.**
## License

@@ -15,0 +13,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc