Skip to main content

Module feasibility

Module feasibility 

Source
Expand description

Network-time prisms: “which nodes can I visit between origin and destination within a given time budget, and how much slack remains?”

§Concept

A node v is feasible if:

inbound_time(origin → v) + outbound_time(v → destination) ≤ available_time

The leftover is the slack:

slack = available_time − inbound_time − outbound_time

Callers control what the slack means at the product level:

  • Pass available_time = total_window − activity_duration − buffer to bake in an activity and a safety margin before calling.
  • Use min_slack in build_feasibility_polygon to ask “where can I stop and still have ≥ N seconds left?”

§Design notes

  • The reverse Dijkstra runs on the reversed graph so that outbound_time(v → destination) is computed as a single one-to-many search from destination rather than N individual searches.
  • NetworkType is threaded through so walk / bike / drive travel times are respected consistently.
  • compute_feasibility returns Err(InfeasibleReason) when the trip cannot be completed within the budget at all, giving callers a clear signal to surface to users rather than an opaque empty result.

Structs§

FeasibilityResult
Full result of a successful compute_feasibility call.
FeasibleNode
Per-node feasibility data for a single origin → destination query.
PrismGraph
Graph-shaped view for a two-ended, time-bounded query.

Enums§

InfeasibleReason
Reason a feasibility query cannot produce any results.

Functions§

build_feasibility_polygon
Build a polygon enclosing all feasible nodes whose slack ≥ min_slack.
compute_feasibility
Compute two-sided feasibility using the precomputed walk/bike/drive travel time on each edge.
compute_feasibility_with
Compute which nodes are reachable from origin and can reach destination within available_time seconds.