UNPKG

minotor

Version:

A lightweight client-side transit routing library.

35 lines (34 loc) 1.47 kB
import { StopsIndex } from '../stops/stopsIndex.js'; import { Timetable } from '../timetable/timetable.js'; import { Query, RangeQuery } from './query.js'; import { RangeResult } from './rangeResult.js'; import { Result } from './result.js'; export type { ArrivalWithDuration, ParetoRun } from './rangeResult.js'; export { RangeResult } from './rangeResult.js'; export type { AccessEdge, Arrival, OriginNode, RoutingEdge, TransferEdge, VehicleEdge, } from './state.js'; export { RoutingState, UNREACHED_TIME } from './state.js'; /** * A public transportation router implementing the RAPTOR and Range RAPTOR * algorithms. * * Thin facade over {@link PlainRouter} and {@link RangeRouter}: constructs the * shared {@link Raptor} engine and {@link AccessFinder} once and delegates each * query to the appropriate router. * * @see https://www.microsoft.com/en-us/research/wp-content/uploads/2012/01/raptor_alenex.pdf */ export declare class Router { private readonly plainRouter; private readonly rangeRouter; constructor(timetable: Timetable, stopsIndex: StopsIndex); /** * Standard RAPTOR: finds the earliest-arrival journey from `query.from` to * `query.to` for the given departure time. */ route(query: Query): Result; /** * Range RAPTOR: finds all Pareto-optimal journeys within the departure-time * window `[query.departureTime, query.lastDepartureTime]`. */ rangeRoute(query: RangeQuery): RangeResult; }