Socket
Socket
Sign inDemoInstall

graph

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

graph - npm Package Compare versions

Comparing version 0.1.0 to 0.2.0

.npmignore

5

lib/graph.js

@@ -105,2 +105,7 @@ (function ()

{
// set('a', '-b', ...) is a synonym for dir('a', 'b', ...)
if (v[0] == '-') {
return this.dir(u, v.substr(1), edge);
}
// take an undefined edge as simply 'true' for convenience

@@ -107,0 +112,0 @@ edge = (edge === undefined ? true : edge);

2

package.json
{
"name": "graph",
"description": "library for manipulating directed and undirected graphs",
"version": "0.1.0",
"version": "0.2.0",
"homepage": "http://github.johntantalo.com/graphjs/",

@@ -6,0 +6,0 @@ "repository": {

@@ -36,2 +36,6 @@ # GraphJS

#### With directed edges
new Graph({a: ['-b', '-c']}); # Directed edges to b and c.
### Degree, size, order, and adjacency

@@ -62,3 +66,7 @@

g.has('b', 'a'); # false
#### Alternative syntax
g.set('a', '-b'); # Same as g.dir('a', 'b');
### Deleting directed edges

@@ -65,0 +73,0 @@

@@ -186,2 +186,30 @@ if (typeof(require) !== 'undefined') {

'Constructor with directed edges': function (test)
{
var g = new Graph({'a': ['-b', '-c']});
test.ok(g.order() === 3,
"Number of vertices is 3.");
test.ok(g.size() === 2,
"Number of edges is 2.");
test.ok(g.degree('a') === 2,
"Out degree of 'a' is 1.");
test.ok(g.degree('b') === 0,
"Out degree of 'b' is 0.");
test.ok(g.degree('c') === 0,
"Out degree of 'c' is 0.");
test.ok(g.indegree('a') === 0,
"In degree of 'a' is 0.");
test.ok(g.indegree('b') === 1,
"In degree of 'b' is 1.");
test.ok(g.indegree('c') === 1,
"In degree of 'c' is 1.");
test.ok(g.has('a', 'b'));
test.ok(g.has('a', 'c'));
test.ok(!g.has('b', 'a'));
test.ok(!g.has('c', 'a'));
test.ok(!g.has('c', 'b'));
test.ok(!g.has('b', 'c'));
test.done();
},
'Multiget': function (test)

@@ -188,0 +216,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