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

libgraph

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

libgraph - npm Package Compare versions

Comparing version 1.2.1 to 1.2.2

Ospf/index.coffee.orig

2

generators/index.js

@@ -5,3 +5,3 @@ // Generated by CoffeeScript 1.10.0

ld = require("lodash");
ld = require("underscore");

@@ -8,0 +8,0 @@ exports.reverse = reverse = function(edges) {

// Generated by CoffeeScript 1.10.0
(function() {
var Graph, ld;
var Graph;
ld = require("lodash");
Graph = (function() {

@@ -8,0 +6,0 @@ function Graph(edges, vertices) {

@@ -5,3 +5,3 @@ // Generated by CoffeeScript 1.10.0

ld = require("lodash");
ld = require("underscore");

@@ -8,0 +8,0 @@ Graph = require("../Graph");

@@ -5,3 +5,3 @@ // Generated by CoffeeScript 1.10.0

ld = require("lodash");
ld = require("underscore");

@@ -8,0 +8,0 @@ Graph = require("../Graph");

@@ -5,3 +5,3 @@ // Generated by CoffeeScript 1.10.0

ld = require("lodash");
ld = require("underscore");

@@ -85,6 +85,7 @@ Graph = require("../Graph");

}).call(this);
this.unsatisfiedDemand_o = ld.transform(this.demand, function(res, val, key) {
return res[key] = ld.assign({}, val, {
this.unsatisfiedDemand_o = this.demand.reduce(function(res, val, key) {
res[key] = ld.assign({}, val, {
_id: key
});
return res;
}, {});

@@ -116,5 +117,5 @@ ref = this.topo;

MultiCommodityFlow.prototype.getNextStepCostGraph = function() {
return new Graph(ld.transform(this.flows, (function(_this) {
return new Graph(this.flows.reduce((function(_this) {
return function(res, val, i) {
var capacity, cost, dir, point, ref, results;
var capacity, cost, dir, point, ref;
point = nextPoint(_this.topo[i].bandwidth, {

@@ -124,6 +125,5 @@ east: val.east.total,

});
results = [];
for (dir in point) {
ref = point[dir], capacity = ref.capacity, cost = ref.cost;
results.push(res.push({
res.push({
topoIdx: i,

@@ -135,7 +135,7 @@ dir: dir,

cost: cost
}));
});
}
return results;
return res;
};
})(this)));
})(this), []));
};

@@ -142,0 +142,0 @@

@@ -29,3 +29,3 @@ // Generated by CoffeeScript 1.10.0

console.log(JSON.stringify(square.edges));
console.log(JSON.stringify(ospf, "", 2));

@@ -32,0 +32,0 @@ console.log(JSON.stringify(ospf.totalUtilization()));

@@ -6,3 +6,3 @@ // Generated by CoffeeScript 1.10.0

ld = require("lodash");
ld = require("underscore");

@@ -20,3 +20,3 @@ Rat = require("rat.js");

demandsToDems = function(demands) {
return ld.transform(demands, function(res, d, i) {
return demands.reduce(function(res, d, i) {
var dst, name, src, traffic;

@@ -33,3 +33,3 @@ src = d.src, dst = d.dst, name = d.name, traffic = d.traffic;

}
return res[src].push({
res[src].push({
name: name,

@@ -40,2 +40,3 @@ dst: dst,

});
return res;
}, {});

@@ -77,11 +78,10 @@ };

if (this.demands == null) {
this.demands = ld.transform(this.vertices, (function(_this) {
this.demands = this.vertices.reduce((function(_this) {
return function(res, v) {
var j, len, ref, results, x;
var j, len, ref, x;
ref = _this.vertices;
results = [];
for (j = 0, len = ref.length; j < len; j++) {
x = ref[j];
if (x !== v) {
results.push(res.push({
res.push({
src: v,

@@ -91,8 +91,8 @@ dst: x,

traffic: 1
}));
});
}
}
return results;
return res;
};
})(this));
})(this), []);
}

@@ -125,3 +125,3 @@ this.dems = demandsToDems(this.demands);

e = marked_edges[i];
e_edges = ld(dagEdges).reject(function(x) {
e_edges = ld.chain(dagEdges).reject(function(x) {
return marked_edges[x] != null;

@@ -229,4 +229,5 @@ }).map(function(idx) {

unfeasibleDems = {};
edges = ld.transform(edge_indexes, function(res, e) {
return res[e] = ld.clone(initValue);
edges = edge_indexes.reduce(function(res, e) {
res[e] = ld.clone(initValue);
return res;
}, {});

@@ -244,5 +245,5 @@ if (ld.isArray(dems)) {

}
if (ld(dagEdges).filter(function(x) {
if (ld.isEmpty(ld.filter(dagEdges, function(x) {
return edges[x] != null;
}).isEmpty()) {
}))) {
continue;

@@ -249,0 +250,0 @@ }

@@ -5,3 +5,3 @@ // Generated by CoffeeScript 1.10.0

ld = require("lodash");
ld = require("underscore");

@@ -8,0 +8,0 @@ generators = require("../generators/index.coffee");

@@ -5,3 +5,3 @@ // Generated by CoffeeScript 1.10.0

ld = require("lodash");
ld = require("underscore");

@@ -16,9 +16,10 @@ KeepNFirst = require("keep-n-first");

return function(u1, u2) {
return ld.transform(u1, function(res, val, idx) {
return ld.reduce(u1, function(res, val, idx) {
if (u2[idx] != null) {
return res[idx] = fn(val, u2[idx]);
res[idx] = fn(val, u2[idx]);
} else {
return res[idx] = val;
res[idx] = val;
}
});
return res;
}, {});
};

@@ -53,20 +54,25 @@ };

weightFn = ospf.weightFn;
stopWeight = ld.sum(edges, weightFn);
stopWeight = edges.reduce(function(r, x) {
return r + weightFn(x);
}, 0);
downEdgesIdx = ld.indexBy(downEdges);
downEdgesMap = ld.transform(downEdges, function(res, e_idx) {
return res[JSON.stringify(edges[e_idx])] = true;
downEdgesMap = downEdges.reduce(function(res, e_idx) {
res[JSON.stringify(edges[e_idx])] = true;
return res;
}, {});
baseUtilizationEdges = subUtilization(utilization.edges, ospf.totalUtilization(null, demsOnDownEdges).edges);
tempGraph = new Graph(ld.transform(edges, function(res, e, _idx) {
tempGraph = new Graph(edges.reduce(function(res, e, _idx) {
if (downEdgesIdx[_idx] == null) {
return res.push(ld.assign({}, e, {
res.push(ld.assign({}, e, {
_idx: _idx
}));
}
}));
return res;
}, []));
reroutedOspf = new Ospf(tempGraph, Ospf.demsToDemands(demsOnDownEdges), weightFn);
reroutedUtilization = reroutedOspf.totalUtilization();
tempEdges = tempGraph.edges;
uu = ld.transform(reroutedUtilization.edges, function(res, u, e) {
return res[tempEdges[e]._idx] = u;
uu = ld.reduce(reroutedUtilization.edges, function(res, u, e) {
res[tempEdges[e]._idx] = u;
return res;
}, {});

@@ -73,0 +79,0 @@ onEdges = addUtilization(baseUtilizationEdges, uu);

{
"name": "libgraph",
"version": "1.2.1",
"version": "1.2.2",
"description": "graph lib in js/coffee",

@@ -32,10 +32,10 @@ "main": "Graph.js",

"keep-n-first": "^1.0.0",
"lodash": "^3.10.1",
"rat.js": "^1.0.0",
"trie-array": "^1.1.3"
"rat.js": "^1.2.0",
"trie-array": "^1.1.3",
"underscore": "^1.8.3"
},
"devDependencies": {
"coffee-script": "^1.10.0",
"dag-json": "^1.0.2"
"dag-json": "*"
}
}

@@ -5,3 +5,3 @@ // Generated by CoffeeScript 1.10.0

ld = require("lodash");
ld = require("underscore");

@@ -12,9 +12,10 @@ topoOrder = function(graph) {

result = [];
inDegree = ld.transform(graph.vertices, function(res, val, v) {
inDegree = ld.reduce(graph.vertices, function(res, val, v) {
if (ld.isEmpty(graph.dst[v])) {
return starts.push(v);
starts.push(v);
} else {
return res[v] = graph.dst[v].length;
res[v] = graph.dst[v].length;
}
});
return res;
}, {});
while (x = starts.pop()) {

@@ -21,0 +22,0 @@ result.push(x);

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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