
Security News
The Next Open Source Security Race: Triage at Machine Speed
Claude Opus 4.6 has uncovered more than 500 open source vulnerabilities, raising new considerations for disclosure, triage, and patching at scale.
digraph-js
Advanced tools
Make Directed Graphs traversal and construction effortless, including deep circular dependency detection.
digraph-js is a lightweight and dependency free library allowing you to create a Directed Graph data structure with embedded features such as deep cycle dependency detection and graph introspection (find deeply ancestors and successors for any given vertex). It can be used to model complex dependencies systems based on graphs.
✅ Detect deeply circular dependencies while having the possibility to limit the search depth ✅ Discover what are the direct and indirect child and parent dependencies of each vertex in the graph (top-to-bottom or bottom-to-top traversals) ✅ Find out if a path exists between two vertices ✅ Manage graph edges and vertices seamlessly
$ npm install digraph-js
import { DiGraph } from 'digraph-js';
import assert from "node:assert";
const myGraph = new DiGraph();
const myDependencyA = { id: "dependencyA", adjacentTo: [], body: {} };
const myDependencyB = { id: "dependencyB", adjacentTo: [], body: {} };
// Add vertices to the graph
myGraph.addVertices(myDependencyA, myDependencyB);
// Link graph vertices: A ---> B link created
myGraph.addEdge({ from: myDependencyA.id, to: myDependencyB.id });
// Detect cycles (A ---> B and B ---> A)
myGraph.addEdge({ from: myDependencyB.id, to: myDependencyA.id });
// Detect if the Directed Graph is acyclic (Directed Acyclic Graph)
assert.equal(myGraph.isAcyclic, false);
assert.deepEqual(myGraph.findCycles().cycles, [ ["dependencyB", "dependencyA"] ]);
Take for instance the image above with four Vertices each representing a JavaScript file.
Now the question is: what are the relationships between these files? In all programming languages, one file might import one or multiple files. Whenever a file imports another one, an implicit relationship is created.
hello.js
export function sayHello() { }
main.js
import { sayHello } from "hello.js";
As you can see above, main.js imports hello.js to use the sayHello
function. The static import creates an implicit relationship between both files.
In the fields of graphs, this relationship can be modeled as a directed edge
from main.js to hello.js (can be written as main.js ---> hello.js)
We can also say that main.js depends on hello.js.
We can update the graph with our edges represented:
Basically this graph says that:
This structure may seem simple but can in fact be used to model very complex schemas such as:
FAQs
A dependency free library to create and traverse directed graphs
The npm package digraph-js receives a total of 65,961 weekly downloads. As such, digraph-js popularity was classified as popular.
We found that digraph-js demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Claude Opus 4.6 has uncovered more than 500 open source vulnerabilities, raising new considerations for disclosure, triage, and patching at scale.

Research
/Security News
Malicious dYdX client packages were published to npm and PyPI after a maintainer compromise, enabling wallet credential theft and remote code execution.

Security News
gem.coop is testing registry-level dependency cooldowns to limit exposure during the brief window when malicious gems are most likely to spread.