Skip to content

anekpattanakij/dijkstra-short-path

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

dijkstra-short-path

npm install dijkstra-short-path --save

Usage

Basic example:

const Graph = require('dijkstra-short-path');

const route = new Graph();

route.addNode('A', new Map([['B', 2], ['C', 5]])); // Distance list should be Map
route.addNode('B', new Map([['A', 1], ['C', 2]])); // Distance from  B->A can be different from A->B.
route.addNode('C', new Map([['D', 1]]));

route.path('A', 'D'); // return => { cost:5 , path : [ 'A', 'B', 'C', 'D' ]}

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published