
Security News
Bun 1.2.19 Adds Isolated Installs for Better Monorepo Support
Bun 1.2.19 introduces isolated installs for smoother monorepo workflows, along with performance boosts, new tooling, and key compatibility fixes.
A simple JavaScript implementation of Dijkstra's single-source shortest-paths algorithm.
The dijkstrajs npm package is a JavaScript implementation of Dijkstra's shortest path algorithm. It allows you to find the shortest path between nodes in a graph, which can be useful for various applications such as routing, network analysis, and more.
Find Shortest Path
This feature allows you to find the shortest path between two nodes in a graph. The code sample demonstrates how to define a graph and use the dijkstrajs package to find the shortest path from node 'A' to node 'D'.
const dijkstra = require('dijkstrajs');
const graph = {
A: { B: 1, C: 4 },
B: { A: 1, C: 2, D: 5 },
C: { A: 4, B: 2, D: 1 },
D: { B: 5, C: 1 }
};
const startNode = 'A';
const endNode = 'D';
const shortestPath = dijkstra.find_path(graph, startNode, endNode);
console.log(shortestPath); // Output: [ 'A', 'B', 'C', 'D' ]
Graphlib is a JavaScript library that provides data structures for creating and manipulating graphs, along with algorithms for graph analysis, including Dijkstra's algorithm. It offers more comprehensive graph manipulation capabilities compared to dijkstrajs.
js-graph-algorithms is a library that implements various graph algorithms in JavaScript, including Dijkstra's algorithm. It provides a broader range of graph algorithms and data structures, making it a more versatile choice for complex graph-related tasks.
Graphology is a robust and versatile library for graph theory in JavaScript. It supports a wide range of graph algorithms, including Dijkstra's algorithm, and offers extensive features for graph manipulation and analysis. It is more feature-rich compared to dijkstrajs.
dijkstrajs is a simple JavaScript implementation of Dijkstra's single-source shortest-paths algorithm.
The code was originally written by Wyatt Baldwin and turned into a node module by Thomas Cort.
npm install dijkstrajs
See test/dijkstra.test.js
in the sources for some example code.
FAQs
A simple JavaScript implementation of Dijkstra's single-source shortest-paths algorithm.
The npm package dijkstrajs receives a total of 3,207,108 weekly downloads. As such, dijkstrajs popularity was classified as popular.
We found that dijkstrajs demonstrated a not healthy version release cadence and project activity because the last version was released 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
Bun 1.2.19 introduces isolated installs for smoother monorepo workflows, along with performance boosts, new tooling, and key compatibility fixes.
Security News
Popular npm packages like eslint-config-prettier were compromised after a phishing attack stole a maintainer’s token, spreading malicious updates.
Security News
/Research
A phishing attack targeted developers using a typosquatted npm domain (npnjs.com) to steal credentials via fake login pages - watch out for similar scams.