Socket
Socket
Sign inDemoInstall

graphlib

Package Overview
Dependencies
Maintainers
1
Versions
59
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

graphlib - npm Package Compare versions

Comparing version 0.5.6 to 0.5.7

5

CHANGELOG.md

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

v0.5.7
======
* Fix toString, copy, filterNodes for compound graphs.
v0.5.6

@@ -2,0 +7,0 @@ ======

23

lib/BaseGraph.js

@@ -144,20 +144,17 @@ var filter = require("./filter"),

BaseGraph.prototype.copy = function() {
return this.filterNodes(filter.all);
var copy = new this.constructor();
copy.graph(this.graph);
this.eachNode(function(u, value) { copy.addNode(u, value); });
this.eachEdge(function(e, u, v, value) { copy.addEdge(e, u, v, value); });
return copy;
};
BaseGraph.prototype.filterNodes = function(filter) {
var graph = new this.constructor();
this.eachNode(function(u, value) {
if (filter(u, value)) {
graph.addNode(u, value);
var copy = this.copy();
this.nodes().forEach(function(u) {
if (!filter(u)) {
copy.delNode(u);
}
});
this.eachEdge(function(e, u, v, value) {
if (graph.hasNode(u) && graph.hasNode(v)) {
graph.addEdge(e, u, v, value);
}
});
return graph;
return copy;
};

@@ -164,0 +161,0 @@

@@ -32,1 +32,5 @@ var Digraph = require("./Digraph"),

};
CDigraph.prototype.toString = function() {
return "CDigraph " + JSON.stringify(this, null, 2);
};

@@ -32,1 +32,5 @@ var Graph = require("./Graph"),

};
CGraph.prototype.toString = function() {
return "CGraph " + JSON.stringify(this, null, 2);
};

@@ -73,3 +73,11 @@ // This file provides a helper function that mixes-in Dot behavior to an

Constructor.prototype.copy = function() {
var copy = SuperConstructor.prototype.copy.call(this);
this.nodes().forEach(function(u) {
copy.parent(u, this.parent(u));
}, this);
return copy;
};
return Constructor;
}

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

module.exports = '0.5.6';
module.exports = '0.5.7';
{
"name": "graphlib",
"version": "0.5.6",
"version": "0.5.7",
"description": "A directed and undirected multi-graph library",

@@ -5,0 +5,0 @@ "main": "index.js",

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