graph-alg
A Node.js module to manipulate Graph
Installation
npm install graph-alg --save
Usage
Javascript
const Dijkstra = Dijkstra;
TypeScript
;
Test
npm run test
Graph class
Dijkstra
Example:
; /** * Oriented Graph with ponderation * +-+ +-+ +-+ +-+ * |0+---5---->1+----+-4-->3+-----3--->5| * +++ +^+ | +++ +^+ * | | | | | * | 8 2 6 | * | | | | | * | +++ | +v+ | * +----2---->2+--7-+---->4+-----1----+ * +-+ +-+ */;// Initialize Dijkstra alg with an oriented graph;// Compute the smaller path from node 0 to node 5; // result.distance equals 8// result.path equals ["0", "1", "4", "5"]