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

graphology-utils

Package Overview
Dependencies
Maintainers
1
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

graphology-utils - npm Package Compare versions

Comparing version 1.4.0 to 1.5.0

2

package.json
{
"name": "graphology-utils",
"version": "1.4.0",
"version": "1.5.0",
"description": "Miscellaneous utils for graphology.",

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

@@ -172,3 +172,3 @@ [![Build Status](https://travis-ci.org/graphology/graphology-utils.svg)](https://travis-ci.org/graphology/graphology-utils)

* **graph** *Graph*: source graph.
* **nodes** *array|Set*: the subgraph's array or set of nodes.
* **nodes** *array|Set|function*: the array, set or function defining the subgraph's nodes.

@@ -12,5 +12,5 @@ /**

* @param {Graph} graph - Graph containing the subgraph.
* @param {array} nodes - Array or set of the nodes to keep.
* @return {Graph}
* @param {array} nodes - Array, set or function defining the nodes wanted in the subgraph.
*/
module.exports = function subGraph(graph, nodes) {

@@ -26,8 +26,17 @@ var nodesSet;

}
else if (typeof nodes === 'function') {
nodesSet = new Set();
graph.forEachNode(function(key, attrs) {
if (nodes(key, attrs)) {
nodesSet.add(key);
}
});
}
else {
throw new Error('graphology-utils/subgraph: given "nodes" is neither an array nor a set.');
throw new Error(
'The argument "nodes" is neither an array, nor a set, nor a function.'
);
}
if (nodesSet.size === 0)
return subGraphResult;
if (nodesSet.size === 0) return subGraphResult;

@@ -34,0 +43,0 @@ var insertedSelfloops = new Set(); // Useful to check if a selfloop has already been inserted or not

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