dijkstra-algorithm
v0.0.2
Published
dijkstra,algorithm
Downloads
3
Readme
Dijkstra-algorithm
Dijkstra algorithm to get path in graph
Test
npm test
API
Dijkstra(graph, index) -> array
usage
const dijkstra = require('dijkstra-algorithm');
const index = 1;
const res = dijkstra([
Infinity, 1, Infinity, 1,
Infinity, 1, 1, 1,
1, 1, Infinity, 1,
1, 1, 1, Infinity
], index);
assert(res[index] === 0);
assert.deepEqual(res, [ 1, 0, 1, 2 ]);