Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
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.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
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

FAQs

Package last updated on 15 Apr 2023

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

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