0.0.2 • Published 6 years ago

dijkstra-algorithm v0.0.2

Weekly downloads
3
License
ISC
Repository
github
Last release
6 years ago

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 ]);