New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

graphology-dag

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

graphology-dag - npm Package Compare versions

Comparing version 0.0.1 to 0.1.0

has-cycle.d.ts

1

index.d.ts

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

export {default as hasCycle} from './has-cycle';
export {default as willCreateCycle} from './will-create-cycle';

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

exports.hasCycle = require('./has-cycle.js');
exports.willCreateCycle = require('./will-create-cycle.js');

3

package.json
{
"name": "graphology-dag",
"version": "0.0.1",
"version": "0.1.0",
"description": "Directed acyclic graph functions for graphology.",
"main": "index.js",
"files": [
"has-cycle.js",
"index.js",

@@ -8,0 +9,0 @@ "will-create-cycle.js",

@@ -13,4 +13,30 @@ # Graphology DAG

- [hasCycle](#hascycle)
- [willCreateCycle](#willcreatecycle)
### hasCycle
Function returning whether the given directed graph contains at least one cycle.
Note that this function will also work with a disconnected graph.
```js
import {hasCycle} from 'graphology-dag';
// Alternatively, to load only the relevant code:
import hasCycle from 'graphology-dag/has-cycle';
const graph = new DirectedGraph();
graph.mergeEdge(0, 1);
graph.mergeEdge(1, 2);
graph.mergeEdge(2, 3);
hasCycle(graph);
>>> false
graph.mergeEdge(3, 0);
hasCycle(graph);
>>> true
```
### willCreateCycle

@@ -22,2 +48,4 @@

Note finally that this function will also work with DAG forests (sets of disconnected DAGs living in the same graph instance).
```js

@@ -24,0 +52,0 @@ import {willCreateCycle} from 'graphology-dag';

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