ngraph.graph
Advanced tools
Comparing version 0.0.12 to 0.0.13
18
index.js
@@ -5,2 +5,6 @@ /** | ||
// TODO: need to change storage layer: | ||
// 1. Be able to get all nodes O(1) | ||
// 2. Be able to get number of links O(1) | ||
/** | ||
@@ -121,3 +125,3 @@ * @example | ||
*/ | ||
getNodesCount: function() { | ||
getNodesCount: function () { | ||
return nodesCount; | ||
@@ -129,3 +133,3 @@ }, | ||
*/ | ||
getLinksCount: function() { | ||
getLinksCount: function () { | ||
return links.length; | ||
@@ -203,2 +207,12 @@ }, | ||
/** | ||
* Detects whether there is a node with given id | ||
* | ||
* Operation complexity is O(n1 | ||
* NOTE: this function is synonim for getNode() | ||
* | ||
* @returns node if there is one; Falsy value otherwise. | ||
*/ | ||
hasNode: getNode, | ||
/** | ||
* Gets an edge between two nodes. | ||
@@ -205,0 +219,0 @@ * Operation complexity is O(n) where n - number of links of a node. |
{ | ||
"name": "ngraph.graph", | ||
"version": "0.0.12", | ||
"version": "0.0.13", | ||
"description": "Base graph structure in ngraph.*", | ||
@@ -29,3 +29,5 @@ "main": "index.js", | ||
"argg": "0.0.1", | ||
"benchmark": "^1.0.0", | ||
"istanbul": "^0.3.5", | ||
"ngraph.generators": "0.0.16", | ||
"plato": "^1.3.0", | ||
@@ -32,0 +34,0 @@ "tap": "~0.4.4" |
@@ -18,2 +18,12 @@ var test = require('tap').test, | ||
test('hasNode checks node', function(t) { | ||
var graph = createGraph(); | ||
graph.addNode(1); | ||
t.ok(graph.hasNode(1), 'node is there'); | ||
t.notOk(graph.hasNode(2), 'should not be here'); | ||
t.end(); | ||
}); | ||
test('hasLink checks links', function (t) { | ||
@@ -20,0 +30,0 @@ var graph = createGraph(); |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
37101
9
902
6