@h4tl2/route-optimizer

0.1.4 • Public • Published

Route Optimizer

A npm module for delivery-service test

Installation

npm install @h4tl2/route-optimizer

Usage

const RouteOptimizer = require('@h4tl2/route-optimizer');

const routeOpt = new RouteOptimizer('AB1, AC4, AD10, BE3, CD4, CF2, DE1, EB3, EA2, FD1');

// calculate cost of the specific route
routeOpt.calculateCost('A-B-E') // out: 4

// count all possible path from start to destination
routeOpt.countAvailableRoute('E', 'D', 4) // out: 4
// count all possible path from start to destination consider maximum cost
routeOpt.countAvailableRouteWithCost('E', 'E', 20) // out: 29

// Calculate​ ​the​ ​cheapest​ ​delivery​ ​route​ ​between​ ​two​ ​town
routeOpt.calculateCheapestCost('E', 'D') // out: 9

Tests

Clone the repostitory then run npm run test

Readme

Keywords

none

Package Sidebar

Install

npm i @h4tl2/route-optimizer

Weekly Downloads

1

Version

0.1.4

License

ISC

Unpacked Size

373 kB

Total Files

9

Last publish

Collaborators

  • h4tl2