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_timeThe leftover is the slack:
slack = available_time − inbound_time − outbound_timeCallers control what the slack means at the product level:
- Pass
available_time = total_window − activity_duration − bufferto bake in an activity and a safety margin before calling. - Use
min_slackinbuild_feasibility_polygonto 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 fromdestinationrather than N individual searches. NetworkTypeis threaded through so walk / bike / drive travel times are respected consistently.compute_feasibilityreturnsErr(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§
- Feasibility
Result - Full result of a successful
compute_feasibilitycall. - Feasible
Node - Per-node feasibility data for a single origin → destination query.
- Prism
Graph - Graph-shaped view for a two-ended, time-bounded query.
Enums§
- Infeasible
Reason - 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
originand can reachdestinationwithinavailable_timeseconds.