You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

dijkstrajs

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dijkstrajs

A simple JavaScript implementation of Dijkstra's single-source shortest-paths algorithm.

1.0.1
Source
npmnpm
Version published
Weekly downloads
3.4M
0.54%
Maintainers
1
Weekly downloads
 
Created

What is dijkstrajs?

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.

What are dijkstrajs's main functionalities?

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' ]

Other packages similar to dijkstrajs

Keywords

dijkstra

FAQs

Package last updated on 13 Nov 2015

Did you know?

Socket

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.

Install

Related posts