Socket
Socket
Sign inDemoInstall

dijkstra-edsger

Package Overview
Dependencies
0
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    dijkstra-edsger

Algorithm's Dijkstra Shortest Finder


Version published
Weekly downloads
7
increased by133.33%
Maintainers
1
Install size
7.06 kB
Created
Weekly downloads
 

Readme

Source

node-dijkstra

Dijkstra's Algorithm For Shortest Path Finder Directed Graph.

Installation


$ npm install node-dijkstra

$ mkdir myApp
$ cd myApp
$ npm install dijkstra-edsger
$ touch app.js 

Sample Code


var Dijkstra = require('dijkstra-edsger');

var road = [[1, 2, 1],
            [1, 3, 9],
            [1, 5, 3],
            [2, 4, 3],
            [2, 3, 7],
            [4, 3, 2],
            [4, 1, 1],
            [5, 2, 4],
            [5, 4, 2]]

var start = 1, 
    end   = 3;

var dij = new Dijkstra(start, end, road );

console.log("Cost = " + dij.getCost() )

console.log("Shortest path from the node "+ start + " to "+ end + " -> "+ dij.getShortestPath() )

License

MIT

FAQs

Last updated on 11 Sep 2014

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc