Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save linusnorton/cce2df9db1b223c46ddccb0cbea477e2 to your computer and use it in GitHub Desktop.
Save linusnorton/cce2df9db1b223c46ddccb0cbea477e2 to your computer and use it in GitHub Desktop.
function isReachable(results: Results, c: Connection): boolean {
const interchangeTime = results.bestConnections[c.origin] ? interchangeTimeAt(c.origin) : 0;
const reachableWithInterchange = results.earliestArrival[c.origin]
&& results.earliestArrival[c.origin] + interchangeTime <= c.departureTime;
results.tripsReachable[c.trip.tripId] = reachableWithInterchange || results.tripsReachable[c.trip.tripId];
return results.tripsReachable[c.trip.tripId];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment