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

mathgraph

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mathgraph - npm Package Compare versions

Comparing version 0.0.1 to 0.0.2

28

graph.js

@@ -177,22 +177,22 @@ // graph.js

GraphJS.prototype.isForest = function () {
var isForest = true;
var hasMultipleParents = false;
var numberOflinksToNodes = {};
_.each(this.referenceDictionary, function (node) {
if(!node.discovered) {
depthFirstSearch(
node,
function () { return false; },
function () {
isForest = false;
}
);
}
_.each(node.links, function (link) {
if(!numberOflinksToNodes[link.ref.id]) {
numberOflinksToNodes[link.ref.id] = 0;
}
numberOflinksToNodes[link.ref.id] += 1;
});
});
// cleanup
_.each(this.referenceDictionary, function (node) {
delete node.discovered;
_.each(numberOflinksToNodes, function (count) {
if(count > 1) {
hasMultipleParents = true;
}
});
return isForest;
return !hasMultipleParents && !this.hasCycles();
};

@@ -199,0 +199,0 @@

{
"name": "mathgraph",
"version": "0.0.1",
"version": "0.0.2",
"description": "graph utilities",

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

@@ -152,2 +152,7 @@ var GraphJS = require('./graph');

test.strictEqual(new GraphJS([
{ id: 1, data: 'a' },
{ id: 2, data: 'b', link: 1 }
]).isForest(), true, 'mixed up order (in response to a bug)');
test.done();

@@ -154,0 +159,0 @@ };

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