Socket
Book a DemoInstallSign in
Socket

connection-scan-algorithm

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

connection-scan-algorithm

Connection Scan Algorithm

latest
Source
npmnpm
Version
1.1.0
Version published
Maintainers
1
Created
Source

Connection Scan Algorithm

Travis npm David

Implementation of the Connection Scan Algorithm in TypeScript.

Additional features not in the paper implementation:

  • Various fixes in order to improve the quality of results.
  • Calendars are checked to ensure services are running on the specified day
  • The origin and destination may be a set of stops
  • Interchange time at each station is applied
  • Pickup / set down marker of stop times are obeyed
  • Multi-criteria journey filtering
  • Transfers (footpaths) can be used

Usage

It will work with any well formed GTFS data set.

Node +11 is required for all examples.

npm install --save connection-scan-algorithm

Depart After Query

Find the first results that depart after a specific time

const {GtfsLoader, JourneyFactory, ConnectionScanAlgorithm, ScanResultsFactory, TimeParser, MultipleCriteriaFilter, DepartAfterQuery} = require("connection-scan-algorithm");

const gtfsLoader = new GtfsLoader(new TimeParser());
const gtfs = await gtfsLoader.load(fs.createReadStream("gtfs.zip"));
const csa = new ConnectionScanAlgorithm(gtfs.connections, gtfs.transfers, new ScanResultsFactory(gtfs.interchange));
const query = new DepartAfterQuery(csa, new JourneyFactory(), [new MultipleCriteriaFilter()]);
const results = query.plan(["TBW"], ["NRW"], new Date(), 9 * 3600);

TODO

  • Short circuit connection scan once all destinations found
  • Fake trip ID for transfers to (removes branch)
  • Only scan transfers for stops once (avoid re-scan when time is improved)

Contributing

Issues and PRs are very welcome. To get the project set up run:

git clone git@github.com:planarnetwork/connection-scan-algorithm
npm install --dev
npm test

If you would like to send a pull request please write your contribution in TypeScript and if possible, add a test.

License

This software is licensed under GNU GPLv3.

Keywords

Journey

FAQs

Package last updated on 23 Jul 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts